Package toxi.geom

Class BezierCurve2D

java.lang.Object
toxi.geom.BezierCurve2D

public class BezierCurve2D extends Object
Standard multi-segment bezier curve implementation with optional automatic handle alignment between segments. Can be used to create closed curves which can then be converted into Polygon2D instances. Also provides curve tangent calculation feature. Usage of this class is very similar to Spline2D.
  • Constructor Details

    • BezierCurve2D

      public BezierCurve2D()
    • BezierCurve2D

      public BezierCurve2D(List<Vec2D> points)
  • Method Details

    • computePointInSegment

      public static Vec2D computePointInSegment(Vec2D a, Vec2D b, Vec2D c, Vec2D d, float t)
    • computeTangentInSegment

      public static Vec2D computeTangentInSegment(Vec2D a, Vec2D b, Vec2D c, Vec2D d, float t)
    • add

      public BezierCurve2D add(Vec2D p)
    • alignAllHandles

      public void alignAllHandles()
    • alignHandlesForPoint

      public void alignHandlesForPoint(int id)
    • isClosed

      public boolean isClosed()
      Returns:
      true, if the curve is closed. I.e. the first and last control point coincide.
    • toLineStrip2D

      public LineStrip2D toLineStrip2D(int res)
      Computes a list of intermediate curve points for all segments. For each curve segment the given number of points will be produced.
      Parameters:
      res - number of points per segment
      Returns:
      list of Vec2Ds
    • toPolygon2D

      public Polygon2D toPolygon2D(int res)