Debian Codegraph @

lib/database/src/so/fields/SoMFRotation.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 | SoMFRotation
47 |
48 | Author(s) : Ronen Barzel
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/fields/SoMFRotation.h>cxx . . $ `<file>/lib/database/include/Inventor/fields/SoMFRotation.h`/
55 #include <cstdlib>
56
57 //////////////////////////////////////////////////////////////////////////////
58 //
59 // SoMFRotation class
60 //
61 //////////////////////////////////////////////////////////////////////////////
62
63 // Use standard definitions of all basic methods
64 SO_MFIELD_SOURCE_MALLOCcxx . . $ `lib/database/include/Inventor/fields/SoSubField.h:779:9`!(SoMFRotation, SbRotation, const SbRotation &);
65
66 ////////////////////////////////////////////////////////////////////////
67 //
68 // Description:
69 // Sets values from array of arrays of 4 floats. This can be useful
70 // in some applications that have quaternions stored in this manner and
71 // want to keep them that way for efficiency.
72 //
73 // Use: public
74
75 void
76 SoMFRotationcxx . . $ SoMFRotation#::setValuescxx . . $ SoMFRotation#setValues(3a781bccea05f3f1).(int start, // Starting index
77 int num, // Number of values to set
78 const float q[][4]) // Array of quaternion values
79 //
80 ////////////////////////////////////////////////////////////////////////
81 {
82 int newNum = start + num;
83 int i;
84
85 if (newNum > getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).())
86 makeRoomcxx . . $ SoMField#makeRoom(d4f767463ce0a6b3).(newNum);
87
88 for (i = 0; i < num; i++)
89 valuescxx . . $ SoMFRotation#values.[start + i].setValuecxx . . $ SbRotation#setValue(35b457a68b231c7a).(q[i]);
90
91 valueChangedcxx . . $ SoField#valueChanged(d4f767463ce0a6b3).();
92 }
93
94 ////////////////////////////////////////////////////////////////////////
95 //
96 // Description:
97 // Sets one quaternion value from 4 separate floats. (Convenience function)
98 //
99 // Use: public
100
101 void
102 SoMFRotationcxx . . $ SoMFRotation#::set1Valuecxx . . $ SoMFRotation#set1Value(c31bc224e645f73e).(int index, float q0, float q1, float q2, float q3)
103 //
104 ////////////////////////////////////////////////////////////////////////
105 {
106 set1Valuecxx . . $ SoMFRotation#set1Value(18c34a5f0e8b9b19).(index, SbRotationcxx . . $ SbRotation#SbRotation(7e9a355db6148521).(q0, q1, q2, q3));
107 }
108
109 ////////////////////////////////////////////////////////////////////////
110 //
111 // Description:
112 // Sets one quaternion value from an array of 4 floats. (Convenience function)
113 //
114 // Use: public
115
116 void
117 SoMFRotationcxx . . $ SoMFRotation#::set1Valuecxx . . $ SoMFRotation#set1Value(cec8aedf3e6a9b90).(int index, const float q[4])
118 //
119 ////////////////////////////////////////////////////////////////////////
120 {
121 set1Valuecxx . . $ SoMFRotation#set1Value(18c34a5f0e8b9b19).(index, SbRotationcxx . . $ SbRotation#SbRotation(de58861cad56015a).(q));
122 }
123
124 ////////////////////////////////////////////////////////////////////////
125 //
126 // Description:
127 // Sets one rotation value from an axis and angle. (Convenience function)
128 //
129 // Use: public
130
131 void
132 SoMFRotationcxx . . $ SoMFRotation#::set1Valuecxx . . $ SoMFRotation#set1Value(7e25b7167a2d992d).(int index, const SbVec3fcxx . . $ SbVec3f# &axis, float angle)
133 //
134 ////////////////////////////////////////////////////////////////////////
135 {
136 set1Valuecxx . . $ SoMFRotation#set1Value(18c34a5f0e8b9b19).(index, SbRotationcxx . . $ SbRotation#SbRotation(91fd4afec15735a5).(axis, angle));
137 }
138
139 ////////////////////////////////////////////////////////////////////////
140 //
141 // Description:
142 // Sets to one quaternion value from 4 separate floats. (Convenience function)
143 //
144 // Use: public
145
146 void
147 SoMFRotationcxx . . $ SoMFRotation#::setValuecxx . . $ SoMFRotation#setValue(7e9a355db6148521).(float q0, float q1, float q2, float q3)
148 //
149 ////////////////////////////////////////////////////////////////////////
150 {
151 setValuecxx . . $ SoMFRotation#setValue(8b1048b3fc01a89c).(SbRotationcxx . . $ SbRotation#SbRotation(7e9a355db6148521).(q0, q1, q2, q3));
152 }
153
154 ////////////////////////////////////////////////////////////////////////
155 //
156 // Description:
157 // Sets to one quaternion value from an array of 4 floats. (Convenience function)
158 //
159 // Use: public
160
161 void
162 SoMFRotationcxx . . $ SoMFRotation#::setValuecxx . . $ SoMFRotation#setValue(de58861cad56015a).(const float q[4])
163 //
164 ////////////////////////////////////////////////////////////////////////
165 {
166 setValuecxx . . $ SoMFRotation#setValue(8b1048b3fc01a89c).(SbRotationcxx . . $ SbRotation#SbRotation(de58861cad56015a).(q));
167 }
168
169 ////////////////////////////////////////////////////////////////////////
170 //
171 // Description:
172 // Sets to one rotation value from an axis and angle. (Convenience function)
173 //
174 // Use: public
175
176 void
177 SoMFRotationcxx . . $ SoMFRotation#::setValuecxx . . $ SoMFRotation#setValue(91fd4afec15735a5).(const SbVec3fcxx . . $ SbVec3f# &axis, float angle)
178 //
179 ////////////////////////////////////////////////////////////////////////
180 {
181 setValuecxx . . $ SoMFRotation#setValue(8b1048b3fc01a89c).(SbRotationcxx . . $ SbRotation#SbRotation(91fd4afec15735a5).(axis, angle));
182 }
183
184 ////////////////////////////////////////////////////////////////////////
185 //
186 // Description:
187 // Reads one (indexed) value from file. Returns FALSE on error.
188 //
189 // Use: private
190
191 SbBoolcxx . . $ SbBool#
192 SoMFRotationcxx . . $ SoMFRotation#::read1Valuecxx . . $ SoMFRotation#read1Value(b57125c54eeea43).(SoInputcxx . . $ SoInput# *in, int index)
193 //
194 ////////////////////////////////////////////////////////////////////////
195 {
196 SbVec3fcxx . . $ SbVec3f# axiscxx . . $ SbVec3f#SbVec3f(49f6e7a06ebc5aa8).;
197 float angle;
198
199 if (! (in->readcxx . . $ SoInput#read(5ae595678d7a9e77).(axis[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0]) &&
200 in->readcxx . . $ SoInput#read(5ae595678d7a9e77).(axis[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1]) &&
201 in->readcxx . . $ SoInput#read(5ae595678d7a9e77).(axis[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2]) &&
202 in->readcxx . . $ SoInput#read(5ae595678d7a9e77).(angle)))
203 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
204
205 set1Valuecxx . . $ SoMFRotation#set1Value(7e25b7167a2d992d).(index, axis, angle);
206
207 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
208 }
209
210 ////////////////////////////////////////////////////////////////////////
211 //
212 // Description:
213 // Writes one (indexed) value to file.
214 //
215 // Use: private
216
217 void
218 SoMFRotationcxx . . $ SoMFRotation#::write1Valuecxx . . $ SoMFRotation#write1Value(73cc401f7e0a390c).(SoOutputcxx . . $ SoOutput# *out, int index) const
219 //
220 ////////////////////////////////////////////////////////////////////////
221 {
222 SbVec3fcxx . . $ SbVec3f# axiscxx . . $ SbVec3f#SbVec3f(49f6e7a06ebc5aa8).;
223 float angle;
224
225 valuescxx . . $ SoMFRotation#values.[index].getValuecxx . . $ SbRotation#getValue(6c5f31d1454285f0).(axis, angle);
226
227 out->writecxx . . $ SoOutput#write(9364e6e7bff7660).(axis[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).0]);
228
229 if (! out->isBinarycxx . . $ SoOutput#isBinary(455f465bc33b4cdf).())
230 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
231
232 out->writecxx . . $ SoOutput#write(9364e6e7bff7660).(axis[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).1]);
233
234 if (! out->isBinarycxx . . $ SoOutput#isBinary(455f465bc33b4cdf).())
235 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
236
237 out->writecxx . . $ SoOutput#write(9364e6e7bff7660).(axis[cxx . . $ SbVec3f#`operator[]`(5dbdaf238659ae67).2]);
238
239 if (! out->isBinarycxx . . $ SoOutput#isBinary(455f465bc33b4cdf).()) {
240 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
241 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
242 }
243
244 out->writecxx . . $ SoOutput#write(9364e6e7bff7660).(angle);
245 }