14#ifndef PARAMETRICCURVECOLLECTION_H
15#define PARAMETRICCURVECOLLECTION_H
28class ParametricCurveDrawer;
37class EXPCL_PANDA_PARAMETRICS ParametricCurveCollection :
public ReferenceCount {
39 ParametricCurveCollection();
40 INLINE ~ParametricCurveCollection();
73 void make_even(PN_stdfloat max_t, PN_stdfloat segments_per_unit);
77 bool evaluate(PN_stdfloat t, LVecBase3 &xyz, LVecBase3 &hpr)
const;
78 bool evaluate(PN_stdfloat t, LMatrix4 &result, CoordinateSystem cs = CS_default)
const;
81 INLINE
bool evaluate_xyz(PN_stdfloat t, LVecBase3 &xyz)
const;
82 INLINE
bool evaluate_hpr(PN_stdfloat t, LVecBase3 &hpr)
const;
84 INLINE
bool adjust_xyz(PN_stdfloat t, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
85 bool adjust_xyz(PN_stdfloat t,
const LVecBase3 &xyz);
86 INLINE
bool adjust_hpr(PN_stdfloat t, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
87 bool adjust_hpr(PN_stdfloat t,
const LVecBase3 &xyz);
91 bool stitch(
const ParametricCurveCollection *a,
92 const ParametricCurveCollection *b);
94 void output(std::ostream &out)
const;
95 void write(std::ostream &out,
int indent_level = 0)
const;
106 bool determine_hpr(PN_stdfloat t,
ParametricCurve *xyz_curve, LVecBase3 &hpr)
const;
113 ParametricCurves _curves;
The name of a file, such as a texture file or an Egg file.
A basic node of the scene graph or data graph.
This is a set of zero or more ParametricCurves, which may or may not be related.
bool recompute()
Ensures all the curves are freshly computed and up-to-date.
void clear_timewarps()
Removes all the timewarp curves from the collection.
get_default_curve
If there is an XYZ curve in the collection, returns it; otherwise, returns the first curve whose type...
int add_curves(PandaNode *node)
Adds all the curves found in the scene graph rooted at the given node.
void insert_curve(size_t index, ParametricCurve *curve)
Adds a new ParametricCurve to the collection at the indicated index.
void unregister_drawer(ParametricCurveDrawer *drawer)
Removes a previously registered drawer from the list of automatically- refreshed drawers.
bool adjust_xyz(PN_stdfloat t, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Adjust the XYZ curve at the indicated time to the new value.
bool has_curve(ParametricCurve *curve) const
Returns true if the indicated ParametricCurve appears in this collection, false otherwise.
bool evaluate_xyz(PN_stdfloat t, LVecBase3 &xyz) const
Computes only the XYZ part of the curves.
void write(std::ostream &out, int indent_level=0) const
Writes a complete multi-line description of the ParametricCurveCollection to the indicated output str...
get_curve
Returns the nth ParametricCurve in the collection.
void add_curve(ParametricCurve *curve)
Adds a new ParametricCurve to the collection.
bool adjust_hpr(PN_stdfloat t, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r)
Adjust the HPR curve at the indicated time to the new value.
bool evaluate_hpr(PN_stdfloat t, LVecBase3 &hpr) const
Computes only the HPR part of the curves.
void face_forward(PN_stdfloat segments_per_unit)
Discards the existing HPR curve and generates a new one that looks in the direction of travel along t...
bool stitch(const ParametricCurveCollection *a, const ParametricCurveCollection *b)
Regenerates this curve as one long curve: the first curve connected end-to- end with the second one.
get_xyz_curve
Returns the first XYZ curve in the collection, if any, or NULL if there are none.
get_timewarp_curve
Returns the nth timewarp curve in the collection.
get_num_curves
Returns the number of ParametricCurves in the collection.
int r_add_curves(PandaNode *node)
The recursive implementation of add_curves().
void register_drawer(ParametricCurveDrawer *drawer)
Registers a Drawer with this curve collection that will automatically be updated whenever the collect...
void make_even(PN_stdfloat max_t, PN_stdfloat segments_per_unit)
Discards all existing timewarp curves and recomputes a new timewarp curve that maps distance along th...
get_num_timewarps
Returns the number of timewarp curves in the collection.
PN_stdfloat evaluate_t(PN_stdfloat t) const
Determines the value of t that should be passed to the XYZ and HPR curves, after applying the given v...
bool write_egg(Filename filename, CoordinateSystem cs=CS_default)
Writes an egg description of all the nurbs curves in the collection to the specified output file.
remove_curve
Removes the indicated ParametricCurve from the collection.
void clear()
Removes all ParametricCurves from the collection.
set_curve
Replaces the indicated ParametricCurve from the collection, by its index number.
bool evaluate(PN_stdfloat t, LVecBase3 &xyz, LVecBase3 &hpr) const
Computes the position and rotation represented by the first XYZ and HPR curves in the collection at t...
void reset_max_t(PN_stdfloat max_t)
Adjusts the apparent length of the curve by applying a new timewarp that maps the range [0....
void output(std::ostream &out) const
Writes a brief one-line description of the ParametricCurveCollection to the indicated output stream.
get_hpr_curve
Returns the first HPR curve in the collection, if any, or NULL if there are none.
get_max_t
Returns the maximum T value associated with the *last* curve in the collection.
A virtual base class for parametric curves.
This is our own Panda specialization on the default STL list.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.