Debian Codegraph @

lib/database/src/so/nodes/SoNonIndexedShape.c++

raw symbols SCIP
1 /*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37 /*
38 * Copyright (C) 1990,91 Silicon Graphics, Inc.
39 *
40 _______________________________________________________________________
41 ______________ S I L I C O N G R A P H I C S I N C . ____________
42 |
43 | $Revision: 1.1.1.1 $
44 |
45 | Classes:
46 | SoNonIndexedShape
47 |
48 | Author(s) : Paul S. Strauss
49 |
50 ______________ S I L I C O N G R A P H I C S I N C . ____________
51 _______________________________________________________________________
52 */
53
54 #include <Inventor/actions/SoGetBoundingBoxAction.h>cxx . . $ `<file>/lib/database/include/Inventor/actions/SoGetBoundingBoxAction.h`/
55 #include <Inventor/elements/SoCoordinateElement.h>cxx . . $ `<file>/lib/database/include/Inventor/elements/SoCoordinateElement.h`/
56 #include <Inventor/nodes/SoNonIndexedShape.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoNonIndexedShape.h`/
57
58 SO_NODE_ABSTRACT_SOURCEcxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:245:9`!(SoNonIndexedShape);
59
60 ////////////////////////////////////////////////////////////////////////
61 //
62 // Description:
63 // Constructor
64 //
65 // Use: protected
66
67 SoNonIndexedShapecxx . . $ SoNonIndexedShape#::SoNonIndexedShapecxx . . $ SoNonIndexedShape#SoNonIndexedShape(49f6e7a06ebc5aa8).()
68 //
69 ////////////////////////////////////////////////////////////////////////
70 {
71 SO_NODE_CONSTRUCTORcxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:309:9`!(SoNonIndexedShape);
72
73 SO_NODE_ADD_FIELDcxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:346:9`!(startIndex, (0));
74 }
75
76 ////////////////////////////////////////////////////////////////////////
77 //
78 // Description:
79 // Destructor
80 //
81 // Use: private
82
83 SoNonIndexedShapecxx . . $ SoNonIndexedShape#::~cxx . . $ SoNonIndexedShape#`~SoNonIndexedShape`(49f6e7a06ebc5aa8).SoNonIndexedShapecxx . . $ SoNonIndexedShape#()
84 //
85 ////////////////////////////////////////////////////////////////////////
86 {
87 }
88
89 ////////////////////////////////////////////////////////////////////////
90 //
91 // Description:
92 // This is a convenience method to simplify the job of computing
93 // bounding boxes for subclasses; it can be called from a
94 // subclass's computeBBox() method. It sets the given bounding box
95 // to contain all vertices of the shape, assuming that the shape
96 // uses the numVertices coordinates beginning at the value in
97 // startIndex. (If numVertices is negative, it uses all coordinates
98 // from startIndex on.) It also sets the center to the average of
99 // the vertices' coordinates.
100 //
101 // Use: protected
102
103 void
104 SoNonIndexedShapecxx . . $ SoNonIndexedShape#::computeCoordBBoxcxx . . $ SoNonIndexedShape#computeCoordBBox(2769771dd057e03a).(SoActioncxx . . $ SoAction# *action, int numVertices,
105 SbBox3fcxx . . $ SbBox3f# &box, SbVec3fcxx . . $ SbVec3f# &center)
106 //
107 ////////////////////////////////////////////////////////////////////////
108 {
109 int32_tcxx . . $ int32_t# i, lastIndex;
110 const SoCoordinateElementcxx . . $ SoCoordinateElement# *ce = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
111 const SbVec3fcxx . . $ SbVec3f# *vpCoords = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
112
113 SoVertexPropertycxx . . $ SoVertexProperty# *vp = (SoVertexPropertycxx . . $ SoVertexProperty# *)vertexPropertycxx . . $ SoVertexShape#vertexProperty..getValuecxx . . $ SoSFNode#getValue(b794963b450d51b3).();
114 if (vp && vp->vertexcxx . . $ SoVertexProperty#vertex..getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).() > 0) {
115 vpCoords = vp->vertexcxx . . $ SoVertexProperty#vertex..getValuescxx . . $ SoMFVec3f#getValues(aa6f7bb3bba6ed95).(0);
116 } else {
117 ce = SoCoordinateElementcxx . . $ SoCoordinateElement#::getInstancecxx . . $ SoCoordinateElement#getInstance(297609619ca4e687).(action->getStatecxx . . $ SoAction#getState(5c8eb8fe6550a03).());
118 }
119
120 // Start with an empty box and zero sum
121 center.setValuecxx . . $ SbVec3f#setValue(4e87f9d875f2d08d).(0.0, 0.0, 0.0);
122 box.makeEmptycxx . . $ SbBox3f#makeEmpty(49f6e7a06ebc5aa8).();
123
124 // Loop through coordinates, keeping max bounding box and sum of coords
125 i = startIndexcxx . . $ SoNonIndexedShape#startIndex..getValuecxx . . $ SoSFInt32#getValue(455f465bc33b4cdf).();
126 if (numVertices < 0) {
127 lastIndex = (ce ? ce->getNumcxx . . $ SoCoordinateElement#getNum(455f465bc33b4cdf).() - 1 : vp->vertexcxx . . $ SoVertexProperty#vertex..getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).() - 1);
128 numVertices = (int) (lastIndex - i + 1);
129 }
130 else
131 lastIndex = i + numVertices - 1;
132
133 while (i <= lastIndex) {
134
135 const SbVec3fcxx . . $ SbVec3f# &v = (ce ? ce->get3cxx . . $ SoCoordinateElement#get3(e550528ef0703ba8).((int) i) : vpCoords[i]);
136
137 box.extendBycxx . . $ SbBox3f#extendBy(65a601b9d70571d6).(v);
138 center +=cxx . . $ SbVec3f#`operator+=`(13422326b1abca17). v;
139
140 i++;
141 }
142
143 // The center point is the average of the vertices
144 center /=cxx . . $ SbVec3f#`operator/=`(3aaca777b5795e29). (float) numVertices;
145 }
146