Panda3D
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
CurveFitter Class Reference

Classes

class  DataPoint
 

Public Types

typedef pvector< DataPointData
 

Public Member Functions

void add_hpr (PN_stdfloat t, const LVecBase3 &hpr)
 Adds a single sample hpr. More...
 
void add_xyz (PN_stdfloat t, const LVecBase3 &xyz)
 Adds a single sample xyz. More...
 
void add_xyz_hpr (PN_stdfloat t, const LVecBase3 &xyz, const LVecBase3 &hpr)
 Adds a single sample xyz & hpr simultaneously. More...
 
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). More...
 
void desample (PN_stdfloat factor)
 Removes sample points in order to reduce the complexity of a sampled curve. More...
 
int get_num_samples () const
 Returns the number of sample points that have been added. More...
 
LVecBase3 get_sample_hpr (int n) const
 Returns the orientation of the nth sample added. More...
 
PN_stdfloat get_sample_t (int n) const
 Returns the parametric value of the nth sample added. More...
 
LVecBase3 get_sample_tangent (int n) const
 Returns the tangent associated with the nth sample added. More...
 
LVecBase3 get_sample_xyz (int n) const
 Returns the point in space of the nth sample added. More...
 
void output (std::ostream &out) const
 
 PT (ParametricCurveCollection) make_hermite() const
 
 PT (ParametricCurveCollection) make_nurbs() const
 
void remove_samples (int begin, int end)
 Eliminates all samples from index begin, up to but not including index end, from the database. More...
 
void reset ()
 Removes all the data points previously added to the CurveFitter, and initializes it for a new curve. More...
 
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. More...
 
void sort_points ()
 Sorts all the data points in order by parametric time, in case they were added in an incorrect order. More...
 
void wrap_hpr ()
 Resets each HPR data point so that the maximum delta between any two consecutive points is 180 degrees, which should prevent incorrect HPR wrapping. More...
 
void write (std::ostream &out) const
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 

Public Attributes

Data _data
 
bool _got_hpr
 
bool _got_xyz
 

Detailed Description

Definition at line 33 of file curveFitter.h.

Member Function Documentation

◆ add_hpr()

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

Adds a single sample hpr.

Definition at line 67 of file curveFitter.cxx.

◆ add_xyz()

void CurveFitter::add_xyz ( PN_stdfloat  t,
const LVecBase3 &  xyz 
)

Adds a single sample xyz.

Definition at line 55 of file curveFitter.cxx.

◆ add_xyz_hpr()

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

Adds a single sample xyz & hpr simultaneously.

Definition at line 79 of file curveFitter.cxx.

◆ compute_tangents()

void CurveFitter::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).

Definition at line 251 of file curveFitter.cxx.

◆ desample()

void CurveFitter::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.

Definition at line 225 of file curveFitter.cxx.

◆ get_num_samples()

int CurveFitter::get_num_samples ( ) const

Returns the number of sample points that have been added.

Definition at line 93 of file curveFitter.cxx.

◆ get_sample_hpr()

LVecBase3 CurveFitter::get_sample_hpr ( int  n) const

Returns the orientation of the nth sample added.

Definition at line 119 of file curveFitter.cxx.

◆ get_sample_t()

PN_stdfloat CurveFitter::get_sample_t ( int  n) const

Returns the parametric value of the nth sample added.

Definition at line 101 of file curveFitter.cxx.

◆ get_sample_tangent()

LVecBase3 CurveFitter::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.

Definition at line 129 of file curveFitter.cxx.

◆ get_sample_xyz()

LVecBase3 CurveFitter::get_sample_xyz ( int  n) const

Returns the point in space of the nth sample added.

Definition at line 110 of file curveFitter.cxx.

◆ remove_samples()

void CurveFitter::remove_samples ( int  begin,
int  end 
)

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

Definition at line 139 of file curveFitter.cxx.

◆ reset()

void CurveFitter::reset ( )

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

Definition at line 47 of file curveFitter.cxx.

◆ sample()

void CurveFitter::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.

Definition at line 154 of file curveFitter.cxx.

◆ sort_points()

void CurveFitter::sort_points ( )

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

Definition at line 215 of file curveFitter.cxx.

◆ wrap_hpr()

void CurveFitter::wrap_hpr ( )

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

Definition at line 185 of file curveFitter.cxx.


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