Atoms Crowd  4.1.0
AtomsUtils::Curve Class Reference

Nurbs curve. More...

#include <Curve.h>

Inheritance diagram for AtomsUtils::Curve:
AtomsUtils::SampledCurve

Public Member Functions

 Curve ()
 Constructor.
 
 Curve (const std::vector< AtomsMath::Vector3f > cvs, unsigned int degree)
 Constructor. More...
 
virtual ~Curve ()
 Destructor.
 
int findSpan (float u) const
 Find span. More...
 
int findKnot (float u) const
 Find span. More...
 
int findMult (int r) const
 Find multiplicity. More...
 
void computeUniformKnots ()
 Compute uniform knots. More...
 
std::vector< float > basis (int knotSpan, float u) const
 Basis function for B-Spline. More...
 
std::vector< std::vector< float > > dersBasis (int knotSpan, float u, unsigned int degree) const
 Basis function for B-Spline. More...
 
AtomsMath::Vector3f pointOnCurve (float param) const
 Get a point on the curve. More...
 
AtomsMath::Vector3f tangentOnCurve (float param) const
 Get a tangent on the curve. More...
 
std::vector< AtomsMath::Vector3f > curveDerivs (float param, unsigned int nderiv) const
 Return the curve derivative. More...
 
std::vector< AtomsMath::Vector3f > parallelFrameNormals (unsigned int samples, AtomsMath::Vector3f upVec) const
 Get curve normals using parallel frame. More...
 
AtomsMath::Matrixf parallelFrameAtPoint (unsigned int samples, AtomsMath::Vector3f upVec, float param) const
 Get curve normal on a point using parallel frame. More...
 
virtual std::pair< float, AtomsMath::Vector3f > closestPoint (const AtomsMath::Vector3f &point, unsigned int maxStep=6, unsigned int maxIterations=10, float tollarence=0.0001f)
 Get closest point. More...
 
virtual std::pair< float, AtomsMath::Vector3f > closestTangent (const AtomsMath::Vector3f &point, unsigned int maxStep=6, unsigned int maxIterations=10, float tollarence=0.0001f)
 Get closest tangent. More...
 
float maxU () const
 Max U value.
 
std::vector< AtomsMath::Vector3f > & cvs ()
 Get curve cvs.
 
const std::vector< AtomsMath::Vector3f > & cvs () const
 Ge curve cvs.
 
std::vector< float > & knots ()
 Get curve knots.
 
const std::vector< float > & knots () const
 Get curve knots.
 
unsigned int degree () const
 Get curve degree.
 
void setDegree (unsigned int degree)
 Set curve degree.
 
const Curveoperator= (const Curve &curve)
 Assign operator.
 

Detailed Description

Nurbs curve.

Constructor & Destructor Documentation

◆ Curve()

AtomsUtils::Curve::Curve ( const std::vector< AtomsMath::Vector3f >  cvs,
unsigned int  degree 
)

Constructor.

Parameters
cvsControl vertices
degreeCurve degree

Member Function Documentation

◆ basis()

std::vector<float> AtomsUtils::Curve::basis ( int  knotSpan,
float  u 
) const

Basis function for B-Spline.

Parameters
knotSpanknot span ( from findSpan() )
uparameter

◆ closestPoint()

virtual std::pair<float,AtomsMath::Vector3f> AtomsUtils::Curve::closestPoint ( const AtomsMath::Vector3f &  point,
unsigned int  maxStep = 6,
unsigned int  maxIterations = 10,
float  tollarence = 0.0001f 
)
virtual

Get closest point.

Parameters
pointPoint
maxStepMax number of step
maxIterationMax number of iterations

Reimplemented in AtomsUtils::SampledCurve.

◆ closestTangent()

virtual std::pair<float, AtomsMath::Vector3f> AtomsUtils::Curve::closestTangent ( const AtomsMath::Vector3f &  point,
unsigned int  maxStep = 6,
unsigned int  maxIterations = 10,
float  tollarence = 0.0001f 
)
virtual

Get closest tangent.

Parameters
pointPoint
maxStepMax number of step
maxIterationMax number of iterations

Reimplemented in AtomsUtils::SampledCurve.

◆ computeUniformKnots()

void AtomsUtils::Curve::computeUniformKnots ( )

Compute uniform knots.

Compute a uniform knots span for the control points

◆ curveDerivs()

std::vector<AtomsMath::Vector3f> AtomsUtils::Curve::curveDerivs ( float  param,
unsigned int  nderiv 
) const

Return the curve derivative.

Parameters
paramParametric point
nderivderivative degree

◆ dersBasis()

std::vector<std::vector<float> > AtomsUtils::Curve::dersBasis ( int  knotSpan,
float  u,
unsigned int  degree 
) const

Basis function for B-Spline.

Parameters
knotSpanknot span ( from findSpan() )

◆ findKnot()

int AtomsUtils::Curve::findKnot ( float  u) const

Find span.

Finds the knot k for which u is in the range [u_k,u_{k+1})

Parameters
uparametric value
Returns
the index k
Warning
u must be in a valid range.

◆ findMult()

int AtomsUtils::Curve::findMult ( int  r) const

Find multiplicity.

Finds the multiplicity of a knot

Parameters
rthe knot to observe
Returns
the multiplicity of the knot
Warning
r must be a valid knot index

◆ findSpan()

int AtomsUtils::Curve::findSpan ( float  u) const

Find span.

Find on which span the given u value lies in

Parameters
uparameter

◆ parallelFrameAtPoint()

AtomsMath::Matrixf AtomsUtils::Curve::parallelFrameAtPoint ( unsigned int  samples,
AtomsMath::Vector3f  upVec,
float  param 
) const

Get curve normal on a point using parallel frame.

Parameters
samplesNumber of samples
upVecUp vector
Parametricposition

◆ parallelFrameNormals()

std::vector<AtomsMath::Vector3f> AtomsUtils::Curve::parallelFrameNormals ( unsigned int  samples,
AtomsMath::Vector3f  upVec 
) const

Get curve normals using parallel frame.

Parameters
samplesNumber of samples
upVecUp vector

◆ pointOnCurve()

AtomsMath::Vector3f AtomsUtils::Curve::pointOnCurve ( float  param) const

Get a point on the curve.

Parameters
paramparametric position of the point

◆ tangentOnCurve()

AtomsMath::Vector3f AtomsUtils::Curve::tangentOnCurve ( float  param) const

Get a tangent on the curve.

Parameters
paramparametric position of the point

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