I need to use a cubic B-spline curve but cannot find code for it anywhere. The only curves available in Java API are QuadCurve2D
, Path2D
and CubicCurve2D
. I think they all are Bezier, but I'm not sure about it.
If you know where can I find code for cubic B-spline preferably that extends Java Shape
class and supports contains(Point p)
for onMouseOver
please help.
Uniform cubic B-spline curves are based on the assumption that a nice curve corresponds to using cubic functions for each segment and constraining the points that joint the segments to meet three continuity requirements: 1.
More precisely, if we want to define a B-spline curve of degree p with n + 1 control points, we have to supply n + p + 2 knots u0, u1, ..., un+p+1. On the other hand, if a knot vector of m + 1 knots and n + 1 control points are given, the degree of the B-spline curve is p = m - n - 1.
Properties of B-spline Curve :Each basis function has 0 or +ve value for all parameters. Each basis function has one maximum value except for k=1. The degree of B-spline curve polynomial does not depend on the number of control points which makes it more reliable to use than Bezier curve.
Firstly, a B-Spline curve can be a Bezier curve whenever the programmer so desires. Further B-Spline curve offers more control and flexibility than Bezier curve. It is possible to use lower degree curves and still maintain a large number of control points.
CubicCurve2D is a cubic B-spline.
However, this may or may not be what you need as there are other cubic B-splines.
That is, all CubicCurve2Ds are cubic B-splines. Not all cubic B-splines are CubicCurve2Ds.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With