public static Vector2d calculatePerpendicularUnitVector ( Point2d point1 , Point2d point2 ) { Vector2d vector = new Vector2d ( ) ; vector . sub ( point2 , point1 ) ; vector . normalize ( ) ; // Return the perpendicular vector return new Vector2d ( - 1.0 * vector . y , vector . x ) ; }
Determines the normalized vector orthogonal on the vector p1 - &gt ; p2 .