CurveFitter

from panda3d.core import CurveFitter
class CurveFitter

Bases:

Inheritance diagram

Inheritance diagram of CurveFitter

__init__()
__init__(param0: CurveFitter)
add_hpr(t: float, hpr: LVecBase3)

Adds a single sample hpr.

add_xyz(t: float, xyz: LVecBase3)

Adds a single sample xyz.

add_xyz_hpr(t: float, xyz: LVecBase3, hpr: LVecBase3)

Adds a single sample xyz & hpr simultaneously.

compute_tangents(scale: float)

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(factor: float)

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 get_class_type() TypeHandle
get_num_samples() int

Returns the number of sample points that have been added.

get_sample_hpr(n: int) LVecBase3

Returns the orientation of the nth sample added.

get_sample_t(n: int) float

Returns the parametric value of the nth sample added.

get_sample_tangent(n: int) LVecBase3

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

get_sample_xyz(n: int) LVecBase3

Returns the point in space of the nth sample added.

make_hermite() ParametricCurveCollection

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

make_nurbs() ParametricCurveCollection

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

output(out: ostream)
remove_samples(begin: int, end: int)

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

reset()

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

sample(curves: ParametricCurveCollection, count: int)

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.

sort_points()

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

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.

write(out: ostream)