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