public static Point2D intersectParam(Point2D u0,Point2D v0,Point2D u1,Point2D v1){
  double det=determinant2by2(v1,v0);
  if (Double.isNaN(det) || det == 0) {
    return null;
  }
  double x00=u0.getX();
  double y00=u0.getY();
  double x10=u1.getX();
  double y10=u1.getY();
  double x01=v0.getX();
  double y01=v0.getY();
  double x11=v1.getX();
  double y11=v1.getY();
  double s=(1 / det) * ((x00 - x10) * y01 - (y00 - y10) * x01);
  double t=(1 / det) * -(-(x00 - x10) * y11 + (y00 - y10) * x11);
  return new java.awt.geom.Point2D.Double(t,s);
}

public static Point2D intersectParam ( Point2D u0 , Point2D v0 , Point2D u1 , Point2D v1 ) { double det = determinant2by2 ( v1 , v0 ) ; if ( Double . isNaN ( det ) || det == 0 ) { return null ; } double x00 = u0 . getX ( ) ; double y00 = u0 . getY ( ) ; double x10 = u1 . getX ( ) ; double y10 = u1 . getY ( ) ; double x01 = v0 . getX ( ) ; double y01 = v0 . getY ( ) ; double x11 = v1 . getX ( ) ; double y11 = v1 . getY ( ) ; double s = ( 1 / det ) * ( ( x00 - x10 ) * y01 - ( y00 - y10 ) * x01 ) ; double t = ( 1 / det ) * - ( - ( x00 - x10 ) * y11 + ( y00 - y10 ) * x11 ) ; return new java . awt . geom . Point2D . Double ( t , s ) ; }
returns the intersection parameters for two line segments . unlike the line2d function which just checks for intersection between two line segments , this function provides more information by returning the intersection parameters . these parameters effectively determine how close to their start points the line segments intersect . if either parameter is not on [ 0 , 1 ] , the line segments do not intersect . if all that is needed is information on if the line segments intersect , then lin2d . linesintersect ( . . . ) is preferred . it is up to whoever calls this function to determine if an intersection actually occurs by checking the returned vector ( as a point2d ) of parameters .
