Panda3D
nurbsVertex.cxx
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 nurbsVertex.cxx
10  * @author drose
11  * @date 2002-12-04
12  */
13 
14 #include "nurbsVertex.h"
15 
16 
17 /**
18  * Sets an n-dimensional vertex value. This allows definition of a NURBS
19  * surface or curve in a sparse n-dimensional space, typically used for
20  * associating additional properties (like color or joint membership) with
21  * each vertex of a surface.
22  *
23  * The value d is an arbitrary integer value and specifies the dimension of
24  * question for this particular vertex. Any number of dimensions may be
25  * specified, and they need not be consecutive. If a value for a given
26  * dimension is not specified, is it implicitly 0.0.
27  *
28  * The value is implicitly scaled by the homogenous weight value--that is, the
29  * fourth component of the value passed to set_vertex(). This means the
30  * ordinary vertex must be set first, before the extended vertices can be set.
31  */
32 void NurbsVertex::
33 set_extended_vertex(int d, PN_stdfloat value) {
34  _extended[d] = value * _vertex[3];
35 }
36 
37 /**
38  * Returns an n-dimensional vertex value. See set_extended_vertex(). This
39  * returns the value set for the indicated dimension, or 0.0 if nothing has
40  * been set.
41  */
42 PN_stdfloat NurbsVertex::
43 get_extended_vertex(int d) const {
44  Extended::const_iterator ei;
45  ei = _extended.find(d);
46  if (ei == _extended.end()) {
47  return 0.0f;
48  }
49  return (*ei).second;
50 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PN_stdfloat get_extended_vertex(int d) const
Returns an n-dimensional vertex value.
Definition: nurbsVertex.cxx:43
void set_extended_vertex(int d, PN_stdfloat value)
Sets an n-dimensional vertex value.
Definition: nurbsVertex.cxx:33