14#ifndef PARAMETRICCURVE_H
15#define PARAMETRICCURVE_H
45class ParametricCurveDrawer;
77 PN_stdfloat
calc_length(PN_stdfloat from, PN_stdfloat to)
const;
78 PN_stdfloat
find_length(PN_stdfloat start_t, PN_stdfloat length_offset)
const;
80 virtual bool get_point(PN_stdfloat t, LVecBase3 &point)
const=0;
81 virtual bool get_tangent(PN_stdfloat t, LVecBase3 &tangent)
const=0;
82 virtual bool get_pt(PN_stdfloat t, LVecBase3 &point, LVecBase3 &tangent)
const=0;
83 virtual bool get_2ndtangent(PN_stdfloat t, LVecBase3 &tangent2)
const=0;
85 virtual bool adjust_point(PN_stdfloat t, PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz);
86 virtual bool adjust_tangent(PN_stdfloat t, PN_stdfloat tx, PN_stdfloat ty, PN_stdfloat tz);
88 PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz,
89 PN_stdfloat tx, PN_stdfloat ty, PN_stdfloat tz);
104 typedef pvector<BezierSeg> BezierSegs;
117 void invalidate(PN_stdfloat t1, PN_stdfloat t2);
118 void invalidate_all();
120 virtual bool format_egg(std::ostream &out,
const std::string &name,
121 const std::string &curve_type,
int indent_level)
const;
124 PN_stdfloat r_calc_length(PN_stdfloat t1, PN_stdfloat t2,
125 const LPoint3 &p1,
const LPoint3 &p2,
126 PN_stdfloat seglength)
const;
127 bool r_find_length(PN_stdfloat target_length, PN_stdfloat &found_t,
128 PN_stdfloat t1, PN_stdfloat t2,
129 const LPoint3 &p1,
const LPoint3 &p2,
130 PN_stdfloat &seglength)
const;
131 bool r_find_t(PN_stdfloat target_length, PN_stdfloat &found_t,
132 PN_stdfloat t1, PN_stdfloat t2,
133 const LPoint3 &p1,
const LPoint3 &p2)
const;
134 bool find_t_linear(PN_stdfloat target_length, PN_stdfloat &found_t,
135 PN_stdfloat t1, PN_stdfloat t2,
136 const LPoint3 &p1,
const LPoint3 &p2)
const;
155 static void init_type() {
156 PandaNode::init_type();
158 PandaNode::get_class_type());
160 virtual TypeHandle get_type()
const {
161 return get_class_type();
163 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
166 static TypeHandle _type_handle;
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
The name of a file, such as a texture file or an Egg file.
A single CV of a Hermite curve.
A parametric curve defined by a sequence of control vertices, each with an in and out tangent.
This abstract class defines the interface only for a Nurbs-style curve, with knots and coordinates in...
A Nonuniform Rational B-Spline.
virtual bool safe_to_transform() const
Returns true if it is generally safe to transform this particular kind of PandaNode by calling the xf...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
virtual bool safe_to_flatten() const
Returns true if it is generally safe to flatten out this particular kind of PandaNode by duplicating ...
virtual bool adjust_pt(PN_stdfloat t, PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat tx, PN_stdfloat ty, PN_stdfloat tz)
Recomputes the curve such that it passes through the point (px, py, pz) with the tangent (tx,...
virtual bool adjust_tangent(PN_stdfloat t, PN_stdfloat tx, PN_stdfloat ty, PN_stdfloat tz)
Recomputes the curve such that it has the tangent (tx, ty, tz) at time t, but keeps the same position...
PN_stdfloat calc_length() const
Approximates the length of the entire curve to within a few decimal places.
int get_curve_type() const
Returns the flag indicating the use to which the curve is intended to be put.
virtual bool recompute()
Recalculates the curve, if necessary.
int get_num_dimensions() const
Returns the number of significant dimensions in the curve's vertices, as set by a previous call to se...
virtual bool convert_to_nurbs(ParametricCurve *nc) const
Stores in the indicated NurbsCurve a NURBS representation of an equivalent curve.
virtual NurbsCurveInterface * get_nurbs_interface()
Returns a pointer to the object as a NurbsCurveInterface object if it happens to be a NURBS-style cur...
virtual bool get_bezier_seg(BezierSeg &) const
Fills the BezierSeg structure with a description of the curve segment as a Bezier,...
virtual bool get_bezier_segs(BezierSegs &) const
Fills up the indicated vector with a list of BezierSeg structs that describe the curve.
ParametricCurve()
This is a virtual base class.
virtual bool adjust_point(PN_stdfloat t, PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz)
Recomputes the curve such that it passes through the point (px, py, pz) at time t,...
virtual PN_stdfloat get_max_t() const
Returns the upper bound of t for the entire curve.
void set_curve_type(int type)
Sets the flag indicating the use to which the curve is intended to be put.
virtual bool is_valid() const
Returns true if the curve is defined.
void register_drawer(ParametricCurveDrawer *drawer)
Registers a Drawer with this curve that will automatically be updated whenever the curve is modified,...
bool write_egg(Filename filename, CoordinateSystem cs=CS_default)
Writes an egg description of the nurbs curve to the specified output file.
void set_num_dimensions(int num)
Specifies the number of significant dimensions in the curve's vertices.
virtual bool stitch(const ParametricCurve *a, const ParametricCurve *b)
Regenerates this curve as one long curve: the first curve connected end-to- end with the second one.
void unregister_drawer(ParametricCurveDrawer *drawer)
Removes a previously registered drawer from the list of automatically- refreshed drawers.
virtual bool convert_to_hermite(HermiteCurve *hc) const
Stores an equivalent curve representation in the indicated Hermite curve, if possible.
PN_stdfloat find_length(PN_stdfloat start_t, PN_stdfloat length_offset) const
Returns the parametric value corresponding to the indicated distance along the curve from the startin...
TypeHandle is the identifier used to differentiate C++ class types.
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.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.