java.lang.Object
org.jhotdraw8.geom.CardinalSplines
Provides conversion functions from cardinal splines (c-splines) to
bezier curves.
-
Method Summary
Modifier and TypeMethodDescriptionstatic javafx.geometry.Point2D[]cardinalSplineToBezier(double[] p, double c) static javafx.geometry.Point2D[]cardinalSplineToBezier(List<Double> p, double c) static javafx.geometry.Point2D[]cardinalSplineToBezier(javafx.geometry.Point2D[] p, double c) Converts a cardinal spline into a bezier curve.
-
Method Details
-
cardinalSplineToBezier
public static javafx.geometry.Point2D[] cardinalSplineToBezier(javafx.geometry.Point2D[] p, double c) Converts a cardinal spline into a bezier curve.Cardinal spline from B to E with control points A, B, E, F and tension parameter c:
B F / \ / / \ / A EThe tangent vectors of the cardinal spline are:- Tb = c * (E - A)
- Te = c * (F - B)
Cubic bezier curve from B to E with control points B, C, D, E.
B----C F / \ / / \ / A D----EThe tangent vectors of the cubic bezier curve are:- Tb = 3 * (C - B)
- Te = 3 * (E - D)
- C = B + (E - A) * c / 3
- D = E - (F - B) * c/ 3
- Stackoverflow. Converting a Cubic Bezier Curves into a Cardinal Spline and back. Copyright MBo. CC BY-SA 4.0 license.
- stackoverflow.com
- Parameters:
p- the points of the cardinal splinec- the tension of the cardinal spline- Returns:
- the cubic bezier curves (first point is
moveTo, subsequent triples of points arecurveTos.
-
cardinalSplineToBezier
public static javafx.geometry.Point2D[] cardinalSplineToBezier(double[] p, double c) -
cardinalSplineToBezier
-