Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cubic B-spline curve in Java

Tags:

java

graphics

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.

like image 311
Artur Avatar asked Dec 08 '10 12:12

Artur


People also ask

What is cubic B-spline curve?

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.

What is the equation of B-spline curve?

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.

What are properties of B-spline curve?

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.

Why B-spline curve is better 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.


1 Answers

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.

like image 99
fakeaccount1 Avatar answered Oct 05 '22 23:10

fakeaccount1