14 #ifndef PARAMETRICCURVE_H 15 #define PARAMETRICCURVE_H 45 class ParametricCurveDrawer;
66 virtual bool is_valid()
const;
68 virtual PN_stdfloat get_max_t()
const;
70 void set_curve_type(
int type);
71 int get_curve_type()
const;
73 void set_num_dimensions(
int num);
74 int get_num_dimensions()
const;
76 PN_stdfloat calc_length()
const;
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);
87 virtual bool adjust_pt(PN_stdfloat t,
88 PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz,
89 PN_stdfloat tx, PN_stdfloat ty, PN_stdfloat tz);
91 virtual bool recompute();
95 bool write_egg(
Filename filename, CoordinateSystem cs = CS_default);
96 bool write_egg(std::ostream &out,
const Filename &filename, CoordinateSystem cs);
106 virtual bool get_bezier_segs(
BezierSegs &)
const;
107 virtual bool get_bezier_seg(
BezierSeg &)
const;
110 virtual bool convert_to_hermite(
HermiteCurve *hc)
const;
113 void register_drawer(ParametricCurveDrawer *drawer);
114 void unregister_drawer(ParametricCurveDrawer *drawer);
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());
161 return get_class_type();
163 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A basic node of the scene graph or data graph.
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.
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.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The name of a file, such as a texture file or an Egg file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A Nonuniform Rational B-Spline.
A single CV of a Hermite curve.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
virtual bool safe_to_transform() const
Returns true if it is generally safe to transform this particular kind of PandaNode by calling the xf...
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 ...