ParametricCurveCollection

Inheritance:

Methods of ParametricCurveCollection:

Methods of ReferenceCount:

addCurve
void ParametricCurveCollection::add_curve(ParametricCurve *curve);

Description: Adds a new ParametricCurve to the collection.
Description: Adds a new ParametricCurve to the collection at the indicated index.

addCurves
int ParametricCurveCollection::add_curves(PandaNode *node);

Description: Adds all the curves found in the scene graph rooted at the given node. Returns the number of curves found.

adjustHpr
bool ParametricCurveCollection::adjust_hpr(float t, float h, float p, float r);

Description: Adjust the HPR curve at the indicated time to the new value. The curve shape will change correspondingly. Returns true if successful, false if unable to make the adjustment for some reason.

adjustXyz
bool ParametricCurveCollection::adjust_xyz(float t, float x, float y, float z);

Description: Adjust the XYZ curve at the indicated time to the new value. The curve shape will change correspondingly. Returns true if successful, false if unable to make the adjustment for some reason.

clear
void ParametricCurveCollection::clear(void);

Description: Removes all ParametricCurves from the collection.

clearTimewarps
void ParametricCurveCollection::clear_timewarps(void);

Description: Removes all the timewarp curves from the collection.

evaluate
bool ParametricCurveCollection::evaluate(float t, LVecBase3f &xyz, LVecBase3f &hpr) const;

Description: Computes the position and rotation represented by the first XYZ and HPR curves in the collection at the given point t, after t has been modified by all the timewarp curves in the collection applied in sequence, from back to front.
Returns true if the point is valid (i.e. t is within the bounds indicated by all the timewarp curves and within the bounds of the curves themselves), or false otherwise.
Description: Computes the transform matrix representing translation to the position indicated by the first XYZ curve in the collection and the rotation indicated by the first HPR curve in the collection, after t has been modified by all the timewarp curves in the collection applied in sequence, from back to front.

evaluateHpr
bool ParametricCurveCollection::evaluate_hpr(float t, LVecBase3f &hpr) const;

Description: Computes only the HPR part of the curves. See evaluate().

evaluateT
float ParametricCurveCollection::evaluate_t(float t) const;

Description: Determines the value of t that should be passed to the XYZ and HPR curves, after applying the given value of t to all the timewarps. Return -1.0f if the value of t exceeds one of the timewarps' ranges.

evaluateXyz
bool ParametricCurveCollection::evaluate_xyz(float t, LVecBase3f &xyz) const;

Description: Computes only the XYZ part of the curves. See evaluate().

faceForward
void ParametricCurveCollection::face_forward(float segments_per_unit);

Description: Discards the existing HPR curve and generates a new one that looks in the direction of travel along the XYZ curve, based on the XYZ curve's tangent at each point.

getCurve
ParametricCurve *ParametricCurveCollection::get_curve(int index) const;

Description: Returns the nth ParametricCurve in the collection.

getDefaultCurve
ParametricCurve *ParametricCurveCollection::get_default_curve(void) const;

Description: If there is an XYZ curve in the collection, returns it; otherwise, returns the first curve whose type is unspecified. Returns NULL if no curve meets the criteria.

getHprCurve
ParametricCurve *ParametricCurveCollection::get_hpr_curve(void) const;

Description: Returns the first HPR curve in the collection, if any, or NULL if there are none.

getMaxT
float ParametricCurveCollection::get_max_t(void) const;

Description: Returns the maximum T value associated with the *last* curve in the collection. Normally, this will be either the XYZ or HPR curve, or a timewarp curve.

getNumCurves
int ParametricCurveCollection::get_num_curves(void) const;

Description: Returns the number of ParametricCurves in the collection.

getNumTimewarps
int ParametricCurveCollection::get_num_timewarps(void) const;

Description: Returns the number of timewarp curves in the collection.

getTimewarpCurve
ParametricCurve *ParametricCurveCollection::get_timewarp_curve(int n) const;

Description: Returns the nth timewarp curve in the collection.

getXyzCurve
ParametricCurve *ParametricCurveCollection::get_xyz_curve(void) const;

Description: Returns the first XYZ curve in the collection, if any, or NULL if there are none.

hasCurve
bool ParametricCurveCollection::has_curve(ParametricCurve *curve) const;

Description: Returns true if the indicated ParametricCurve appears in this collection, false otherwise.

makeEven
void ParametricCurveCollection::make_even(float max_t, float segments_per_unit);

Description: Discards all existing timewarp curves and recomputes a new timewarp curve that maps distance along the curve to parametric time, so that the distance between any two points in parametric time is proportional to the approximate distance of those same two points along the XYZ curve.
segments_per_unit represents the number of segments to take per each unit of parametric time of the original XYZ curve.
The new timewarp curve (and thus, the apparent range of the collection) will range from 0 to max_t.

output
void ParametricCurveCollection::output(ostream &out) const;

Description: Writes a brief one-line description of the ParametricCurveCollection to the indicated output stream.

recompute
bool ParametricCurveCollection::recompute(void);

Description: Ensures all the curves are freshly computed and up-to-date. Returns true if everything is valid, false if at least one curve is incorrect.

removeCurve
bool ParametricCurveCollection::remove_curve(ParametricCurve *curve);

Description: Removes the indicated ParametricCurve from the collection. Returns true if the curve was removed, false if it was not a member of the collection.
Description: Removes the indicated ParametricCurve from the collection, by its index number.

resetMaxT
void ParametricCurveCollection::reset_max_t(float max_t);

Description: Adjusts the apparent length of the curve by applying a new timewarp that maps the range [0..max_t] to the range [0..get_max_t()]. After this call, the curve collection will contain one more timewarp curve, and get_max_t() will return the given max_t value.

stitch
bool ParametricCurveCollection::stitch(ParametricCurveCollection const *a, ParametricCurveCollection const *b);

Description: Regenerates this curve as one long curve: the first curve connected end-to-end with the second one. Either a or b may be the same as 'this'. This will lose any timewarps on the input curves.
Returns true if successful, false on failure.

write
void ParametricCurveCollection::write(ostream &out, int indent_level = (0)) const;

Description: Writes a complete multi-line description of the ParametricCurveCollection to the indicated output stream.

writeEgg
bool ParametricCurveCollection::write_egg(Filename filename, CoordinateSystem cs = (CS_default));

Description: Writes an egg description of all the nurbs curves in the collection to the specified output file. Returns true if the file is successfully written.
Description: Writes an egg description of all the nurbs curves in the collection to the specified output stream. Returns true if the file is successfully written.

getClassType
static TypeHandle ReferenceCount::get_class_type(void);

Undocumented function.

getRefCount
int ReferenceCount::get_ref_count(void) const;

Description: Returns the current reference count.

ref
int ReferenceCount::ref(void) const;

Description: Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.
The return value is the new reference count.

testRefCountIntegrity
bool ReferenceCount::test_ref_count_integrity(void) const;

Description: Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise.

unref
int ReferenceCount::unref(void) const;

Description: Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete().
User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.
The return value is the new reference count.