14 #ifndef CUBICCURVESEG_H
15 #define CUBICCURVESEG_H
26 #define RT_TANGENT 0x02
28 #define RT_BASE_TYPE 0xff
30 #define RT_KEEP_ORIG 0x100
52 virtual bool get_point(PN_stdfloat t, LVecBase3 &point)
const;
53 virtual bool get_tangent(PN_stdfloat t, LVecBase3 &tangent)
const;
54 virtual bool get_pt(PN_stdfloat t, LVecBase3 &point, LVecBase3 &tangent)
const;
55 virtual bool get_2ndtangent(PN_stdfloat t, LVecBase3 &tangent2)
const;
61 CubicCurveseg(
int order,
const PN_stdfloat knots[],
const LVecBase4 cvs[]);
67 PN_stdfloat tlength = 1.0f);
69 void nurbs_basis(
int order,
const PN_stdfloat knots[],
const LVecBase4 cvs[]);
83 void evaluate_point(
const LVecBase4 &tv, LVecBase3 &result)
const {
84 PN_stdfloat recip_h = (rational) ? 1.0f/tv.dot(Bw) : 1.0f;
85 result.set(tv.dot(Bx) * recip_h,
87 tv.dot(Bz) * recip_h);
90 void evaluate_vector(
const LVecBase4 &tv, LVecBase3 &result)
const {
91 result.set(tv.dot(Bx),
98 static bool compute_seg(
int rtype0, PN_stdfloat t0,
const LVecBase4 &v0,
99 int rtype1, PN_stdfloat t1,
const LVecBase4 &v1,
100 int rtype2, PN_stdfloat t2,
const LVecBase4 &v2,
101 int rtype3, PN_stdfloat t3,
const LVecBase4 &v3,
106 LVecBase4 Bx, By, Bz, Bw;
123 static void init_type() {
124 ParametricCurve::init_type();
126 ParametricCurve::get_class_type());
129 return get_class_type();
131 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
139 void compute_nurbs_basis(
int order,
140 const PN_stdfloat knots_in[],