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

Public Member Functions

 __init__ ()
 
 __init__ (const CurveFitter)
 
 addHpr (float t, const LVecBase3 hpr)
 Adds a single sample hpr. More...
 
 addXyz (float t, const LVecBase3 xyz)
 Adds a single sample xyz. More...
 
 addXyzHpr (float t, const LVecBase3 xyz, const LVecBase3 hpr)
 Adds a single sample xyz & hpr simultaneously. More...
 
 computeTangents (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). More...
 
 desample (float factor)
 Removes sample points in order to reduce the complexity of a sampled curve. More...
 
int getNumSamples ()
 Returns the number of sample points that have been added. More...
 
LVecBase3 getSampleHpr (int n)
 Returns the orientation of the nth sample added. More...
 
float getSampleT (int n)
 Returns the parametric value of the nth sample added. More...
 
LVecBase3 getSampleTangent (int n)
 Returns the tangent associated with the nth sample added. More...
 
LVecBase3 getSampleXyz (int n)
 Returns the point in space of the nth sample added. More...
 
ParametricCurveCollection makeHermite ()
 Converts the current set of data points into a Hermite curve. More...
 
ParametricCurveCollection makeNurbs ()
 Converts the current set of data points into a NURBS curve. More...
 
 output (Ostream out)
 
 removeSamples (int begin, int end)
 Eliminates all samples from index begin, up to but not including index end, from the database. More...
 
 reset ()
 Removes all the data points previously added to the CurveFitter, and initializes it for a new curve. More...
 
 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...
 
 sortPoints ()
 Sorts all the data points in order by parametric time, in case they were added in an incorrect order. More...
 
 wrapHpr ()
 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...
 
 write (Ostream out)
 

Static Public Member Functions

static TypeHandle getClassType ()
 

Member Function Documentation

◆ __init__() [1/2]

__init__ ( )

◆ __init__() [2/2]

__init__ ( const  CurveFitter)

◆ addHpr()

addHpr ( float  t,
const LVecBase3  hpr 
)

Adds a single sample hpr.

◆ addXyz()

addXyz ( float  t,
const LVecBase3  xyz 
)

Adds a single sample xyz.

◆ addXyzHpr()

addXyzHpr ( float  t,
const LVecBase3  xyz,
const LVecBase3  hpr 
)

Adds a single sample xyz & hpr simultaneously.

◆ computeTangents()

computeTangents ( 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).

◆ desample()

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.

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getNumSamples()

int getNumSamples ( )

Returns the number of sample points that have been added.

◆ getSampleHpr()

LVecBase3 getSampleHpr ( int  n)

Returns the orientation of the nth sample added.

◆ getSampleT()

float getSampleT ( int  n)

Returns the parametric value of the nth sample added.

◆ getSampleTangent()

LVecBase3 getSampleTangent ( int  n)

Returns the tangent associated with the nth sample added.

This is only meaningful if compute_tangents() has already been called.

◆ getSampleXyz()

LVecBase3 getSampleXyz ( int  n)

Returns the point in space of the nth sample added.

◆ makeHermite()

ParametricCurveCollection makeHermite ( )

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

◆ makeNurbs()

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

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

◆ output()

output ( Ostream  out)

◆ removeSamples()

removeSamples ( int  begin,
int  end 
)

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

◆ reset()

reset ( )

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

◆ sample()

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.

◆ sortPoints()

sortPoints ( )

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

◆ wrapHpr()

wrapHpr ( )

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

◆ write()

write ( Ostream  out)