diff options
author | Jacek Antonelli | 2008-08-15 23:44:56 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:56 -0500 |
commit | c07901e29ed545bbb02e3bddf148fe1104b94e9f (patch) | |
tree | f1ada64ce834acd7d92a425efb96c4b86bcf16b1 /linden/indra/test/v2math_tut.cpp | |
parent | Second Life viewer sources 1.15.0.2 (diff) | |
download | meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.zip meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.gz meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.bz2 meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.xz |
Second Life viewer sources 1.15.1.3
Diffstat (limited to 'linden/indra/test/v2math_tut.cpp')
-rw-r--r-- | linden/indra/test/v2math_tut.cpp | 447 |
1 files changed, 447 insertions, 0 deletions
diff --git a/linden/indra/test/v2math_tut.cpp b/linden/indra/test/v2math_tut.cpp new file mode 100644 index 0000000..e94a19b --- /dev/null +++ b/linden/indra/test/v2math_tut.cpp | |||
@@ -0,0 +1,447 @@ | |||
1 | /** | ||
2 | * @file v2math_tut.cpp | ||
3 | * @author Adroit | ||
4 | * @date February 2007 | ||
5 | * @brief v2math test cases. | ||
6 | * | ||
7 | * Copyright (c) 2007-2007, Linden Research, Inc. | ||
8 | * | ||
9 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
10 | * to you under the terms of the GNU General Public License, version 2.0 | ||
11 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
12 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
13 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
14 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
15 | * | ||
16 | * There are special exceptions to the terms and conditions of the GPL as | ||
17 | * it is applied to this Source Code. View the full text of the exception | ||
18 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
19 | * online at http://secondlife.com/developers/opensource/flossexception | ||
20 | * | ||
21 | * By copying, modifying or distributing this software, you acknowledge | ||
22 | * that you have read and understood your obligations described above, | ||
23 | * and agree to abide by those obligations. | ||
24 | * | ||
25 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
26 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
27 | * COMPLETENESS OR PERFORMANCE. | ||
28 | */ | ||
29 | |||
30 | #include <tut/tut.h> | ||
31 | #include "lltut.h" | ||
32 | #include "linden_common.h" | ||
33 | #include "v2math.h" | ||
34 | |||
35 | |||
36 | namespace tut | ||
37 | { | ||
38 | struct v2math_data | ||
39 | { | ||
40 | }; | ||
41 | typedef test_group<v2math_data> v2math_test; | ||
42 | typedef v2math_test::object v2math_object; | ||
43 | tut::v2math_test v2math_testcase("v2math"); | ||
44 | |||
45 | template<> template<> | ||
46 | void v2math_object::test<1>() | ||
47 | { | ||
48 | LLVector2 vec2; | ||
49 | ensure("LLVector2:Fail to initialize ", (0.f == vec2.mV[VX] && 0.f == vec2.mV[VY])); | ||
50 | |||
51 | F32 x =2.0f, y = 3.2f ; | ||
52 | LLVector2 vec3(x,y); | ||
53 | ensure("LLVector2(F32 x, F32 y):Fail to initialize ", (x == vec3.mV[VX]) && (y == vec3.mV[VY])); | ||
54 | |||
55 | const F32 vec[2] = {3.2f, 4.5f}; | ||
56 | LLVector2 vec4(vec); | ||
57 | ensure("LLVector2(const F32 *vec):Fail to initialize ", (vec[0] == vec4.mV[VX]) && (vec[1] == vec4.mV[VY])); | ||
58 | |||
59 | vec4.clearVec(); | ||
60 | ensure("clearVec():Fail to clean the values ", (0.f == vec4.mV[VX] && 0.f == vec4.mV[VY])); | ||
61 | |||
62 | vec3.zeroVec(); | ||
63 | ensure("zeroVec():Fail to fill the zero ", (0.f == vec3.mV[VX] && 0.f == vec3.mV[VY])); | ||
64 | } | ||
65 | |||
66 | template<> template<> | ||
67 | void v2math_object::test<2>() | ||
68 | { | ||
69 | F32 x = 123.356f, y = 2387.453f; | ||
70 | LLVector2 vec2,vec3; | ||
71 | vec2.setVec(x, y); | ||
72 | ensure("1:setVec: Fail ", (x == vec2.mV[VX]) && (y == vec2.mV[VY])); | ||
73 | |||
74 | vec3.setVec(vec2); | ||
75 | ensure("2:setVec: Fail " ,(vec2 == vec3)); | ||
76 | |||
77 | vec3.zeroVec(); | ||
78 | const F32 vec[2] = {3.24653f, 457653.4f}; | ||
79 | vec3.setVec(vec); | ||
80 | ensure("3:setVec: Fail ", (vec[0] == vec3.mV[VX]) && (vec[1] == vec3.mV[VY])); | ||
81 | } | ||
82 | |||
83 | template<> template<> | ||
84 | void v2math_object::test<3>() | ||
85 | { | ||
86 | F32 x = 2.2345f, y = 3.5678f ; | ||
87 | LLVector2 vec2(x,y); | ||
88 | ensure("magVecSquared:Fail ", is_approx_equal(vec2.magVecSquared(), (x*x + y*y))); | ||
89 | ensure("magVec:Fail ", is_approx_equal(vec2.magVec(), fsqrtf(x*x + y*y))); | ||
90 | } | ||
91 | |||
92 | template<> template<> | ||
93 | void v2math_object::test<4>() | ||
94 | { | ||
95 | F32 x =-2.0f, y = -3.0f ; | ||
96 | LLVector2 vec2(x,y); | ||
97 | ensure("abs():Fail ", TRUE == vec2.abs() && is_approx_equal(x, 2.f) && is_approx_equal(y, 3.f)); | ||
98 | |||
99 | ensure("isNull():Fail ", FALSE == vec2.isNull()); //Returns TRUE if vector has a _very_small_ length | ||
100 | |||
101 | x =.00000001f, y = .000001001f; | ||
102 | vec2.setVec(x, y); | ||
103 | ensure("isNull(): Fail ", TRUE == vec2.isNull()); | ||
104 | } | ||
105 | |||
106 | template<> template<> | ||
107 | void v2math_object::test<5>() | ||
108 | { | ||
109 | F32 x =1.f, y = 2.f; | ||
110 | LLVector2 vec2(x, y), vec3; | ||
111 | vec3 = vec3.scaleVec(vec2); | ||
112 | ensure("scaleVec: Fail ", vec3.mV[VX] == 0. && vec3.mV[VY] == 0.); | ||
113 | ensure("isExactlyZero(): Fail", TRUE == vec3.isExactlyZero()); | ||
114 | |||
115 | vec3.setVec(2.f, 1.f); | ||
116 | vec3 = vec3.scaleVec(vec2); | ||
117 | ensure("scaleVec: Fail ", (2.f == vec3.mV[VX]) && (2.f == vec3.mV[VY])); | ||
118 | ensure("isExactlyZero():Fail", FALSE == vec3.isExactlyZero()); | ||
119 | } | ||
120 | |||
121 | template<> template<> | ||
122 | void v2math_object::test<6>() | ||
123 | { | ||
124 | F32 x1 =1.f, y1 = 2.f, x2 = -2.3f, y2 = 1.11f; | ||
125 | F32 val1, val2; | ||
126 | LLVector2 vec2(x1, y1), vec3(x2, y2), vec4; | ||
127 | vec4 = vec2 + vec3 ; | ||
128 | val1 = x1+x2; | ||
129 | val2 = y1+y2; | ||
130 | ensure("1:operator+ failed",(val1 == vec4.mV[VX]) && ((val2 == vec4.mV[VY]))); | ||
131 | |||
132 | vec2.clearVec(); | ||
133 | vec3.clearVec(); | ||
134 | x1 = -.235f, y1 = -24.32f, x2 = -2.3f, y2 = 1.f; | ||
135 | vec2.setVec(x1, y1); | ||
136 | vec3.setVec(x2, y2); | ||
137 | vec4 = vec2 + vec3; | ||
138 | val1 = x1+x2; | ||
139 | val2 = y1+y2; | ||
140 | ensure("2:operator+ failed",(val1 == vec4.mV[VX]) && ((val2 == vec4.mV[VY]))); | ||
141 | } | ||
142 | |||
143 | template<> template<> | ||
144 | void v2math_object::test<7>() | ||
145 | { | ||
146 | F32 x1 =1.f, y1 = 2.f, x2 = -2.3f, y2 = 1.11f; | ||
147 | F32 val1, val2; | ||
148 | LLVector2 vec2(x1, y1), vec3(x2, y2), vec4; | ||
149 | vec4 = vec2 - vec3 ; | ||
150 | val1 = x1-x2; | ||
151 | val2 = y1-y2; | ||
152 | ensure("1:operator- failed",(val1 == vec4.mV[VX]) && ((val2 == vec4.mV[VY]))); | ||
153 | |||
154 | vec2.clearVec(); | ||
155 | vec3.clearVec(); | ||
156 | vec4.clearVec(); | ||
157 | x1 = -.235f, y1 = -24.32f, x2 = -2.3f, y2 = 1.f; | ||
158 | vec2.setVec(x1, y1); | ||
159 | vec3.setVec(x2, y2); | ||
160 | vec4 = vec2 - vec3; | ||
161 | val1 = x1-x2; | ||
162 | val2 = y1-y2; | ||
163 | ensure("2:operator- failed",(val1 == vec4.mV[VX]) && ((val2 == vec4.mV[VY]))); | ||
164 | } | ||
165 | |||
166 | template<> template<> | ||
167 | void v2math_object::test<8>() | ||
168 | { | ||
169 | F32 x1 =1.f, y1 = 2.f, x2 = -2.3f, y2 = 1.11f; | ||
170 | F32 val1, val2; | ||
171 | LLVector2 vec2(x1, y1), vec3(x2, y2); | ||
172 | val1 = vec2 * vec3; | ||
173 | val2 = x1*x2 + y1*y2; | ||
174 | ensure("1:operator* failed",(val1 == val2)); | ||
175 | |||
176 | vec3.clearVec(); | ||
177 | F32 mulVal = 4.332f; | ||
178 | vec3 = vec2 * mulVal; | ||
179 | val1 = x1*mulVal; | ||
180 | val2 = y1*mulVal; | ||
181 | ensure("2:operator* failed",(val1 == vec3.mV[VX]) && (val2 == vec3.mV[VY])); | ||
182 | |||
183 | vec3.clearVec(); | ||
184 | vec3 = mulVal * vec2; | ||
185 | ensure("3:operator* failed",(val1 == vec3.mV[VX]) && (val2 == vec3.mV[VY])); | ||
186 | } | ||
187 | |||
188 | template<> template<> | ||
189 | void v2math_object::test<9>() | ||
190 | { | ||
191 | F32 x1 =1.f, y1 = 2.f, div = 3.2f; | ||
192 | F32 val1, val2; | ||
193 | LLVector2 vec2(x1, y1), vec3; | ||
194 | vec3 = vec2 / div; | ||
195 | val1 = x1 / div; | ||
196 | val2 = y1 / div; | ||
197 | ensure("1:operator/ failed", is_approx_equal(val1, vec3.mV[VX]) && is_approx_equal(val2, vec3.mV[VY])); | ||
198 | |||
199 | vec3.clearVec(); | ||
200 | x1 = -.235f, y1 = -24.32f, div = -2.2f; | ||
201 | vec2.setVec(x1, y1); | ||
202 | vec3 = vec2 / div; | ||
203 | val1 = x1 / div; | ||
204 | val2 = y1 / div; | ||
205 | ensure("2:operator/ failed", is_approx_equal(val1, vec3.mV[VX]) && is_approx_equal(val2, vec3.mV[VY])); | ||
206 | } | ||
207 | |||
208 | template<> template<> | ||
209 | void v2math_object::test<10>() | ||
210 | { | ||
211 | F32 x1 =1.f, y1 = 2.f, x2 = -2.3f, y2 = 1.11f; | ||
212 | F32 val1, val2; | ||
213 | LLVector2 vec2(x1, y1), vec3(x2, y2), vec4; | ||
214 | vec4 = vec2 % vec3; | ||
215 | val1 = x1*y2 - x2*y1; | ||
216 | val2 = y1*x2 - y2*x1; | ||
217 | ensure("1:operator% failed",(val1 == vec4.mV[VX]) && (val2 == vec4.mV[VY])); | ||
218 | |||
219 | vec2.clearVec(); | ||
220 | vec3.clearVec(); | ||
221 | vec4.clearVec(); | ||
222 | x1 = -.235f, y1 = -24.32f, x2 = -2.3f, y2 = 1.f; | ||
223 | vec2.setVec(x1, y1); | ||
224 | vec3.setVec(x2, y2); | ||
225 | vec4 = vec2 % vec3; | ||
226 | val1 = x1*y2 - x2*y1; | ||
227 | val2 = y1*x2 - y2*x1; | ||
228 | ensure("2:operator% failed",(val1 == vec4.mV[VX]) && (val2 == vec4.mV[VY])); | ||
229 | } | ||
230 | template<> template<> | ||
231 | void v2math_object::test<11>() | ||
232 | { | ||
233 | F32 x1 =1.f, y1 = 2.f; | ||
234 | LLVector2 vec2(x1, y1), vec3(x1, y1); | ||
235 | ensure("1:operator== failed",(vec2 == vec3)); | ||
236 | |||
237 | vec2.clearVec(); | ||
238 | vec3.clearVec(); | ||
239 | x1 = -.235f, y1 = -24.32f; | ||
240 | vec2.setVec(x1, y1); | ||
241 | vec3.setVec(vec2); | ||
242 | ensure("2:operator== failed",(vec2 == vec3)); | ||
243 | } | ||
244 | |||
245 | template<> template<> | ||
246 | void v2math_object::test<12>() | ||
247 | { | ||
248 | F32 x1 = 1.f, y1 = 2.f,x2 = 2.332f, y2 = -1.23f; | ||
249 | LLVector2 vec2(x1, y1), vec3(x2, y2); | ||
250 | ensure("1:operator!= failed",(vec2 != vec3)); | ||
251 | |||
252 | vec2.clearVec(); | ||
253 | vec3.clearVec(); | ||
254 | vec2.setVec(x1, y1); | ||
255 | vec3.setVec(vec2); | ||
256 | ensure("2:operator!= failed", (FALSE == (vec2 != vec3))); | ||
257 | } | ||
258 | template<> template<> | ||
259 | void v2math_object::test<13>() | ||
260 | { | ||
261 | F32 x1 = 1.f, y1 = 2.f,x2 = 2.332f, y2 = -1.23f; | ||
262 | F32 val1, val2; | ||
263 | LLVector2 vec2(x1, y1), vec3(x2, y2); | ||
264 | vec2 +=vec3; | ||
265 | val1 = x1+x2; | ||
266 | val2 = y1+y2; | ||
267 | ensure("1:operator+= failed",(val1 == vec2.mV[VX]) && (val2 == vec2.mV[VY])); | ||
268 | |||
269 | vec2.setVec(x1, y1); | ||
270 | vec2 -=vec3; | ||
271 | val1 = x1-x2; | ||
272 | val2 = y1-y2; | ||
273 | ensure("2:operator-= failed",(val1 == vec2.mV[VX]) && (val2 == vec2.mV[VY])); | ||
274 | |||
275 | vec2.clearVec(); | ||
276 | vec3.clearVec(); | ||
277 | x1 = -21.000466f, y1 = 2.98382f,x2 = 0.332f, y2 = -01.23f; | ||
278 | vec2.setVec(x1, y1); | ||
279 | vec3.setVec(x2, y2); | ||
280 | vec2 +=vec3; | ||
281 | val1 = x1+x2; | ||
282 | val2 = y1+y2; | ||
283 | ensure("3:operator+= failed",(val1 == vec2.mV[VX]) && (val2 == vec2.mV[VY])); | ||
284 | |||
285 | vec2.setVec(x1, y1); | ||
286 | vec2 -=vec3; | ||
287 | val1 = x1-x2; | ||
288 | val2 = y1-y2; | ||
289 | ensure("4:operator-= failed",(val1 == vec2.mV[VX]) && (val2 == vec2.mV[VY])); | ||
290 | } | ||
291 | |||
292 | template<> template<> | ||
293 | void v2math_object::test<14>() | ||
294 | { | ||
295 | F32 x1 =1.f, y1 = 2.f; | ||
296 | F32 val1, val2, mulVal = 4.332f; | ||
297 | LLVector2 vec2(x1, y1); | ||
298 | vec2 /=mulVal; | ||
299 | val1 = x1 / mulVal; | ||
300 | val2 = y1 / mulVal; | ||
301 | ensure("1:operator/= failed", is_approx_equal(val1, vec2.mV[VX]) && is_approx_equal(val2, vec2.mV[VY])); | ||
302 | |||
303 | vec2.clearVec(); | ||
304 | x1 = .213f, y1 = -2.34f, mulVal = -.23f; | ||
305 | vec2.setVec(x1, y1); | ||
306 | vec2 /=mulVal; | ||
307 | val1 = x1 / mulVal; | ||
308 | val2 = y1 / mulVal; | ||
309 | ensure("2:operator/= failed", is_approx_equal(val1, vec2.mV[VX]) && is_approx_equal(val2, vec2.mV[VY])); | ||
310 | } | ||
311 | |||
312 | template<> template<> | ||
313 | void v2math_object::test<15>() | ||
314 | { | ||
315 | F32 x1 =1.f, y1 = 2.f; | ||
316 | F32 val1, val2, mulVal = 4.332f; | ||
317 | LLVector2 vec2(x1, y1); | ||
318 | vec2 *=mulVal; | ||
319 | val1 = x1*mulVal; | ||
320 | val2 = y1*mulVal; | ||
321 | ensure("1:operator*= failed",(val1 == vec2.mV[VX]) && (val2 == vec2.mV[VY])); | ||
322 | |||
323 | vec2.clearVec(); | ||
324 | x1 = .213f, y1 = -2.34f, mulVal = -.23f; | ||
325 | vec2.setVec(x1, y1); | ||
326 | vec2 *=mulVal; | ||
327 | val1 = x1*mulVal; | ||
328 | val2 = y1*mulVal; | ||
329 | ensure("2:operator*= failed",(val1 == vec2.mV[VX]) && (val2 == vec2.mV[VY])); | ||
330 | } | ||
331 | |||
332 | template<> template<> | ||
333 | void v2math_object::test<16>() | ||
334 | { | ||
335 | F32 x1 =1.f, y1 = 2.f, x2 = -2.3f, y2 = 1.11f; | ||
336 | F32 val1, val2; | ||
337 | LLVector2 vec2(x1, y1), vec3(x2, y2); | ||
338 | vec2 %= vec3; | ||
339 | val1 = x1*y2 - x2*y1; | ||
340 | val2 = y1*x2 - y2*x1; | ||
341 | ensure("1:operator%= failed",(val1 == vec2.mV[VX]) && (val2 == vec2.mV[VY])); | ||
342 | } | ||
343 | |||
344 | template<> template<> | ||
345 | void v2math_object::test<17>() | ||
346 | { | ||
347 | F32 x1 =1.f, y1 = 2.f; | ||
348 | LLVector2 vec2(x1, y1),vec3; | ||
349 | vec3 = -vec2; | ||
350 | ensure("1:operator- failed",(-vec3 == vec2)); | ||
351 | } | ||
352 | |||
353 | template<> template<> | ||
354 | void v2math_object::test<18>() | ||
355 | { | ||
356 | F32 x1 =1.f, y1 = 2.f; | ||
357 | std::ostringstream stream1, stream2; | ||
358 | LLVector2 vec2(x1, y1),vec3; | ||
359 | stream1 << vec2; | ||
360 | vec3.setVec(x1, y1); | ||
361 | stream2 << vec3; | ||
362 | ensure("1:operator << failed",(stream1.str() == stream2.str())); | ||
363 | } | ||
364 | |||
365 | template<> template<> | ||
366 | void v2math_object::test<19>() | ||
367 | { | ||
368 | F32 x1 =1.0f, y1 = 2.0f, x2 = -.32f, y2 = .2234f; | ||
369 | LLVector2 vec2(x1, y1),vec3(x2, y2); | ||
370 | ensure("1:operator < failed",(vec3 < vec2)); | ||
371 | |||
372 | x1 = 1.0f, y1 = 2.0f, x2 = 1.0f, y2 = 3.2234f; | ||
373 | vec2.setVec(x1, y1); | ||
374 | vec3.setVec(x2, y2); | ||
375 | ensure("2:operator < failed", (FALSE == vec3 < vec2)); | ||
376 | } | ||
377 | |||
378 | template<> template<> | ||
379 | void v2math_object::test<20>() | ||
380 | { | ||
381 | F32 x1 =1.0f, y1 = 2.0f; | ||
382 | LLVector2 vec2(x1, y1); | ||
383 | ensure("1:operator [] failed",( x1 == vec2[0])); | ||
384 | ensure("2:operator [] failed",( y1 == vec2[1])); | ||
385 | |||
386 | vec2.clearVec(); | ||
387 | x1 = 23.0f, y1 = -.2361f; | ||
388 | vec2.setVec(x1, y1); | ||
389 | F32 ref1 = vec2[0]; | ||
390 | ensure("3:operator [] failed", ( ref1 == x1)); | ||
391 | F32 ref2 = vec2[1]; | ||
392 | ensure("4:operator [] failed", ( ref2 == y1)); | ||
393 | } | ||
394 | |||
395 | template<> template<> | ||
396 | void v2math_object::test<21>() | ||
397 | { | ||
398 | F32 x1 =1.f, y1 = 2.f, x2 = -.32f, y2 = .2234f; | ||
399 | F32 val1, val2; | ||
400 | LLVector2 vec2(x1, y1),vec3(x2, y2); | ||
401 | val1 = dist_vec_squared2D(vec2, vec3); | ||
402 | val2 = (x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2); | ||
403 | ensure_equals("dist_vec_squared2D values are not equal",val2, val1); | ||
404 | |||
405 | val1 = dist_vec_squared(vec2, vec3); | ||
406 | ensure_equals("dist_vec_squared values are not equal",val2, val1); | ||
407 | |||
408 | val1 = dist_vec(vec2, vec3); | ||
409 | val2 = fsqrtf((x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2)); | ||
410 | ensure_equals("dist_vec values are not equal",val2, val1); | ||
411 | } | ||
412 | |||
413 | template<> template<> | ||
414 | void v2math_object::test<22>() | ||
415 | { | ||
416 | F32 x1 =1.f, y1 = 2.f, x2 = -.32f, y2 = .2234f,fVal = .0121f; | ||
417 | F32 val1, val2; | ||
418 | LLVector2 vec2(x1, y1),vec3(x2, y2); | ||
419 | LLVector2 vec4 = lerp(vec2, vec3, fVal); | ||
420 | val1 = x1 + (x2 - x1) * fVal; | ||
421 | val2 = y1 + (y2 - y1) * fVal; | ||
422 | ensure("lerp values are not equal", ((val1 == vec4.mV[VX]) && (val2 == vec4.mV[VY]))); | ||
423 | } | ||
424 | |||
425 | template<> template<> | ||
426 | void v2math_object::test<23>() | ||
427 | { | ||
428 | F32 x1 =1.f, y1 = 2.f; | ||
429 | F32 val1, val2; | ||
430 | LLVector2 vec2(x1, y1); | ||
431 | |||
432 | F32 vecMag = vec2.normVec(); | ||
433 | F32 mag = fsqrtf(x1*x1 + y1*y1); | ||
434 | |||
435 | F32 oomag = 1.f / mag; | ||
436 | val1 = x1 * oomag; | ||
437 | val2 = y1 * oomag; | ||
438 | |||
439 | ensure("normVec failed", val1 == vec2.mV[VX] && val2 == vec2.mV[VY] && vecMag == mag); | ||
440 | |||
441 | x1 =.00000001f, y1 = 0.f; | ||
442 | |||
443 | vec2.setVec(x1, y1); | ||
444 | vecMag = vec2.normVec(); | ||
445 | ensure("normVec failed should be 0.", 0. == vec2.mV[VX] && 0. == vec2.mV[VY] && vecMag == 0.); | ||
446 | } | ||
447 | } | ||