Package arc.math.geom
Class Bezier<T extends Vector<T>>
java.lang.Object
arc.math.geom.Bezier<T>
- All Implemented Interfaces:
Path<T>
Implementation of the Bezier curve.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfloat
approximate
(T v) float
approxLength
(int samples) static <T extends Vector<T>>
Tcubic
(T out, float t, T p0, T p1, T p2, T p3, T tmp) Cubic Bezier curvestatic <T extends Vector<T>>
TcubicDerivative
(T out, float t, T p0, T p1, T p2, T p3, T tmp) Cubic Bezier curve derivativederivativeAt
(T out, float t) static <T extends Vector<T>>
Tlinear
(T out, float t, T p0, T p1, T tmp) Simple Linear interpolationstatic <T extends Vector<T>>
TlinearDerivative
(T out, float t, T p0, T p1, T tmp) Simple Linear interpolation derivativefloat
static <T extends Vector<T>>
Tquadratic
(T out, float t, T p0, T p1, T p2, T tmp) Quadratic Bezier curvestatic <T extends Vector<T>>
TquadraticDerivative
(T out, float t, T p0, T p1, T p2, T tmp) Quadratic Bezier curve derivative
-
Field Details
-
points
-
-
Constructor Details
-
Bezier
public Bezier() -
Bezier
-
Bezier
-
Bezier
-
-
Method Details
-
linear
Simple Linear interpolation- Parameters:
out
- TheVector
to set to the result.t
- The location (ranging 0..1) on the line.p0
- The start point.p1
- The end point.tmp
- A temporary vector to be used by the calculation.- Returns:
- The value specified by out for chaining
-
linearDerivative
Simple Linear interpolation derivative- Parameters:
out
- TheVector
to set to the result.t
- The location (ranging 0..1) on the line.p0
- The start point.p1
- The end point.tmp
- A temporary vector to be used by the calculation.- Returns:
- The value specified by out for chaining
-
quadratic
Quadratic Bezier curve- Parameters:
out
- TheVector
to set to the result.t
- The location (ranging 0..1) on the curve.p0
- The first bezier point.p1
- The second bezier point.p2
- The third bezier point.tmp
- A temporary vector to be used by the calculation.- Returns:
- The value specified by out for chaining
-
quadraticDerivative
Quadratic Bezier curve derivative- Parameters:
out
- TheVector
to set to the result.t
- The location (ranging 0..1) on the curve.p0
- The first bezier point.p1
- The second bezier point.p2
- The third bezier point.tmp
- A temporary vector to be used by the calculation.- Returns:
- The value specified by out for chaining
-
cubic
Cubic Bezier curve- Parameters:
out
- TheVector
to set to the result.t
- The location (ranging 0..1) on the curve.p0
- The first bezier point.p1
- The second bezier point.p2
- The third bezier point.p3
- The fourth bezier point.tmp
- A temporary vector to be used by the calculation.- Returns:
- The value specified by out for chaining
-
cubicDerivative
public static <T extends Vector<T>> T cubicDerivative(T out, float t, T p0, T p1, T p2, T p3, T tmp) Cubic Bezier curve derivative- Parameters:
out
- TheVector
to set to the result.t
- The location (ranging 0..1) on the curve.p0
- The first bezier point.p1
- The second bezier point.p2
- The third bezier point.p3
- The fourth bezier point.tmp
- A temporary vector to be used by the calculation.- Returns:
- The value specified by out for chaining
-
set
-
set
-
set
-
set
-
set
-
valueAt
-
derivativeAt
- Specified by:
derivativeAt
in interfacePath<T extends Vector<T>>
-
approximate
- Specified by:
approximate
in interfacePath<T extends Vector<T>>
- Returns:
- The approximated value (between 0 and 1) on the path which is closest to the specified value. Note that the
implementation of this method might be optimized for speed against precision, see
Path.locate(Object)
for a more precise (but more intensive) method.
-
locate
-
approxLength
public float approxLength(int samples) - Specified by:
approxLength
in interfacePath<T extends Vector<T>>
- Parameters:
samples
- The amount of divisions used to approximate length. Higher values will produce more precise results, but will be more CPU intensive.- Returns:
- An approximated length of the spline through sampling the curve and accumulating the euclidean distances between the sample points.
-