Panda3D
nurbsVertex.I
1 // Filename: nurbsVertex.I
2 // Created by: drose (04Dec02)
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 
16 ////////////////////////////////////////////////////////////////////
17 // Function: NurbsVertex::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE NurbsVertex::
22 NurbsVertex() {
23  _vertex.set(0, 0, 0, 1);
24 }
25 
26 ////////////////////////////////////////////////////////////////////
27 // Function: NurbsVertex::Copy Constructor
28 // Access: Public
29 // Description:
30 ////////////////////////////////////////////////////////////////////
31 INLINE NurbsVertex::
32 NurbsVertex(const NurbsVertex &copy) :
33  _vertex(copy._vertex),
34  _space(copy._space),
35  _space_path(copy._space_path)
36 {
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: NurbsVertex::Copy Assignment Operator
41 // Access: Public
42 // Description:
43 ////////////////////////////////////////////////////////////////////
44 INLINE void NurbsVertex::
45 operator = (const NurbsVertex &copy) {
46  _vertex = copy._vertex;
47  _space = copy._space;
48  _space_path = copy._space_path;
49 }
50 
51 ////////////////////////////////////////////////////////////////////
52 // Function: NurbsVertex::Destructor
53 // Access: Public
54 // Description:
55 ////////////////////////////////////////////////////////////////////
56 INLINE NurbsVertex::
57 ~NurbsVertex() {
58 }
59 
60 ////////////////////////////////////////////////////////////////////
61 // Function: NurbsVertex::set_vertex
62 // Access: Public
63 // Description:
64 ////////////////////////////////////////////////////////////////////
65 INLINE void NurbsVertex::
66 set_vertex(const LVecBase4 &vertex) {
67  _vertex = vertex;
68 }
69 
70 ////////////////////////////////////////////////////////////////////
71 // Function: NurbsVertex::get_vertex
72 // Access: Public
73 // Description:
74 ////////////////////////////////////////////////////////////////////
75 INLINE const LVecBase4 &NurbsVertex::
76 get_vertex() const {
77  return _vertex;
78 }
79 
80 ////////////////////////////////////////////////////////////////////
81 // Function: NurbsVertex::set_space
82 // Access: Public
83 // Description: Sets the space of this vertex as a fixed NodePath.
84 ////////////////////////////////////////////////////////////////////
85 INLINE void NurbsVertex::
86 set_space(const NodePath &space) {
87  _space = space;
88  _space_path = string();
89 }
90 
91 ////////////////////////////////////////////////////////////////////
92 // Function: NurbsVertex::set_space
93 // Access: Public
94 // Description: Sets the space of this vertex as a relative path from
95 // the rel_to node.
96 ////////////////////////////////////////////////////////////////////
97 INLINE void NurbsVertex::
98 set_space(const string &space) {
99  _space = NodePath();
100  _space_path = space;
101 }
102 
103 ////////////////////////////////////////////////////////////////////
104 // Function: NurbsVertex::get_space
105 // Access: Public
106 // Description:
107 ////////////////////////////////////////////////////////////////////
108 INLINE NodePath NurbsVertex::
109 get_space(const NodePath &rel_to) const {
110  if (_space_path.empty()) {
111  return _space;
112  } else {
113  return rel_to.find(_space_path);
114  }
115 }
This represents a single control vertex in a NurbsEvaluator.
Definition: nurbsVertex.h:36
NodePath find(const string &path) const
Searches for a node below the referenced node that matches the indicated string.
Definition: nodePath.cxx:434
void set_space(const NodePath &space)
Sets the space of this vertex as a fixed NodePath.
Definition: nurbsVertex.I:86
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165