Panda3D
Loading...
Searching...
No Matches
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.
 
void add_xyz (PN_stdfloat t, const LVecBase3 &xyz)
 Adds a single sample xyz.
 
void add_xyz_hpr (PN_stdfloat t, const LVecBase3 &xyz, const LVecBase3 &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.
 
int get_num_samples () 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.
 
LVecBase3 get_sample_xyz (int n) const
 Returns the point in space of the nth sample added.
 
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.
 
void reset ()
 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.
 
void sort_points ()
 Sorts all the data points in order by parametric time, in case they were added in an incorrect order.
 
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.
 
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 Typedef Documentation

◆ Data

Definition at line 76 of file curveFitter.h.

Constructor & Destructor Documentation

◆ CurveFitter()

CurveFitter::CurveFitter ( )

Definition at line 29 of file curveFitter.cxx.

◆ ~CurveFitter()

CurveFitter::~CurveFitter ( )

Definition at line 38 of file curveFitter.cxx.

Member Function Documentation

◆ add_hpr()

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

Adds a single sample hpr.

Definition at line 66 of file curveFitter.cxx.

Referenced by ParametricCurveCollection::face_forward().

◆ add_xyz()

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

Adds a single sample xyz.

Definition at line 54 of file curveFitter.cxx.

Referenced by ParametricCurveCollection::make_even().

◆ 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 78 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 250 of file curveFitter.cxx.

Referenced by ParametricCurveCollection::face_forward(), and ParametricCurveCollection::make_even().

◆ 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 224 of file curveFitter.cxx.

◆ get_class_type()

static TypeHandle CurveFitter::get_class_type ( )
inlinestatic

Definition at line 83 of file curveFitter.h.

◆ get_num_samples()

int CurveFitter::get_num_samples ( ) const

Returns the number of sample points that have been added.

Definition at line 92 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 118 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 100 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 128 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 109 of file curveFitter.cxx.

◆ init_type()

static void CurveFitter::init_type ( )
inlinestatic

Definition at line 86 of file curveFitter.h.

◆ 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 138 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 46 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 153 of file curveFitter.cxx.

References ParametricCurveCollection::evaluate(), ParametricCurveCollection::get_hpr_curve, ParametricCurveCollection::get_max_t, and ParametricCurveCollection::get_xyz_curve.

◆ 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 214 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 184 of file curveFitter.cxx.

Referenced by ParametricCurveCollection::face_forward().

Member Data Documentation

◆ _data

Data CurveFitter::_data

Definition at line 77 of file curveFitter.h.

◆ _got_hpr

bool CurveFitter::_got_hpr

Definition at line 80 of file curveFitter.h.

◆ _got_xyz

bool CurveFitter::_got_xyz

Definition at line 79 of file curveFitter.h.


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