Panda3D
nurbsBasisVector.h
1 // Filename: nurbsBasisVector.h
2 // Created by: drose (03Dec02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef NURBSBASISVECTOR_H
16 #define NURBSBASISVECTOR_H
17 
18 #include "pandabase.h"
19 #include "luse.h"
20 #include "epvector.h"
21 #include "pmap.h"
22 
23 class NurbsVertex;
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : NurbsBasisVector
27 // Description : This encapsulates a series of matrices that are used
28 // to represent the sequential segments of a
29 // NurbsCurveEvaluator.
30 //
31 // This is not related to NurbsCurve, CubicCurveseg or
32 // any of the ParametricCurve-derived objects in this
33 // module. It is a completely parallel implementation
34 // of NURBS curves, and will probably eventually replace
35 // the whole ParametricCurve class hierarchy.
36 ////////////////////////////////////////////////////////////////////
37 class EXPCL_PANDA_PARAMETRICS NurbsBasisVector {
38 public:
39  INLINE NurbsBasisVector();
40  INLINE ~NurbsBasisVector();
41 
42  INLINE int get_order() const;
43 
44  INLINE int get_num_segments() const;
45  INLINE PN_stdfloat get_start_t() const;
46  INLINE PN_stdfloat get_end_t() const;
47 
48  INLINE int get_vertex_index(int segment) const;
49  INLINE PN_stdfloat get_from(int segment) const;
50  INLINE PN_stdfloat get_to(int segment) const;
51  INLINE const LMatrix4 &get_basis(int segment) const;
52  INLINE PN_stdfloat scale_t(int segment, PN_stdfloat t) const;
53 
54  void clear(int order);
55  void append_segment(int vertex_index, const PN_stdfloat knots[]);
56 
57  void transpose();
58 
59 private:
60  static LVecBase4 nurbs_blending_function(int order, int i, int j,
61  const PN_stdfloat knots[]);
62 
63 private:
64  int _order;
65 
66  class Segment {
67  public:
68  int _vertex_index;
69  PN_stdfloat _from;
70  PN_stdfloat _to;
71  LMatrix4 _basis;
72  };
73 
74  typedef epvector<Segment> Segments;
75  Segments _segments;
76 };
77 
78 #include "nurbsBasisVector.I"
79 
80 #endif
81 
This represents a single control vertex in a NurbsEvaluator.
Definition: nurbsVertex.h:36
This encapsulates a series of matrices that are used to represent the sequential segments of a NurbsC...
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:451
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111