version 3.3

VRS::BSpline Class Reference

#include <vrs/bspline.h>

Inheritance diagram for VRS::BSpline:

VRS::Curve VRS::Shape VRS::RenderObj VRS::SharedObj VRS::Visitable

List of all members.

Public Member Functions

 BSpline (int curveDegree=1, bool openCurve=true, Array< Vector > *controlPoints=0, Array< int > *knotArray=0)
 Constructs a BSpline with the given values.
void setControlPoint (int i, const Vector &p)
 Sets the control point at the position i to the given point.
Vector getControlPoint (int i) const
 Returns the control point at the position i.
int controlPoints () const
 Returns the number of control points.
Iterator< Vector > * newControlPointIterator () const
 Returns the control points.
void setKnot (int i, int value)
 Sets the knot at the positions i to the given value.
int getKnot (int i) const
 Returns the knot at the positions i.
int knots () const
 Returns the number of knots.
Iterator< int > * newKnotIterator () const
 Returns the knots.
void insertKnots (int noNewKnots, int knotValue)
 Inserts noNewKnots knots of value knotValue into the knot vector.
bool knotsConsistent () const
 Checks the knot values for consistency.
void setOpenCurve ()
 Sets the type to open.
void setClosedCurve ()
 Sets the type to closed.
bool isOpen () const
 Returns if the type is open.
void setCachingOn (int tessellation)
 Enables caching of the tessellation of the curve.
void setCachingOff ()
 Disabled caching, see setCachingOn.
bool isCached () const
 Returns if the caching is enabled.
void reconfigure (int newDegree, int newNoOfPoints)
virtual Vector curvePoint (double u) const
 Returns the curve point specified by u.
virtual Vector derivative (int n, double u) const
 Returns the n's derivative at the point specified by u, see curvePoint.
virtual Bounds boundingBox () const
 Returns the bounding-box.
virtual void modified ()
 Returns the length of the curve.
 VRS_TYPEINFO (BSpline, Curve)
 VRS_SERIALIZABLE (BSpline)


Detailed Description

B-Spline Curve. A B-Spline is defined by the degree, its type (open or closed), its control points and (numberOfControlPoints+degree+2) knots.

If a b-spline is open, the constraint for its knots is: k[0] = ... = k[noCtrlPts], k[noCtrlPts+1] = k[noCtrlPts+degree+1]

The constraint for closed b-spline curves is: k[i+noCtrlPts+2] = k[i+noCtrlPts+1] + k[i] - k[i-1], 0<i<=degree


Constructor & Destructor Documentation

VRS::BSpline::BSpline ( int  curveDegree = 1,
bool  openCurve = true,
Array< Vector > *  controlPoints = 0,
Array< int > *  knotArray = 0 
)

Constructs a BSpline with the given values.


Member Function Documentation

void VRS::BSpline::setControlPoint ( int  i,
const Vector p 
)

Sets the control point at the position i to the given point.

Vector VRS::BSpline::getControlPoint ( int  i  )  const

Returns the control point at the position i.

int VRS::BSpline::controlPoints (  )  const

Returns the number of control points.

Iterator<Vector>* VRS::BSpline::newControlPointIterator (  )  const

Returns the control points.

void VRS::BSpline::setKnot ( int  i,
int  value 
)

Sets the knot at the positions i to the given value.

int VRS::BSpline::getKnot ( int  i  )  const

Returns the knot at the positions i.

int VRS::BSpline::knots (  )  const

Returns the number of knots.

Iterator< int >* VRS::BSpline::newKnotIterator (  )  const

Returns the knots.

void VRS::BSpline::insertKnots ( int  noNewKnots,
int  knotValue 
)

Inserts noNewKnots knots of value knotValue into the knot vector.

bool VRS::BSpline::knotsConsistent (  )  const

Checks the knot values for consistency.

Knot values are consistent if (N : no of points - 1):

  • N+degree+1==knots Additional conditions for open B-splines:
  • knot[0], knot[1], ..., knot[degree] are identical
  • knot[N+1], ..., knot[N+degree+1] are identical Additional conditions for closed B-splines:
  • i in [1, degree]: knot[N+i+1]==knot[N+i]+knot[i]-knot[i-1]

void VRS::BSpline::setOpenCurve (  ) 

Sets the type to open.

void VRS::BSpline::setClosedCurve (  ) 

Sets the type to closed.

bool VRS::BSpline::isOpen (  )  const

Returns if the type is open.

void VRS::BSpline::setCachingOn ( int  tessellation  ) 

Enables caching of the tessellation of the curve.

If caching is set to on, the values of the B-spline are precomputed for 'tessellation' many points. If an intermediate value is needed, it's calculated by linear interpolation between two precomputed curve points.

void VRS::BSpline::setCachingOff (  ) 

Disabled caching, see setCachingOn.

bool VRS::BSpline::isCached (  )  const

Returns if the caching is enabled.

void VRS::BSpline::reconfigure ( int  newDegree,
int  newNoOfPoints 
)

Increases/decreases the number of control points and knots. If a number is increased, no new points are generated, only free space is allocates. If a number is decreased, knots or points will be cut off.

virtual Vector VRS::BSpline::curvePoint ( double  u  )  const [virtual]

Returns the curve point specified by u.

u is the parametric value between 0 and 1. The calculation is based on the current set of control points.

Implements VRS::Curve.

virtual Vector VRS::BSpline::derivative ( int  n,
double  u 
) const [virtual]

Returns the n's derivative at the point specified by u, see curvePoint.

Implements VRS::Curve.

virtual Bounds VRS::BSpline::boundingBox (  )  const [virtual]

Returns the bounding-box.

Implements VRS::Shape.

virtual void VRS::BSpline::modified (  )  [virtual]

Returns the length of the curve.

Overwritten to set the updateLengthMapping_ flag

Reimplemented from VRS::Curve.

VRS::BSpline::VRS_TYPEINFO ( BSpline  ,
Curve   
)

VRS::BSpline::VRS_SERIALIZABLE ( BSpline   ) 


The documentation for this class was generated from the following file:

Generated on Sun May 19 06:00:32 2013 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact