Interface ICurve

  • All Superinterfaces:
    java.lang.Cloneable, IGeometry, java.io.Serializable
    All Known Implementing Classes:
    Arc, BezierCurve, CubicCurve, Line, PolyBezier, Polyline, QuadraticCurve

    public interface ICurve
    extends IGeometry
    The ICurve interface provides operations that allow the analysis of linear geometric objects and the transfer to BezierCurve segments ( toBezier()). The start and end Point of an ICurve can be retrieved using its getP1() and getP2() methods. Furthermore, you can search for Points of intersection using the getIntersections(ICurve) method. If you do only need to know if there are any intersections, and you are not interested in their exact locations, then you can use the intersects(ICurve) method, instead. To test for an overlap, i.e. an identical segment of two ICurves, use the overlaps(ICurve) method. One may think that an overlap is a very rare case. But in practical application, objects are usually aligned to a grid, which extremely increases the probability of an overlap.
    • Method Detail

      • getIntersections

        Point[] getIntersections​(ICurve c)
        Returns the points of intersection between this ICurve and the given ICurve.
        Parameters:
        c - The ICurve to compute intersection points with.
        Returns:
        The points of intersection.
      • getOverlaps

        ICurve[] getOverlaps​(ICurve c)
        Returns the curve segments at which this ICurve and the given ICurve overlap.
        Parameters:
        c - The curve to compute overlaps with.
        Returns:
        The segments where both curves overlap.
      • getP1

        Point getP1()
        Returns a Point representing the start point of this ICurve.
        Returns:
        a new Point with the coordinates of the ICurve's start point.
      • getP2

        Point getP2()
        Returns a Point representing the end point of this ICurve .
        Returns:
        a new Point with the coordinates of the ICurve's end point.
      • getProjection

        Point getProjection​(Point reference)
        Returns a projection of the given reference Point onto this ICurve, i.e. a Point on this ICurve that is closest to the given reference Point. Note, that
        Parameters:
        reference - The reference Point for which to return the projection.
        Returns:
        The projection of the given reference Point onto this ICurve.
      • getX1

        double getX1()
        Returns the start Point's x coordinate.
        Returns:
        the start Point's x coordinate
      • getX2

        double getX2()
        Returns the end Point's x coordinate.
        Returns:
        the end Point's x coordinate
      • getY1

        double getY1()
        Returns the start Point's y coordinate.
        Returns:
        the start Point's y coordinate
      • getY2

        double getY2()
        Returns the end Point's y coordinate.
        Returns:
        the end Point's y coordinate
      • intersects

        boolean intersects​(ICurve c)
        Tests if this ICurve and the given ICurve intersect, i.e. whether a final set of intersection points exists. Two curves intersect if they touch (see IGeometry.touches(IGeometry)) but do not overlap (see overlaps(ICurve)).
        Parameters:
        c - The ICurve to test for intersections.
        Returns:
        true if they intersect, false otherwise
      • overlaps

        boolean overlaps​(ICurve c)
        Tests if this ICurve and the given ICurve overlap, i.e. whether an infinite set of intersection points exists. Two curves overlap if they touch (see IGeometry.touches(IGeometry)) but not intersect (see intersects(ICurve)).
        Parameters:
        c - The ICurve to test for overlap.
        Returns:
        true if they overlap, false otherwise