public static final Point [ ] midPoints ( int count , Point p1 , Point p2 ) { Point [ ] res = new Point [ count ] ; Point gap = AbstractPoint . subtract ( p2 , p1 ) ; Point leg = AbstractPoint . mul ( ( double ) ( 1 ) / ( double ) ( count + 1 ) , gap ) ; for ( int ii = 0 ; ii < count ; ii ++ ) { res [ ii ] = AbstractPoint . add ( p1 , AbstractPoint . mul ( ii + 1 , leg ) ) ; } return res ; }
Creates evenly spaced midpoints in a line between p1 and p2 Example if count = 1 it creates point in the midle of p1 and p2