public static SVGPath drawFakeVoronoi ( Projection2D proj , List < double [ ] > means ) { CanvasSize viewport = proj . estimateViewport ( ) ; final SVGPath path = new SVGPath ( ) ; // Difference final double [ ] dirv = VMath . minus ( means . get ( 1 ) , means . get ( 0 ) ) ; VMath . rotate90Equals ( dirv ) ; double [ ] dir = proj . fastProjectRelativeDataToRenderSpace ( dirv ) ; // Mean final double [ ] mean = VMath . plus ( means . get ( 0 ) , means . get ( 1 ) ) ; VMath . timesEquals ( mean , 0.5 ) ; double [ ] projmean = proj . fastProjectDataToRenderSpace ( mean ) ; double factor = viewport . continueToMargin ( projmean , dir ) ; path . moveTo ( projmean [ 0 ] + factor * dir [ 0 ] , projmean [ 1 ] + factor * dir [ 1 ] ) ; // Inverse direction: dir [ 0 ] *= - 1 ; dir [ 1 ] *= - 1 ; factor = viewport . continueToMargin ( projmean , dir ) ; path . drawTo ( projmean [ 0 ] + factor * dir [ 0 ] , projmean [ 1 ] + factor * dir [ 1 ] ) ; return path ; }
Fake Voronoi diagram . For two means only