15 #ifndef PARAMETRICCURVE_H
16 #define PARAMETRICCURVE_H
18 #include "pandabase.h"
20 #include "pandaNode.h"
47 class ParametricCurveDrawer;
70 virtual bool is_valid()
const;
72 virtual PN_stdfloat get_max_t()
const;
74 void set_curve_type(
int type);
75 int get_curve_type()
const;
77 void set_num_dimensions(
int num);
78 int get_num_dimensions()
const;
80 PN_stdfloat calc_length()
const;
81 PN_stdfloat calc_length(PN_stdfloat from, PN_stdfloat to)
const;
82 PN_stdfloat find_length(PN_stdfloat start_t, PN_stdfloat length_offset)
const;
84 virtual bool get_point(PN_stdfloat t,
LVecBase3 &point)
const=0;
85 virtual bool get_tangent(PN_stdfloat t,
LVecBase3 &tangent)
const=0;
87 virtual bool get_2ndtangent(PN_stdfloat t,
LVecBase3 &tangent2)
const=0;
89 virtual bool adjust_point(PN_stdfloat t, PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz);
90 virtual bool adjust_tangent(PN_stdfloat t, PN_stdfloat tx, PN_stdfloat ty, PN_stdfloat tz);
91 virtual bool adjust_pt(PN_stdfloat t,
92 PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz,
93 PN_stdfloat tx, PN_stdfloat ty, PN_stdfloat tz);
95 virtual bool recompute();
99 bool write_egg(
Filename filename, CoordinateSystem cs = CS_default);
100 bool write_egg(ostream &out,
const Filename &filename, CoordinateSystem cs);
110 virtual bool get_bezier_segs(
BezierSegs &)
const;
111 virtual bool get_bezier_seg(
BezierSeg &)
const;
114 virtual bool convert_to_hermite(
HermiteCurve *hc)
const;
117 void register_drawer(ParametricCurveDrawer *drawer);
118 void unregister_drawer(ParametricCurveDrawer *drawer);
121 void invalidate(PN_stdfloat t1, PN_stdfloat t2);
122 void invalidate_all();
124 virtual bool format_egg(ostream &out,
const string &name,
125 const string &curve_type,
int indent_level)
const;
128 PN_stdfloat r_calc_length(PN_stdfloat t1, PN_stdfloat t2,
130 PN_stdfloat seglength)
const;
131 bool r_find_length(PN_stdfloat target_length, PN_stdfloat &found_t,
132 PN_stdfloat t1, PN_stdfloat t2,
134 PN_stdfloat &seglength)
const;
135 bool r_find_t(PN_stdfloat target_length, PN_stdfloat &found_t,
136 PN_stdfloat t1, PN_stdfloat t2,
138 bool find_t_linear(PN_stdfloat target_length, PN_stdfloat &found_t,
139 PN_stdfloat t1, PN_stdfloat t2,
159 static void init_type() {
160 PandaNode::init_type();
161 register_type(_type_handle,
"ParametricCurve",
162 PandaNode::get_class_type());
165 return get_class_type();
167 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
A basic node of the scene graph or data graph.
This is the base class for all three-component vectors and points.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
A virtual base class for parametric curves.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This abstract class defines the interface only for a Nurbs-style curve, with knots and coordinates in...
A parametric curve defined by a sequence of control vertices, each with an in and out tangent...
This is our own Panda specialization on the default STL vector.
The name of a file, such as a texture file or an Egg file.
virtual bool safe_to_transform() const
Returns true if it is generally safe to transform this particular kind of PandaNode by calling the xf...
A Nonuniform Rational B-Spline.
A single CV of a Hermite curve.
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
virtual bool safe_to_flatten() const
Returns true if it is generally safe to flatten out this particular kind of PandaNode by duplicating ...