Class CubicBezierCurve


  • public class CubicBezierCurve
    extends java.lang.Object
    Creates a curved geometry by replacing the segments of the input with Cubic Bezier Curves. The Bezier control points are determined from the segments of the geometry and the alpha control parameter controlling curvedness, and the optional skew parameter controlling the shape of the curve at vertices. The Bezier Curves are created to be C2-continuous (smooth) at each input vertex.

    Alternatively, the Bezier control points can be supplied explicitly.

    The result is not guaranteed to be valid, since large alpha values may cause self-intersections.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Geometry bezierCurve​(Geometry geom, double alpha)
      Creates a geometry of linearized Cubic Bezier Curves defined by the segments of the input and a parameter controlling how curved the result should be.
      static Geometry bezierCurve​(Geometry geom, double alpha, double skew)
      Creates a geometry of linearized Cubic Bezier Curves defined by the segments of the input and a parameter controlling how curved the result should be, with a skew factor affecting the curve shape at each vertex.
      static Geometry bezierCurve​(Geometry geom, Geometry controlPoints)
      Creates a geometry of linearized Cubic Bezier Curves defined by the segments of the input and a list (or lists) of control points.
      Geometry getResult()
      Gets the computed linearized Bezier curve geometry.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • bezierCurve

        public static Geometry bezierCurve​(Geometry geom,
                                           double alpha)
        Creates a geometry of linearized Cubic Bezier Curves defined by the segments of the input and a parameter controlling how curved the result should be.
        Parameters:
        geom - the geometry defining the curve
        alpha - curvedness parameter (0 is linear, 1 is round, >1 is increasingly curved)
        Returns:
        the linearized curved geometry
      • bezierCurve

        public static Geometry bezierCurve​(Geometry geom,
                                           double alpha,
                                           double skew)
        Creates a geometry of linearized Cubic Bezier Curves defined by the segments of the input and a parameter controlling how curved the result should be, with a skew factor affecting the curve shape at each vertex.
        Parameters:
        geom - the geometry defining the curve
        alpha - curvedness parameter (0 is linear, 1 is round, >1 is increasingly curved)
        skew - the skew parameter (0 is none, positive skews towards longer side, negative towards shorter
        Returns:
        the linearized curved geometry
      • bezierCurve

        public static Geometry bezierCurve​(Geometry geom,
                                           Geometry controlPoints)
        Creates a geometry of linearized Cubic Bezier Curves defined by the segments of the input and a list (or lists) of control points.

        Typically the control point geometry is a LineString or MultiLineString containing an element for each line or ring in the input geometry. The list of control points for each linear element must contain two vertices for each segment (and thus 2 * npts - 2).

        Parameters:
        geom - the geometry defining the curve
        controlPoints - a geometry containing the control point elements.
        Returns:
        the linearized curved geometry
      • getResult

        public Geometry getResult()
        Gets the computed linearized Bezier curve geometry.
        Returns:
        a linearized curved geometry