java.lang.Object
org.jhotdraw8.geom.CubicCurveCharacteristics
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic double[]align(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3) Rotates and translates the provided bezier curve so that 3 coordinates are approximately zero: x0, y0 and y3.static @Nullable Point2D.DoublecanonicalForm(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3) Transforms the given cubic curve into canonical form.characteristics(double[] b, int o) characteristics(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3) static DoubleArrayListextremePoints(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3) Computes the extreme points of the given cubic curve.static DoubleArrayListComputes the extreme points of the given cubic curve.static DoubleArrayListinflectionPoints(double[] b, int o) static DoubleArrayListinflectionPoints(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3) Computes the inflection points of the given cubic curve.static DoubleArrayListComputes the inflection points of the given cubic curve.static @Nullable DoublesingularPoint(double[] b, int o) static @Nullable DoublesingularPoint(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3)
-
Method Details
-
characteristics
-
characteristics
public static CubicCurveCharacteristics.Characteristics characteristics(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3) -
canonicalForm
public static @Nullable Point2D.Double canonicalForm(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3) Transforms the given cubic curve into canonical form.Where:
B0: x0 = 0, y0 = 0 B1: x1 = 0, y1 = 1 B2: x2 = 1, y2 = 1 B3: x3 = ..., y3 = ...
References:- Calculating the Extremal Points of a Cubic Bezier Curve
- pomax.github.io
- Pomax. A Primer on Bézier Curves. The canonical form (for cubic curves).
- pomax.github.io
- Returns:
- returns the coordinates of x3,y3 or null if the mapping failed
-
align
public static double[] align(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3) Rotates and translates the provided bezier curve so that 3 coordinates are approximately zero: x0, y0 and y3. -
inflectionPoints
Computes the inflection points of the given cubic curve. -
inflectionPoints
-
singularPoint
-
inflectionPoints
public static DoubleArrayList inflectionPoints(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3) Computes the inflection points of the given cubic curve.If the curve has two inflection points:
- The point in the middle of the two inflection points
(t₀+t₁)/2has maximal curvature. This point is called a 'singular point' by Zhiyi Zhang et al. - If the inflection points are the same
almostEqual(t₀,t₁)value, we have a cusp.
References:
- Stackoverflow, Calculating the Inflection Point of a Cubic Bezier Curve, Copyright MBo, CC BY-SA 4.0 license
- stackoverflow.com
- Zhiyi Zhang, Min Chen , Xian Zhang, Zepeng Wang. Analysis of Inflection Points for Planar Cubic Bé́zier Curve
- cie.nwsuaf.edu.cn
- The point in the middle of the two inflection points
-
singularPoint
public static @Nullable Double singularPoint(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3) -
extremePoints
Computes the extreme points of the given cubic curve. -
extremePoints
public static DoubleArrayList extremePoints(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3) Computes the extreme points of the given cubic curve.References:
- Extremes for Bézier curves
- github.polettix.it
-