00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef NURBSCURVEEVALUATOR_H
00020 #define NURBSCURVEEVALUATOR_H
00021
00022 #include "pandabase.h"
00023 #include "nurbsMatrixVector.h"
00024 #include "nurbsCurveResult.h"
00025 #include "nurbsVertex.h"
00026 #include "pointerTo.h"
00027 #include "vector_float.h"
00028 #include "pvector.h"
00029 #include "nodePath.h"
00030 #include "referenceCount.h"
00031 #include "luse.h"
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 class EXPCL_PANDA NurbsCurveEvaluator : public ReferenceCount {
00049 PUBLISHED:
00050 NurbsCurveEvaluator();
00051 ~NurbsCurveEvaluator();
00052
00053 INLINE void set_order(int order);
00054 INLINE int get_order() const;
00055
00056 void reset(int num_vertices);
00057
00058 INLINE int get_num_vertices() const;
00059 INLINE void set_vertex(int i, const LVecBase4f &vertex);
00060 INLINE void set_vertex(int i, const LVecBase3f &vertex, float weight = 1.0);
00061 INLINE const LVecBase4f &get_vertex(int i) const;
00062
00063 INLINE void set_vertex_space(int i, const NodePath &space);
00064 INLINE void set_vertex_space(int i, const string &space);
00065 NodePath get_vertex_space(int i, const NodePath &rel_to) const;
00066
00067 INLINE int get_num_knots() const;
00068 void set_knot(int i, float knot);
00069 float get_knot(int i) const;
00070
00071 PT(NurbsCurveResult) evaluate(const NodePath &rel_to = NodePath()) const;
00072
00073 public:
00074 void get_vertices(pvector<LVecBase4f> &verts, const NodePath &rel_to) const;
00075 void get_vertices(pvector<LPoint3f> &verts, const NodePath &rel_to) const;
00076
00077 private:
00078 void recompute_knots();
00079 void recompute_basis();
00080
00081 int _order;
00082
00083 typedef pvector<NurbsVertex> Vertices;
00084 Vertices _vertices;
00085
00086 bool _knots_dirty;
00087 typedef vector_float Knots;
00088 Knots _knots;
00089
00090 bool _basis_dirty;
00091 NurbsMatrixVector _basis;
00092 };
00093
00094 #include "nurbsCurveEvaluator.I"
00095
00096 #endif
00097