Package org.djutils.draw.curve
Class Bezier
java.lang.Object
org.djutils.draw.curve.Bezier
Common code used to generated Bézier curves.
Copyright (c) 2013-2025 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final double[]
C values of numerical approach of Legendre-Gauss to determine Bézier length.static final int
The default number of points to use to construct a Bézier curve.(package private) static final double[]
T values of numerical approach of Legendre-Gauss to determine Bézier length. -
Method Summary
Modifier and TypeMethodDescription(package private) static double
Bn
(double t, double... p) Calculate the Bézier point of degree n, with B(t) = Σ(i = 0..n) [C(n, i) * (1 - t)n-i ti Pi], where C(n, k) is the binomial coefficient defined by n!static double[]
derivative
(double[] in) Returns the derivative for one dimension of a Bézier, which is a Bézier of 1 order lower.
-
Field Details
-
T
static final double[] TT values of numerical approach of Legendre-Gauss to determine Bézier length. -
C
static final double[] CC values of numerical approach of Legendre-Gauss to determine Bézier length. -
DEFAULT_BEZIER_SIZE
public static final int DEFAULT_BEZIER_SIZEThe default number of points to use to construct a Bézier curve.- See Also:
-
-
Method Details
-
Bn
static double Bn(double t, double... p) Calculate the Bézier point of degree n, with B(t) = Σ(i = 0..n) [C(n, i) * (1 - t)n-i ti Pi], where C(n, k) is the binomial coefficient defined by n! / ( k! (n-k)! ), ! being the factorial operator.- Parameters:
t
- the fractionp
- the points of the curve, where the first and last are begin and end point, and all intermediate ones are control points- Returns:
- the Bézier value B(t) of degree n, where n is the number of points in the
p
array
-
derivative
public static double[] derivative(double[] in) Returns the derivative for one dimension of a Bézier, which is a Bézier of 1 order lower.- Parameters:
in
- coefficients of one dimension of a Bézier- Returns:
- coefficients of one dimension of the derivative Bézier
-