protected MutableCoord calculatePointOnLine(MutableCoord P1,MutableCoord P2,MutableCoord P3){
  double rel=calculateRelation(P1,P2,P3);
  double dx=Math.abs(P1.getX() - P2.getX()), dy=Math.abs(P1.getY() - P2.getY());
  double nx=P1.getX() + dx * rel, ny=P1.getY() + dy * rel;
  if (P1.getX() > P2.getX())   nx=P1.getX() - dx * rel;
  if (P1.getY() > P2.getY())   ny=P1.getY() - dy * rel;
  MutableCoord result=new MutableCoord(nx,ny);
  return result;
}

protected MutableCoord calculatePointOnLine ( MutableCoord P1 , MutableCoord P2 , MutableCoord P3 ) { double rel = calculateRelation ( P1 , P2 , P3 ) ; double dx = Math . abs ( P1 . getX ( ) - P2 . getX ( ) ) , dy = Math . abs ( P1 . getY ( ) - P2 . getY ( ) ) ; double nx = P1 . getX ( ) + dx * rel , ny = P1 . getY ( ) + dy * rel ; if ( P1 . getX ( ) > P2 . getX ( ) ) nx = P1 . getX ( ) - dx * rel ; if ( P1 . getY ( ) > P2 . getY ( ) ) ny = P1 . getY ( ) - dy * rel ; MutableCoord result = new MutableCoord ( nx , ny ) ; return result ; }
calculates the point where p3 is proyected on the line formed by the points p1 and p2
