Class BezierCurve


public class BezierCurve extends ParametricCurve

General n-point Bezier curve implementation. The Bezier curve defines itself using all the points from the control-path specified by the group-iterator. To compute a single point on the curve requires O(n) multiplications where n is the group-size of the group-iterator. Thus, the Bezier curve is considered to be expensive, but it has several mathematical properties (not discussed here) that make it appealing. Figure 1 shows an example of a Bezier curve.

The maximum number of points that the Bezier curve can use is 1030 because the evaluation of a point uses the nCr (n-choose-r) function. The computation uses double precision, and double precision cannot represent the result of 1031 choose i, where i = [500, 530].

See Also:
  • Constructor Details

  • Method Details

    • eval

      public void eval(double[] p)
      Description copied from class: ParametricCurve
      The eval method evaluates a point on a curve given a parametric value "t". The parametric value "t" is stored in the last index location of the specified double array. This value should not be changed. The dimension of the point to evaluate is p.length - 1. The result of the evaluation is placed in index locations 0 .. p.length - 2 (inclusive). The eval method should remain protected except for those curves that do no need any preparation to be done in the appendTo method.
      Specified by:
      eval in class ParametricCurve
    • getSampleLimit

      public int getSampleLimit()
      Description copied from class: ParametricCurve
      The sample limit specifies how many additional subdivisions are done to ensure that there are no missed pieces of the curve. The sample limit must be >= 0.
      Specified by:
      getSampleLimit in class ParametricCurve
    • setSampleLimit

      public void setSampleLimit(int limit)
      Sets the sample-limit. For more information on the sample-limit, see the BinaryCurveApproximationAlgorithm class. The default sample-limit is 1.
      Throws:
      IllegalArgumentException - If sample-limit < 0.
      See Also:
    • setInterval

      public void setInterval(double t_min, double t_max)
      Specifies the interval that the curve should define itself on. The default interval is [0.0, 1.0].
      Throws:
      IllegalArgumentException - If t_min > t_max.
      See Also:
    • t_min

      public double t_min()
      Returns the starting interval value.
      See Also:
    • t_max

      public double t_max()
      Returns the finishing interval value.
      See Also:
    • appendTo

      public void appendTo(MultiPath mp)
      The only requirement for this curve is the group-iterator must be in range or this method returns quietly.
      Specified by:
      appendTo in class Curve
      See Also:
    • resetMemory

      public void resetMemory()
      Description copied from class: Curve
      Resets the shared memory to the initial state.
      Overrides:
      resetMemory in class Curve