public static Point normalize(Point p,double length){
  double len=Math.sqrt(p.x * p.x + p.y * p.y);
  length=length / len;
  return new Point(p.x * length,p.y * length);
}

public static Point normalize ( Point p , double length ) { double len = Math . sqrt ( p . x * p . x + p . y * p . y ) ; length = length / len ; return new Point ( p . x * length , p . y * length ) ; }
normalize a point . scales the line segment between ( 0 , 0 ) and the current point to a set length . for example , if the current point is ( 0 , 5 ) , and you normalize it to 1 , the point returned is at ( 0 , 1 ) .
