Documentation of 'math.geom2d.curve.PolyCurve2D' Java class
PolyCurve2D
math.geom2d.curve

Class PolyCurve2D<T extends ContinuousCurve2D>

    • Constructor Detail

      • PolyCurve2D

        public PolyCurve2D()
        Empty constructor.
      • PolyCurve2D

        public PolyCurve2D(int n)
        Constructor that reserves space for the specified number of inner curves.
      • PolyCurve2D

        public PolyCurve2D(T... curves)
        Creates a new PolyCurve2D from the specified list of curves.
        Parameters:
        curves - the curves that constitutes this PolyCurve2D
      • PolyCurve2D

        public PolyCurve2D(T[] curves,
                           boolean closed)
        Creates a new closed PolyCurve2D from the specified list of curves.
        Parameters:
        curves - the curves that constitutes this PolyCurve2D
      • PolyCurve2D

        public PolyCurve2D(java.util.Collection<? extends T> curves)
        Creates a new PolyCurve2D from the specified collection of curves.
        Parameters:
        curves - the curves that constitutes this PolyCurve2D
      • PolyCurve2D

        public PolyCurve2D(java.util.Collection<? extends T> curves,
                           boolean closed)
        Creates a new PolyCurve2D from the specified collection of curves.
        Parameters:
        curves - the curves that constitutes this PolyCurve2D
      • PolyCurve2D

        public PolyCurve2D(PolyCurve2D<? extends T> polyCurve)
    • Method Detail

      • create

        public static <T extends ContinuousCurve2DPolyCurve2D<T> create(T... curves)
        Static factory for creating a new PolyCurve2D from an array of curves.
        Since:
        0.8.1
      • createClosed

        public static <T extends ContinuousCurve2DPolyCurve2D<T> createClosed(T... curves)
        Static factory for creating a new closed PolyCurve2D from an array of curves.
        Since:
        0.10.0
      • create

        public static <T extends ContinuousCurve2DPolyCurve2D<T> create(java.util.Collection<T> curves,
                                                                          boolean closed)
        Static factory for creating a new PolyCurve2D from a collection of curves and a flag indicating if the curve is closed or not.
        Since:
        0.9.0
      • create

        public static <T extends ContinuousCurve2DPolyCurve2D<T> create(T[] curves,
                                                                          boolean closed)
        Static factory for creating a new PolyCurve2D from an array of curves and a flag indicating if the curve is closed or not.
        Since:
        0.9.0
      • setClosed

        public void setClosed(boolean b)
        Toggle the 'closed' flag of this polycurve.
      • leftTangent

        public Vector2D leftTangent(double t)
        Description copied from interface: ContinuousCurve2D
        Computes the left tangent at the given position. If the curve is smooth at position t, the result is the same as the tangent computed for the corresponding smooth curve, and is equal to the result of rightTangent(double). If the position t corresponds to a singular point, the tangent of the smooth portion before t is computed.
        Specified by:
        leftTangent in interface ContinuousCurve2D
        Parameters:
        t - the position on the curve
        Returns:
        the left tangent vector at the curve for position t
      • rightTangent

        public Vector2D rightTangent(double t)
        Description copied from interface: ContinuousCurve2D
        Computes the right tangent at the given position. If the curve is smooth at position t, the result is the same as the tangent computed for the corresponding smooth curve, and is equal to the result of leftTangent(double). If the position t corresponds to a singular point, the tangent of the smooth portion after t is computed.
        Specified by:
        rightTangent in interface ContinuousCurve2D
        Parameters:
        t - the position on the curve
        Returns:
        the right tangent vector at the curve for position t
      • curvature

        public double curvature(double t)
        Description copied from interface: ContinuousCurve2D
        Computes the curvature at the given position. The curvature is finite for positions t that correspond to smooth parts, and is infinite for singular points.
        Specified by:
        curvature in interface ContinuousCurve2D
        Parameters:
        t - the position on the curve
        Returns:
        the curvature of the curve for position t
      • isClosed

        public boolean isClosed()
        Returns true if the PolyCurve2D is closed.
        Specified by:
        isClosed in interface ContinuousCurve2D
      • asPolyline

        public Polyline2D asPolyline(int n)
        Converts this PolyCurve2D into a polyline with the given number of edges.
        Specified by:
        asPolyline in interface ContinuousCurve2D
        Parameters:
        n - the number of edges of the result polyline
        Returns:
        a polyline with n line segments.
        See Also:
        Polyline2D
      • smoothPieces

        public java.util.Collection<? extends SmoothCurve2D> smoothPieces()
        Returns a collection containing only instances of SmoothCurve2D.
        Specified by:
        smoothPieces in interface ContinuousCurve2D
        Returns:
        a collection of SmoothCurve2D
      • subCurve

        public PolyCurve2D<? extends ContinuousCurve2D> subCurve(double t0,
                                                                 double t1)
        Returns an instance of PolyCurve2D. If t0>t1 and curve is not closed, return a PolyCurve2D without curves inside.
        Specified by:
        subCurve in interface ContinuousCurve2D
        Specified by:
        subCurve in interface Curve2D
        Overrides:
        subCurve in class CurveArray2D<T extends ContinuousCurve2D>
        Parameters:
        t0 - position of the start of the sub-curve
        t1 - position of the end of the sub-curve
        Returns:
        the portion of original curve comprised between t0 and t1.
      • clip

        public CurveSet2D<? extends ContinuousCurve2D> clip(Box2D box)
        Clip the PolyCurve2D by a box. The result is an instance of CurveSet2D, which contains only instances of ContinuousCurve2D. If the PolyCurve2D is not clipped, the result is an instance of CurveSet2D which contains 0 curves.
        Specified by:
        clip in interface ContinuousCurve2D
        Specified by:
        clip in interface Curve2D
        Specified by:
        clip in interface Shape2D
        Overrides:
        clip in class CurveArray2D<T extends ContinuousCurve2D>
        Parameters:
        box - the clipping box
        Returns:
        the clipped shape
      • appendPath

        public java.awt.geom.GeneralPath appendPath(java.awt.geom.GeneralPath path)
        Description copied from interface: ContinuousCurve2D
        Append the path of the curve to the given path.
        Specified by:
        appendPath in interface ContinuousCurve2D
        Parameters:
        path - a path to modify
        Returns:
        the modified path
      • draw

        public void draw(java.awt.Graphics2D g2)
        Description copied from interface: Curve2D
        Draws the curve on the given Graphics2D object.
        Specified by:
        draw in interface Curve2D
        Specified by:
        draw in interface Shape2D
        Overrides:
        draw in class CurveArray2D<T extends ContinuousCurve2D>
        Parameters:
        g2 - the graphics to draw the curve in
      • equals

        public boolean equals(java.lang.Object obj)
        Description copied from class: CurveArray2D
        Returns true if obj is a CurveArray2D with the same number of curves, and such that each curve belongs to both objects.
        Overrides:
        equals in class CurveArray2D<T extends ContinuousCurve2D>

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.