src/main/java/de/javagl/geom/Intersections.java
/**
         * Computes the intersection of the specified line segments.
         * 
         * @param s0x0 x-coordinate of point 0 of line segment 0
         * @param s0y0 y-coordinate of point 0 of line segment 0
         * @param s0x1 x-coordinate of point 1 of line segment 0
         * @param s0y1 y-coordinate of point 1 of line segment 0
         * @param s1x0 x-coordinate of point 0 of line segment 1
         * @param s1y0 y-coordinate of point 0 of line segment 1
         * @param s1x1 x-coordinate of point 1 of line segment 1
         * @param s1y1 y-coordinate of point 1 of line segment 1
         * @param relativeLocation Optional location that stores the 
         * relative location of the intersection point on 
         * the given line segments
         * @param absoluteLocation Optional location that stores the 
         * absolute location of the intersection point
         * @return Whether the line segments intersect. That is,
         * when they are not parallel, and the relative location 
         * is in [0,1] for both lines.
         */
Computes the intersection of the specified line segments.


Computes the intersection of the specified line segments .
public static boolean intersect( 
            double s0x0, double s0y0,
            double s0x1, double s0y1,
            double s1x0, double s1y0,
            double s1x1, double s1y1,
            Point2D relativeLocation,
            Point2D absoluteLocation)
        {
            if (relativeLocation == null)
            {
                relativeLocation = new Point2D.Double();
            }
            boolean intersect = LineLine.intersect(
                s0x0, s0y0, s0x1, s0y1, s1x0, s1y0, s1x1, s1y1, 
                relativeLocation, absoluteLocation);
            if (intersect)
            {
                if (relativeLocation.getX() >= 0.0 && 
                    relativeLocation.getX() <= 1.0 && 
                    relativeLocation.getY() >= 0.0 && 
                    relativeLocation.getY() <= 1.0)
                {
                    return true;
                }
            }
            return false;
        }
public static boolean intersect ( double s0x0 , double s0y0 , double s0x1 , double s0y1 , double s1x0 , double s1y0 , double s1x1 , double s1y1 , Point2D relativeLocation , Point2D absoluteLocation ) { if ( relativeLocation == null ) { relativeLocation = new Point2D . Double ( ) ; } boolean intersect = LineLine . intersect ( s0x0 , s0y0 , s0x1 , s0y1 , s1x0 , s1y0 , s1x1 , s1y1 , relativeLocation , absoluteLocation ) ; if ( intersect ) { if ( relativeLocation . getX ( ) >= 0.0 && relativeLocation . getX ( ) <= 1.0 && relativeLocation . getY ( ) >= 0.0 && relativeLocation . getY ( ) <= 1.0 ) { return true ; } } return false ; }
Computes the intersection of the specified line segments.
Computes the intersection of the specified line segments .