Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

CurveFitter Class Reference

#include <curveFitter.h>

List of all members.

Public Types

typedef pvector< DataPointData

Public Member Functions

 CurveFitter ()
 ~CurveFitter ()
void reset ()
 Removes all the data points previously added to the CurveFitter, and initializes it for a new curve.

void add_xyz (float t, const LVecBase3f &xyz)
 Adds a single sample xyz.

void add_hpr (float t, const LVecBase3f &hpr)
 Adds a single sample hpr.

void add_xyz_hpr (float t, const LVecBase3f &xyz, const LVecBase3f &hpr)
 Adds a single sample xyz & hpr simultaneously.

int get_num_samples () const
 Returns the number of sample points that have been added.

float get_sample_t (int n) const
 Returns the parametric value of the nth sample added.

LVecBase3f get_sample_xyz (int n) const
 Returns the point in space of the nth sample added.

LVecBase3f get_sample_hpr (int n) const
 Returns the orientation of the nth sample added.

LVecBase3f get_sample_tangent (int n) const
 Returns the tangent associated with the nth sample added.

void remove_samples (int begin, int end)
 Eliminates all samples from index begin, up to but not including index end, from the database.

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 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 sort_points ()
 Sorts all the data points in order by parametric time, in case they were added in an incorrect order.

void desample (float factor)
 Removes sample points in order to reduce the complexity of a sampled curve.

void compute_tangents (float 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).

PointerTo< ParametricCurveCollectionmake_hermite () const
 Converts the current set of data points into a Hermite curve.

PointerTo< ParametricCurveCollectionmake_nurbs () const
 Converts the current set of data points into a NURBS curve.

void output (ostream &out) const
void write (ostream &out) const

Static Public Member Functions

TypeHandle get_class_type ()
void init_type ()

Public Attributes

Data _data
bool _got_xyz
bool _got_hpr

Static Private Attributes

TypeHandle _type_handle


Member Typedef Documentation

typedef pvector<DataPoint> CurveFitter::Data
 

Definition at line 87 of file curveFitter.h.


Constructor & Destructor Documentation

CurveFitter::CurveFitter  ) 
 

Definition at line 42 of file curveFitter.cxx.

CurveFitter::~CurveFitter  ) 
 

Definition at line 55 of file curveFitter.cxx.

References _data.


Member Function Documentation

void CurveFitter::add_hpr float  t,
const LVecBase3f &  hpr
 

Adds a single sample hpr.

Definition at line 99 of file curveFitter.cxx.

References _data, _got_hpr, and _got_xyz.

void CurveFitter::add_xyz float  t,
const LVecBase3f &  xyz
 

Adds a single sample xyz.

Definition at line 82 of file curveFitter.cxx.

References _data, _got_hpr, CurveFitter::DataPoint::_hpr, CurveFitter::DataPoint::_t, and t.

void CurveFitter::add_xyz_hpr float  t,
const LVecBase3f &  xyz,
const LVecBase3f &  hpr
 

Adds a single sample xyz & hpr simultaneously.

Definition at line 116 of file curveFitter.cxx.

References _data, and nassertr.

void CurveFitter::compute_tangents float  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 368 of file curveFitter.cxx.

References _data, HC_SMOOTH, HermiteCurve::insert_cv(), PCT_HPR, PCT_XYZ, PT, ParametricCurve::set_curve_type(), HermiteCurve::set_cv_in(), HermiteCurve::set_cv_out(), HermiteCurve::set_cv_point(), and HermiteCurve::set_cv_type().

void CurveFitter::desample float  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 331 of file curveFitter.cxx.

References _data.

TypeHandle CurveFitter::get_class_type void   )  [inline, static]
 

Definition at line 94 of file curveFitter.h.

int CurveFitter::get_num_samples  )  const
 

Returns the number of sample points that have been added.

Definition at line 137 of file curveFitter.cxx.

LVecBase3f CurveFitter::get_sample_hpr int  n  )  const
 

Returns the orientation of the nth sample added.

Definition at line 178 of file curveFitter.cxx.

References ParametricCurveCollection::get_max_t(), nassertv, NULL, and t.

float CurveFitter::get_sample_t int  n  )  const
 

Returns the parametric value of the nth sample added.

Definition at line 150 of file curveFitter.cxx.

References _data, nassertr, and zero.

LVecBase3f 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 196 of file curveFitter.cxx.

References _data, CurveFitter::DataPoint::_hpr, CurveFitter::DataPoint::_t, CurveFitter::DataPoint::_xyz, ParametricCurveCollection::evaluate(), and t.

LVecBase3f CurveFitter::get_sample_xyz int  n  )  const
 

Returns the point in space of the nth sample added.

Definition at line 164 of file curveFitter.cxx.

References _data, and nassertv.

void CurveFitter::init_type void   )  [inline, static]
 

Definition at line 97 of file curveFitter.h.

References _type_handle.

PointerTo< ParametricCurveCollection > CurveFitter::make_hermite  )  const
 

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

Definition at line 446 of file curveFitter.cxx.

References ClassicNurbsCurve::get_knot(), and ClassicNurbsCurve::set_knot().

PointerTo< ParametricCurveCollection > CurveFitter::make_nurbs  )  const
 

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

This gives a smoother curve than produced by MakeHermite().

Definition at line 495 of file curveFitter.cxx.

void CurveFitter::output ostream &  out  )  const
 

Definition at line 551 of file curveFitter.cxx.

Referenced by operator<<().

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

References _data.

void CurveFitter::reset  ) 
 

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

Definition at line 69 of file curveFitter.cxx.

References _data, _got_xyz, and t.

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

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

References _data.

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

void CurveFitter::write ostream &  out  )  const
 

Definition at line 563 of file curveFitter.cxx.


Member Data Documentation

Data CurveFitter::_data
 

Definition at line 88 of file curveFitter.h.

Referenced by add_hpr(), add_xyz(), add_xyz_hpr(), compute_tangents(), desample(), get_sample_t(), get_sample_tangent(), get_sample_xyz(), remove_samples(), reset(), sort_points(), and ~CurveFitter().

bool CurveFitter::_got_hpr
 

Definition at line 91 of file curveFitter.h.

Referenced by add_hpr(), and add_xyz().

bool CurveFitter::_got_xyz
 

Definition at line 90 of file curveFitter.h.

Referenced by add_hpr(), and reset().

TypeHandle CurveFitter::_type_handle [static, private]
 

Definition at line 32 of file curveFitter.cxx.

Referenced by init_type().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:49:06 2003 for Panda by doxygen1.3