Class BezierCurve

java.lang.Object
yearreview.app.animation.BezierCurve

public class BezierCurve extends Object
A Bezier-Curve used for calculation of smooth animations.
Author:
ColdStone37
  • Field Details

    • controlPoints

      private final Vector2D[] controlPoints
      Array of Control-Points of the curve.
  • Constructor Details

    • BezierCurve

      public BezierCurve(Vector2D... controlPoints)
      Constructs a new BezierCurve from atleast two Control-Points.
      Parameters:
      controlPoints - Control-Points of the Bezier
    • BezierCurve

      public BezierCurve(List<Vector2D> controlPoints)
      Constructs a new BezierCurve from a list of Control-Points.
      Parameters:
      controlPoints - Control-Points of the Bezier
  • Method Details

    • samplePoint

      public Vector2D samplePoint(float val)
      Samples the Bezier at a certain point along the curve.
      Parameters:
      val - how far along the curve
      Returns:
      sampled position
    • getStart

      public Vector2D getStart()
      Gets the first Control-Point of the Bezier.
      Returns:
      first Control-Point
    • getEnd

      public Vector2D getEnd()
      Gets the last Control-Point of the Bezier.
      Returns:
      last Control-Point