Ejemplo n.º 1
0
 public Vector getPerpendicularVectorPointedTowards(
     Point2D startPoint, double magnitude, Point2D directionPoint) {
   Vector perpVect = this.moveTo(startPoint);
   if (perpVect.relativeCCW(directionPoint) > 0) {
     // we need to turn counter clockwise
     perpVect = perpVect.rotate(-1 * Math.PI / 2.0);
   } else {
     // we'll rotate clockwise
     perpVect = perpVect.rotate(Math.PI / 2.0);
   }
   return perpVect.rescale(magnitude);
 }
Ejemplo n.º 2
0
 public Vector getPerpendicularVector(Point2D startPoint, double magnitude) {
   Vector perpVect = this.moveTo(startPoint);
   perpVect = perpVect.rotate(Math.PI / 2.0);
   return perpVect.rescale(magnitude);
 }