Thea

A Bezier curve segment in Ndimensional space, parametrized by a scalar in the range [0, 1]. More...
#include <BezierN.hpp>
Public Types  
typedef ParametricCurveN< N, T >  ParametricCurveT 
Parametric curve segment in N dimensions. More...  
typedef BaseT::VectorT  VectorT 
Ndimensional vector type. More...  
Public Member Functions  
BezierN (intx order_=3)  
Construct an (initially zero length) Bezier curve of a given order (2 for quadratic Bezier, 3 for cubic Bezier, etc). More...  
template<typename InputIterator , typename std::enable_if< Algorithms::IsPointN< typename std::iterator_traits< InputIterator >::value_type, N >::value, int >::type = 0>  
double  fitToPoints (InputIterator begin, InputIterator end, T const *initial_params=nullptr, T *final_params=nullptr, bool fix_first_and_last=false, intx max_reparam_iters=1, intx num_reparam_steps_per_iter=1) 
Fit the curve to a sequence of points [begin, end). More...  
VectorT  getBinormal (T const &t) const 
Get the unit binormal vector (third Frenet vector) to the curve at parameter value t. More...  
VectorT const &  getControl (intx index) const 
Get a control vector of the curve. 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...  
intx  getOrder () const 
Get the order of the curve, or a negative value if the curve has no welldefined 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...  
bool  hasDeriv (intx deriv_order) const 
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...  
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...  
virtual void  setControl (intx index, VectorT const &pos)=0 
Set a control vector of the curve. More...  
std::string  toString () const 
Get a textual representation of the curve. More...  
Protected Member Functions  
bool  isChanged () const 
Check if the curve was changed and hence cached data should be recomputed. More...  
template<typename InputIterator >  
float64  llsqFit (InputIterator begin, InputIterator end, Array< float64 > const &u, bool fix_first_and_last) 
Fit the curve to a sequence of points using linear leastsquares. More...  
template<typename InputIterator >  
bool  refineParameters (InputIterator begin, InputIterator end, Array< float64 > &u, intx num_newton_iters) 
Optimize each parameter value to bring the curve closer to the corresponding target point, using NewtonRaphson steps. More...  
void  setChanged (bool value=true) const 
Mark the curve as having changed or not changed. 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...  
A Bezier curve segment in Ndimensional space, parametrized by a scalar in the range [0, 1].
This implementation uses code from Dave Eberly's Geometric Tools library.
Definition at line 42 of file BezierN.hpp.

inherited 
Parametric curve segment in N dimensions.
Definition at line 42 of file ParametricCurveN.hpp.
typedef BaseT::VectorT VectorT 
Ndimensional vector type.
Definition at line 50 of file BezierN.hpp.
Construct an (initially zero length) Bezier curve of a given order (2 for quadratic Bezier, 3 for cubic Bezier, etc).
The segment will be initialized with order + 1 control vectors, all initially zero.
Definition at line 56 of file BezierN.hpp.

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.

inherited 
Fit the curve to a sequence of points [begin, end).
The algorithm alternates between leastsquares fitting (with known parameters) and NewtonRaphson parameter optimization, following Graphics Gems.
begin  First point in the sequence to be fitted. 
end  One past the last point in the sequence to be fitted. 
initial_params  The curve parameters of the points, if known in advance. If this argument is not null, no reparametrization will be done by default, unless max_reparam_iters is explicitly set to a positive number. 
fix_first_and_last  If true, the first and last control vectors will be set to the positions of the first and last points, respectively, in the sequence. Note that curves whose first and last control vectors are not precisely the beginning and end positions of the curve will have this feature automatically disabled, with a warning. 
max_reparam_iters  If greater than zero, the parameter values of the points will be reestimated (at most) this many times, guided by initial values (initial_params) if any. Pass a negative value to pick a suitable default. 
num_reparam_steps_per_iter  The number of successive NewtonRaphson steps in each iteration of reparametrization. Pass a negative value to pick a suitable default. 
final_params  If nonnull, used to return the final parameter values of the point sequence. Must be preallocated to have at least as many entries as the number of points. 
Definition at line 102 of file SplineN.hpp.

inherited 
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).
Definition at line 317 of file ParametricCurveN.hpp.
Get a control vector of the curve.
index  The index of the control vector, in the range 0 to numControls()  1. 
Implements SplineN< N, T >.
Definition at line 68 of file BezierN.hpp.
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.

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.
num_points  The number of evenly spaced points to be returned (must be at least 2). 
pts_begin  If nonnull, used to return the point sequence. Must have capacity at least num_points. 
params_begin  If nonnull, used to return the corresponding curve parameter sequence. Must have capacity at least num_points. 
num_arc_samples  If nonnegative, 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.
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).
Definition at line 127 of file ParametricCurveN.hpp.

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 
Get the order of the curve, or a negative value if the curve has no welldefined order.
Reimplemented from ParametricCurveNBase< N, T >.
Definition at line 64 of file BezierN.hpp.

inherited 
Get the point on the curve with parameter value t, in the range [minParam(), maxParam()].
Definition at line 67 of file ParametricCurveN.hpp.

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 
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.
Implements ParametricCurveNBase< N, T >.
Definition at line 84 of file BezierN.hpp.

protectedinherited 
Check if the curve was changed and hence cached data should be recomputed.
Definition at line 367 of file SplineN.hpp.

protectedinherited 
Fit the curve to a sequence of points using linear leastsquares.
Control vector positions are estimated by minimizing the sum of squared errors between the points and their corresponding curve points with known parameters u.
begin  The beginning of the point sequence. 
end  One past the end of the point sequence. 
u  The curve parameter for each point. 
fix_first_and_last  If true, the first and last control vectors will be set to the positions of the first and last points, respectively, in the sequence. Note that curves whose first and last control vectors are not precisely the beginning and end positions of the curve will have this feature automatically disabled, with a warning. 
Definition at line 219 of file SplineN.hpp.

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.

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 
Get the number of control vectors of the curve, or a negative value if the curve is not defined by control vectors.
Reimplemented from ParametricCurveNBase< N, T >.
Definition at line 66 of file BezierN.hpp.

protectedinherited 
Optimize each parameter value to bring the curve closer to the corresponding target point, using NewtonRaphson steps.
See "An Algorithm for Automatically Fitting Digitized Curves", Philip J. Schneider, Graphics Gems, 1990.
Definition at line 328 of file SplineN.hpp.

protectedinherited 
Mark the curve as having changed or not changed.
Setting the value to true will cause update() to refresh cached data. Can be called even from the const update() function to unset the flag.
Definition at line 376 of file SplineN.hpp.
Set a control vector of the curve.
index  The index of the control vector to be set, in the range 0 to numControls()  1. 
pos  The new position of the control vector. 
setChanged(true)
, to trigger a call to update() to refresh cached data when required.

virtualinherited 
Get a textual representation of the curve.
Reimplemented from ParametricCurveNBase< N, T >.
Definition at line 158 of file SplineN.hpp.