CurveFitter

class CurveFitter

Inheritance diagram

Inheritance diagram of CurveFitter

CurveFitter(void)
CurveFitter(CurveFitter const&) = default
void add_hpr(PN_stdfloat t, LVecBase3 const &hpr)

Adds a single sample hpr.

void add_xyz(PN_stdfloat t, LVecBase3 const &xyz)

Adds a single sample xyz.

void add_xyz_hpr(PN_stdfloat t, LVecBase3 const &xyz, LVecBase3 const &hpr)

Adds a single sample xyz & hpr simultaneously.

void compute_tangents(PN_stdfloat scale)

Once a set of points has been built, and prior to calling MakeHermite() or MakeNurbs(), ComputeTangents() must be called to set up the tangents correctly (unless the tangents were defined as the points were added).

void desample(PN_stdfloat factor)

Removes sample points in order to reduce the complexity of a sampled curve. Keeps one out of every factor samples. Also keeps the first and the last samples.

static TypeHandle get_class_type(void)
int get_num_samples(void) const

Returns the number of sample points that have been added.

LVecBase3 get_sample_hpr(int n) const

Returns the orientation of the nth sample added.

PN_stdfloat get_sample_t(int n) const

Returns the parametric value of the nth sample added.

LVecBase3 get_sample_tangent(int n) const

Returns the tangent associated with the nth sample added. This is only meaningful if compute_tangents() has already been called.

LVecBase3 get_sample_xyz(int n) const

Returns the point in space of the nth sample added.

PointerTo<ParametricCurveCollection> make_hermite(void) const

Converts the current set of data points into a Hermite curve.

PointerTo<ParametricCurveCollection> make_nurbs(void) const

Converts the current set of data points into a NURBS curve. This gives a smoother curve than produced by MakeHermite().

void output(std::ostream &out) const
void remove_samples(int begin, int end)

Eliminates all samples from index begin, up to but not including index end, from the database.

void reset(void)

Removes all the data points previously added to the CurveFitter, and initializes it for a new curve.

void sample(ParametricCurveCollection *curves, int count)

Generates a series of data points by sampling the given curve (or xyz/hpr curves) the indicated number of times. The sampling is made evenly in parametric time, and then the timewarps, if any, are applied.

void sort_points(void)

Sorts all the data points in order by parametric time, in case they were added in an incorrect order.

void wrap_hpr(void)

Resets each HPR data point so that the maximum delta between any two consecutive points is 180 degrees, which should prevent incorrect HPR wrapping.

void write(std::ostream &out) const