Thea
ParametricCurveN< N, T > Class Template Referenceabstract

A parametric curve segment in N-dimensional space. More...

`#include <ParametricCurveN.hpp>`

Inheritance diagram for ParametricCurveN< N, T >:

## Public Types

typedef ParametricCurveN< N, T > ParametricCurveT
Parametric curve segment in N dimensions. More...

## Public Member Functions

VectorT getBinormal (T const &t) const
Get the unit binormal vector (third Frenet vector) to the curve at parameter value t. More...

VectorT getDeriv (T const &t, intx deriv_order=1) const
Get the first, second, or higher derivative (specified by deriv_order = 1, 2, ...) of the curve at parameter value t, in the range [minParam(), maxParam()]. More...

virtual void getEvenlySpacedPoints (intx num_points, VectorT *pts_begin=nullptr, T *params_begin=nullptr, intx num_arc_samples=-1) const
Get a sequence of points roughly evenly spaced by arc length along the curve, with associated parameter values. More...

VectorT getFrenetVector (T const &t, intx deriv_order) const
Get the Frenet vector of the curve at parameter value t, for a given order. More...

VectorT getNormal (T const &t) const
Get the unit normal vector (second Frenet vector) to the curve at parameter value t. More...

virtual intx getOrder () const
Get the order of the curve, or a negative value if the curve has no well-defined order. More...

VectorT getPoint (T const &t) const
Get the point on the curve with parameter value t, in the range [minParam(), maxParam()]. More...

VectorT getTangent (T const &t) const
Get the unit tangent vector (first Frenet vector) to the curve at parameter value t. More...

virtual bool hasDeriv (intx deriv_order) const =0
Check if the curve's getDeriv() function supports evaluating derivatives upto and including a given order (1 for first derivative, 2 for second, and so on). More...

T const & maxParam () const
Get the maximum possible parameter value for the segment, which is the value at the end of the curve. More...

T const & minParam () const
Get the minimum possible parameter value for the segment, which is the value at the beginning of the curve. More...

virtual intx numControls () const
Get the number of control vectors of the curve, or a negative value if the curve is not defined by control vectors. More...

ParametricCurveN (T const &min_param_=0, T const &max_param_=1)
Constructor, sets parameter limits. More...

virtual std::string toString () const
Get a textual representation of the curve. More...

virtual ~ParametricCurveN ()=0
Destructor. More...

## Protected Member Functions

virtual VectorT eval (T const &t, intx deriv_order) const =0
Evaluate the curve position, or one of its derivatives, at a given parameter value. More...

## Static Protected Member Functions

template<typename InputIterator >
static void chordLengthParametrize (InputIterator begin, InputIterator end, Array< double > &u, double min_param_=0, double max_param_=1)
Estimate curve parameters for a sequence of points, by accumulating pairwise segment lengths along the sequence. More...

## Detailed Description

### template<int N, typename T = Real> class Thea::ParametricCurveN< N, T >

A parametric curve segment in N-dimensional space.

Definition at line 29 of file ParametricCurveN.hpp.

## Member Typedef Documentation

 typedef ParametricCurveN ParametricCurveT
inherited

Parametric curve segment in N dimensions.

Definition at line 42 of file ParametricCurveN.hpp.

## Constructor & Destructor Documentation

 ParametricCurveN ( T const & min_param_ = `0`, T const & max_param_ = `1` )

Constructor, sets parameter limits.

Definition at line 301 of file ParametricCurveN.hpp.

 ~ParametricCurveN ( )
pure virtual

Destructor.

Definition at line 331 of file ParametricCurveN.hpp.

## Member Function Documentation

 static void chordLengthParametrize ( InputIterator begin, InputIterator end, Array< double > & u, double min_param_ = `0`, double max_param_ = `1` )
staticprotectedinherited

Estimate curve parameters for a sequence of points, by accumulating pairwise segment lengths along the sequence.

Definition at line 242 of file ParametricCurveN.hpp.

 virtual VectorT eval ( T const & t, intx deriv_order ) const
protectedpure virtualinherited

Evaluate the curve position, or one of its derivatives, at a given parameter value.

Parameters
 t The curve parameter value, in the range [minParam(), maxParam()]. deriv_order 0 to get the point position, 1 to get the first derivative, 2 for the second, and so on.
Returns
The desired position or derivative vector.
 VectorT getBinormal ( T const & t ) const

Get the unit binormal vector (third Frenet vector) to the curve at parameter value t.

This requires the third derivative, and the return value is zero if hasDeriv(3) returns false (or N < 3, in which case the binormal is undefined).

Note
This function has an optimized implementation in 3 dimensions, where only the second derivative is required since the binormal can be computed as the cross-product of the unit tangent and normal vectors.
Warning
This function is currently strongly susceptible to numerical error, when the unnormalized tangent/normal/binormal has length nearly zero, but normalization rescales it to unit length. Use with caution.

Definition at line 317 of file ParametricCurveN.hpp.

 VectorT getDeriv ( T const & t, intx deriv_order = `1` ) const
inherited

Get the first, second, or higher derivative (specified by deriv_order = 1, 2, ...) of the curve at parameter value t, in the range [minParam(), maxParam()].

Definition at line 83 of file ParametricCurveN.hpp.

 virtual void getEvenlySpacedPoints ( intx num_points, VectorT * pts_begin = `nullptr`, T * params_begin = `nullptr`, intx num_arc_samples = `-1` ) const
virtualinherited

Get a sequence of points roughly evenly spaced by arc length along the curve, with associated parameter values.

The beginning and end of the curve (parameter values minParam() and maxParam() respectively) are always included.

Parameters
 num_points The number of evenly spaced points to be returned (must be at least 2). pts_begin If non-null, used to return the point sequence. Must have capacity at least num_points. params_begin If non-null, used to return the corresponding curve parameter sequence. Must have capacity at least num_points. num_arc_samples If non-negative, specifies the number of samples for approximating arc lengths along the curve (must be at least 2). This value should normally be left at the default setting.

Definition at line 161 of file ParametricCurveN.hpp.

 VectorT getFrenetVector ( T const & t, intx deriv_order ) const
inherited

Get the Frenet vector of the curve at parameter value t, for a given order.

The first Frenet vector is the unit tangent vector returned by getTangent(), the second is the unit normal vector returned by getNormal(), the third the unit binormal, and so on. The return value is zero if hasDeriv(deriv_order) returns false (or deriv_order > N, in which case the Frenet vector is undefined).

Warning
This function is currently strongly susceptible to numerical error, when the unnormalized Frenet vector of any order (upto deriv_order) has length nearly zero, but normalization rescales it to unit length. Use higher-order Frenet vectors with caution.

Definition at line 127 of file ParametricCurveN.hpp.

 VectorT getNormal ( T const & t ) const
inherited

Get the unit normal vector (second Frenet vector) to the curve at parameter value t.

This requires the second derivative, and the return value is zero if hasDeriv(2) returns false (or N < 2, in which case the normal is undefined).

Definition at line 103 of file ParametricCurveN.hpp.

 virtual intx getOrder ( ) const
virtualinherited

Get the order of the curve, or a negative value if the curve has no well-defined order.

Reimplemented in BezierN< N, T >.

Definition at line 61 of file ParametricCurveN.hpp.

 VectorT getPoint ( T const & t ) const
inherited

Get the point on the curve with parameter value t, in the range [minParam(), maxParam()].

Definition at line 67 of file ParametricCurveN.hpp.

 VectorT getTangent ( T const & t ) const
inherited

Get the unit tangent vector (first Frenet vector) to the curve at parameter value t.

This requires the first derivative, and the return value is zero if hasDeriv(1) returns false (or N < 1, in which case the tangent is undefined).

Definition at line 92 of file ParametricCurveN.hpp.

 virtual bool hasDeriv ( intx deriv_order ) const
pure virtualinherited

Check if the curve's getDeriv() function supports evaluating derivatives upto and including a given order (1 for first derivative, 2 for second, and so on).

Note that if the function returns false for some deriv_order, then it must also return false for all higher orders.

Implemented in BezierN< N, T >.

 T const& maxParam ( ) const
inherited

Get the maximum possible parameter value for the segment, which is the value at the end of the curve.

Definition at line 58 of file ParametricCurveN.hpp.

 T const& minParam ( ) const
inherited

Get the minimum possible parameter value for the segment, which is the value at the beginning of the curve.

Definition at line 55 of file ParametricCurveN.hpp.

 virtual intx numControls ( ) const
virtualinherited

Get the number of control vectors of the curve, or a negative value if the curve is not defined by control vectors.

Reimplemented in BezierN< N, T >.

Definition at line 64 of file ParametricCurveN.hpp.

 virtual std::string toString ( ) const
virtualinherited

Get a textual representation of the curve.

Reimplemented in SplineN< N, T >.

Definition at line 222 of file ParametricCurveN.hpp.

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