de.cau.cs.kieler.core.math
Class BezierSpline

java.lang.Object
  extended by de.cau.cs.kieler.core.math.BezierSpline

public class BezierSpline
extends Object

Represents a piecewise bezier spline. This means a collection of bezier curves adding up to a smooth spline.

Rating red

Nested Class Summary
 class BezierSpline.BezierCurve
          Represents a part of the whole spline consisting of start and end point, and two control points.
 
Constructor Summary
BezierSpline()
          Default Constructor.
 
Method Summary
 void addCurve(BezierSpline.BezierCurve curve)
          Add a new piece of bezierCurve to the whole spline.
 void addCurve(KVector startPnt, KVector fstCtrPnt, KVector sndCtrPnt, KVector endPnt)
          Adds a new curve to this piecewise bezier spline.
 void addSpline(BezierSpline spline, boolean beginning)
          add a whole piecewise spline to this spline.
 KVector[] getBasePoints()
          returns just the base points, including start and end point.
 LinkedList<BezierSpline.BezierCurve> getCurves()
          Returns piecewise curves.
 KVector getEndPoint()
          returns the last point of the last piece of the spline.
 KVector[] getInnerPoints()
          returns the inner points of this piecewise bezier spline.
 KVector[] getPolylineApprx(int accuracy)
          Returns a sequence of points, representing this spline as an approximated polyline.
 KVector getStartPoint()
          returns the first point of the first piece of the spline.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BezierSpline

public BezierSpline()
Default Constructor.

Method Detail

addCurve

public void addCurve(BezierSpline.BezierCurve curve)
Add a new piece of bezierCurve to the whole spline.

Parameters:
curve - BezierCurve to add

addSpline

public void addSpline(BezierSpline spline,
                      boolean beginning)
add a whole piecewise spline to this spline.

Parameters:
spline - spline being added
beginning - if true, the new spline is added at the beginning, otherwise at the end

addCurve

public void addCurve(KVector startPnt,
                     KVector fstCtrPnt,
                     KVector sndCtrPnt,
                     KVector endPnt)
Adds a new curve to this piecewise bezier spline. The curve is represented by the startPnt, endPnt and its control points.

Parameters:
startPnt - starting point
fstCtrPnt - first control point
sndCtrPnt - snd control point
endPnt - end point

getStartPoint

public KVector getStartPoint()
returns the first point of the first piece of the spline.

Returns:
starting point

getEndPoint

public KVector getEndPoint()
returns the last point of the last piece of the spline.

Returns:
end point

getInnerPoints

public KVector[] getInnerPoints()
returns the inner points of this piecewise bezier spline.

Returns:
all inner points

getBasePoints

public KVector[] getBasePoints()
returns just the base points, including start and end point. those are the points REALLY lying on the curve.

Returns:
base points

getPolylineApprx

public KVector[] getPolylineApprx(int accuracy)
Returns a sequence of points, representing this spline as an approximated polyline.

Parameters:
accuracy - number of points per curve
Returns:
approximated set of points

getCurves

public LinkedList<BezierSpline.BezierCurve> getCurves()
Returns piecewise curves.

Returns:
the curves

toString

public String toString()

Overrides:
toString in class Object