1 /* NAME:
2 QD3DMath.c
3
4 DESCRIPTION:
5 Entry point for Quesa API calls. Performs parameter checking and
6 then forwards each API call to the equivalent E3xxxxx routine.
7
8 COPYRIGHT:
9 Copyright (c) 1999-2004, Quesa Developers. All rights reserved.
10
11 For the current release of Quesa, please see:
12
13 <http://www.quesa.org/>
14
15 Redistribution and use in source and binary forms, with or without
16 modification, are permitted provided that the following conditions
17 are met:
18
19 o Redistributions of source code must retain the above copyright
20 notice, this list of conditions and the following disclaimer.
21
22 o Redistributions in binary form must reproduce the above
23 copyright notice, this list of conditions and the following
24 disclaimer in the documentation and/or other materials provided
25 with the distribution.
26
27 o Neither the name of Quesa nor the names of its contributors
28 may be used to endorse or promote products derived from this
29 software without specific prior written permission.
30
31 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
37 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
38 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
39 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
40 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 ___________________________________________________________________________
43 */
44 //=============================================================================
45 // Include files
46 //-----------------------------------------------------------------------------
47 #include "E3Prefix.h"
48 #include "E3Math.h"
49
50
51
52
53
54 //=============================================================================
55 // Inline APIs
56 //-----------------------------------------------------------------------------
57 #undef Q3Vector2D_Set
58 #undef Q3Vector3D_Set
59 #undef Q3Point2D_Set
60 #undef Q3Param2D_Set
61 #undef Q3RationalPoint3D_Set
62 #undef Q3Point3D_Set
63 #undef Q3RationalPoint4D_Set
64 #undef Q3PolarPoint_Set
65 #undef Q3SphericalPoint_Set
66 #undef Q3Vector2D_To3D
67 #undef Q3Vector2D_ToRationalPoint3D
68 #undef Q3Vector3D_To2D
69 #undef Q3RationalPoint3D_ToVector2D
70 #undef Q3Vector3D_ToRationalPoint4D
71 #undef Q3RationalPoint4D_ToVector3D
72 #undef Q3Point2D_To3D
73 #undef Q3RationalPoint3D_To2D
74 #undef Q3Point3D_To4D
75 #undef Q3RationalPoint4D_To3D
76 #undef Q3PolarPoint_ToPoint2D
77 #undef Q3Vector2D_Dot
78 #undef Q3Vector3D_Dot
79 #undef Q3Vector2D_Cross
80 #undef Q3Point2D_CrossProductTri
81 #undef Q3Vector3D_Cross
82 #undef Q3Point3D_CrossProductTri
83 #undef Q3Vector2D_Length
84 #undef Q3Vector2D_LengthSquared
85 #undef Q3Vector3D_Length
86 #undef Q3Vector3D_LengthSquared
87 #undef Q3Point2D_Distance
88 #undef Q3Point2D_DistanceSquared
89 #undef Q3Param2D_Distance
90 #undef Q3Param2D_DistanceSquared
91 #undef Q3RationalPoint3D_Distance
92 #undef Q3RationalPoint3D_DistanceSquared
93 #undef Q3Point3D_Distance
94 #undef Q3Point3D_DistanceSquared
95 #undef Q3RationalPoint4D_Distance
96 #undef Q3RationalPoint4D_DistanceSquared
97 #undef Q3Vector2D_Negate
98 #undef Q3Vector3D_Negate
99 #undef Q3Vector2D_Scale
100 #undef Q3Vector3D_Scale
101 #undef Q3Vector2D_Normalize
102 #undef Q3Vector3D_Normalize
103 #undef Q3Vector2D_Add
104 #undef Q3Vector3D_Add
105 #undef Q3Vector2D_Subtract
106 #undef Q3Vector3D_Subtract
107 #undef Q3Point2D_Vector2D_Add
108 #undef Q3Param2D_Vector2D_Add
109 #undef Q3Point3D_Vector3D_Add
110 #undef Q3Point2D_Vector2D_Subtract
111 #undef Q3Param2D_Vector2D_Subtract
112 #undef Q3Point3D_Vector3D_Subtract
113 #undef Q3Point2D_Subtract
114 #undef Q3Param2D_Subtract
115 #undef Q3Point3D_Subtract
116 #undef Q3Point2D_RRatio
117 #undef Q3Param2D_RRatio
118 #undef Q3Point3D_RRatio
119 #undef Q3RationalPoint4D_RRatio
120 #undef Q3Quaternion_Set
121 #undef Q3Quaternion_SetIdentity
122 #undef Q3Quaternion_Copy
123 #undef Q3Quaternion_Dot
124 #undef Q3Quaternion_Normalize
125 #undef Q3Quaternion_Invert
126 #undef Q3BoundingBox_Reset
127 #undef Q3BoundingBox_Set
128 #undef Q3BoundingBox_Copy
129 #undef Q3BoundingSphere_Reset
130 #undef Q3BoundingSphere_Set
131 #undef Q3BoundingSphere_Copy
132
133
134
135
136
137 //=============================================================================
138 // Internal constants
139 //-----------------------------------------------------------------------------
140 // Internal constants go here
141
142
143
144
145
146 //=============================================================================
147 // Internal types
148 //-----------------------------------------------------------------------------
149 // Internal types go here
150
151
152
153
154
155 //=============================================================================
156 // Internal macros
157 //-----------------------------------------------------------------------------
158 // Internal macros go here
159
160
161
162
163
164 //=============================================================================
165 // Public functions
166 //-----------------------------------------------------------------------------
167 // Q3Vector2D_Set : Quesa API entry point.
168 //-----------------------------------------------------------------------------
169 TQ3Vector2D *
Q3Vector2D_Set(TQ3Vector2D * vector2D,float x,float y)170 Q3Vector2D_Set(TQ3Vector2D *vector2D, float x, float y)
171 {
172
173
174 // Release build checks
175 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector2D), NULL);
176
177
178
179 // Debug build checks
180 #if Q3_DEBUG
181 if (0) // Further checks on vector2D
182 return(NULL);
183
184 if (0) // Further checks on x
185 return(NULL);
186
187 if (0) // Further checks on y
188 return(NULL);
189 #endif
190
191
192
193 // Call the bottleneck
194 E3System_Bottleneck();
195
196
197
198 // Call our implementation
199 return(E3Vector2D_Set(vector2D, x, y));
200 }
201
202
203
204
205
206 //=============================================================================
207 // Q3Vector3D_Set : Quesa API entry point.
208 //-----------------------------------------------------------------------------
209 TQ3Vector3D *
Q3Vector3D_Set(TQ3Vector3D * vector3D,float x,float y,float z)210 Q3Vector3D_Set(TQ3Vector3D *vector3D, float x, float y, float z)
211 {
212
213
214 // Release build checks
215 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector3D), NULL);
216
217
218
219 // Debug build checks
220 #if Q3_DEBUG
221 if (0) // Further checks on vector3D
222 return(NULL);
223
224 if (0) // Further checks on x
225 return(NULL);
226
227 if (0) // Further checks on y
228 return(NULL);
229
230 if (0) // Further checks on z
231 return(NULL);
232 #endif
233
234
235
236 // Call the bottleneck
237 E3System_Bottleneck();
238
239
240
241 // Call our implementation
242 return(E3Vector3D_Set(vector3D, x, y, z));
243 }
244
245
246
247
248
249 //=============================================================================
250 // Q3Point2D_Set : Quesa API entry point.
251 //-----------------------------------------------------------------------------
252 TQ3Point2D *
Q3Point2D_Set(TQ3Point2D * point2D,float x,float y)253 Q3Point2D_Set(TQ3Point2D *point2D, float x, float y)
254 {
255
256
257 // Release build checks
258 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point2D), NULL);
259
260
261
262 // Debug build checks
263 #if Q3_DEBUG
264 if (0) // Further checks on point2D
265 return(NULL);
266
267 if (0) // Further checks on x
268 return(NULL);
269
270 if (0) // Further checks on y
271 return(NULL);
272 #endif
273
274
275
276 // Call the bottleneck
277 E3System_Bottleneck();
278
279
280
281 // Call our implementation
282 return(E3Point2D_Set(point2D, x, y));
283 }
284
285
286
287
288
289 //=============================================================================
290 // Q3Param2D_Set : Quesa API entry point.
291 //-----------------------------------------------------------------------------
292 TQ3Param2D *
Q3Param2D_Set(TQ3Param2D * param2D,float u,float v)293 Q3Param2D_Set(TQ3Param2D *param2D, float u, float v)
294 {
295
296
297 // Release build checks
298 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(param2D), NULL);
299
300
301
302 // Debug build checks
303 #if Q3_DEBUG
304 if (0) // Further checks on param2D
305 return(NULL);
306
307 if (0) // Further checks on u
308 return(NULL);
309
310 if (0) // Further checks on v
311 return(NULL);
312 #endif
313
314
315
316 // Call the bottleneck
317 E3System_Bottleneck();
318
319
320
321 // Call our implementation
322 return(E3Param2D_Set(param2D, u, v));
323 }
324
325
326
327
328
329 //=============================================================================
330 // Q3RationalPoint3D_Set : Quesa API entry point.
331 //-----------------------------------------------------------------------------
332 TQ3RationalPoint3D *
Q3RationalPoint3D_Set(TQ3RationalPoint3D * rationalPoint3D,float x,float y,float w)333 Q3RationalPoint3D_Set(TQ3RationalPoint3D *rationalPoint3D, float x, float y, float w)
334 {
335
336
337 // Release build checks
338 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(rationalPoint3D), NULL);
339
340
341
342 // Debug build checks
343 #if Q3_DEBUG
344 if (0) // Further checks on rationalPoint3D
345 return(NULL);
346
347 if (0) // Further checks on x
348 return(NULL);
349
350 if (0) // Further checks on y
351 return(NULL);
352
353 if (0) // Further checks on w
354 return(NULL);
355 #endif
356
357
358
359 // Call the bottleneck
360 E3System_Bottleneck();
361
362
363
364 // Call our implementation
365 return(E3RationalPoint3D_Set(rationalPoint3D, x, y, w));
366 }
367
368
369
370
371
372 //=============================================================================
373 // Q3Point3D_Set : Quesa API entry point.
374 //-----------------------------------------------------------------------------
375 TQ3Point3D *
Q3Point3D_Set(TQ3Point3D * point3D,float x,float y,float z)376 Q3Point3D_Set(TQ3Point3D *point3D, float x, float y, float z)
377 {
378
379
380 // Release build checks
381 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point3D), NULL);
382
383
384
385 // Debug build checks
386 #if Q3_DEBUG
387 if (0) // Further checks on point3D
388 return(NULL);
389
390 if (0) // Further checks on x
391 return(NULL);
392
393 if (0) // Further checks on y
394 return(NULL);
395
396 if (0) // Further checks on z
397 return(NULL);
398 #endif
399
400
401
402 // Call the bottleneck
403 E3System_Bottleneck();
404
405
406
407 // Call our implementation
408 return(E3Point3D_Set(point3D, x, y, z));
409 }
410
411
412
413
414
415 //=============================================================================
416 // Q3RationalPoint4D_Set : Quesa API entry point.
417 //-----------------------------------------------------------------------------
418 TQ3RationalPoint4D *
Q3RationalPoint4D_Set(TQ3RationalPoint4D * rationalPoint4D,float x,float y,float z,float w)419 Q3RationalPoint4D_Set(TQ3RationalPoint4D *rationalPoint4D, float x, float y, float z, float w)
420 {
421
422
423 // Release build checks
424 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(rationalPoint4D), NULL);
425
426
427
428 // Debug build checks
429 #if Q3_DEBUG
430 if (0) // Further checks on rationalPoint4D
431 return(NULL);
432
433 if (0) // Further checks on x
434 return(NULL);
435
436 if (0) // Further checks on y
437 return(NULL);
438
439 if (0) // Further checks on z
440 return(NULL);
441
442 if (0) // Further checks on w
443 return(NULL);
444 #endif
445
446
447
448 // Call the bottleneck
449 E3System_Bottleneck();
450
451
452
453 // Call our implementation
454 return(E3RationalPoint4D_Set(rationalPoint4D, x, y, z, w));
455 }
456
457
458
459
460
461 //=============================================================================
462 // Q3PolarPoint_Set : Quesa API entry point.
463 //-----------------------------------------------------------------------------
464 TQ3PolarPoint *
Q3PolarPoint_Set(TQ3PolarPoint * polarPoint,float r,float theta)465 Q3PolarPoint_Set(TQ3PolarPoint *polarPoint, float r, float theta)
466 {
467
468
469 // Release build checks
470 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(polarPoint), NULL);
471
472
473
474 // Debug build checks
475 #if Q3_DEBUG
476 if (0) // Further checks on polarPoint
477 return(NULL);
478
479 if (0) // Further checks on r
480 return(NULL);
481
482 if (0) // Further checks on theta
483 return(NULL);
484 #endif
485
486
487
488 // Call the bottleneck
489 E3System_Bottleneck();
490
491
492
493 // Call our implementation
494 return(E3PolarPoint_Set(polarPoint, r, theta));
495 }
496
497
498
499
500
501 //=============================================================================
502 // Q3SphericalPoint_Set : Quesa API entry point.
503 //-----------------------------------------------------------------------------
504 TQ3SphericalPoint *
Q3SphericalPoint_Set(TQ3SphericalPoint * sphericalPoint,float rho,float theta,float phi)505 Q3SphericalPoint_Set(TQ3SphericalPoint *sphericalPoint, float rho, float theta, float phi)
506 {
507
508
509 // Release build checks
510 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(sphericalPoint), NULL);
511
512
513
514 // Debug build checks
515 #if Q3_DEBUG
516 if (0) // Further checks on sphericalPoint
517 return(NULL);
518
519 if (0) // Further checks on rho
520 return(NULL);
521
522 if (0) // Further checks on theta
523 return(NULL);
524
525 if (0) // Further checks on phi
526 return(NULL);
527 #endif
528
529
530
531 // Call the bottleneck
532 E3System_Bottleneck();
533
534
535
536 // Call our implementation
537 return(E3SphericalPoint_Set(sphericalPoint, rho, theta, phi));
538 }
539
540
541
542
543
544 //=============================================================================
545 // Q3Vector2D_To3D : Quesa API entry point.
546 //-----------------------------------------------------------------------------
547 #pragma mark -
548 TQ3Vector3D *
Q3Vector2D_To3D(const TQ3Vector2D * vector2D,TQ3Vector3D * result)549 Q3Vector2D_To3D(const TQ3Vector2D *vector2D, TQ3Vector3D *result)
550 {
551
552
553 // Release build checks
554 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector2D), NULL);
555 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
556
557
558
559 // Debug build checks
560 #if Q3_DEBUG
561 if (0) // Further checks on vector2D
562 return(NULL);
563
564 if (0) // Further checks on result
565 return(NULL);
566 #endif
567
568
569
570 // Call the bottleneck
571 E3System_Bottleneck();
572
573
574
575 // Call our implementation
576 return(E3Vector2D_To3D(vector2D, result));
577 }
578
579
580
581
582
583 //=============================================================================
584 // Q3Vector2D_ToRationalPoint3D : Quesa API entry point.
585 //-----------------------------------------------------------------------------
586 TQ3RationalPoint3D *
Q3Vector2D_ToRationalPoint3D(const TQ3Vector2D * vector2D,TQ3RationalPoint3D * result)587 Q3Vector2D_ToRationalPoint3D(const TQ3Vector2D *vector2D, TQ3RationalPoint3D *result)
588 {
589
590
591 // Release build checks
592 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector2D), NULL);
593 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
594
595
596
597 // Debug build checks
598 #if Q3_DEBUG
599 if (0) // Further checks on vector2D
600 return(NULL);
601
602 if (0) // Further checks on result
603 return(NULL);
604 #endif
605
606
607
608 // Call the bottleneck
609 E3System_Bottleneck();
610
611
612
613 // Call our implementation
614 return(E3Vector2D_ToRationalPoint3D(vector2D, result));
615 }
616
617
618
619
620
621 //=============================================================================
622 // Q3Vector3D_To2D : Quesa API entry point.
623 //-----------------------------------------------------------------------------
624 TQ3Vector2D *
Q3Vector3D_To2D(const TQ3Vector3D * vector3D,TQ3Vector2D * result)625 Q3Vector3D_To2D(const TQ3Vector3D *vector3D, TQ3Vector2D *result)
626 {
627
628
629 // Release build checks
630 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector3D), NULL);
631 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
632
633
634
635 // Debug build checks
636 #if Q3_DEBUG
637 if (0) // Further checks on vector3D
638 return(NULL);
639
640 if (0) // Further checks on result
641 return(NULL);
642 #endif
643
644
645
646 // Call the bottleneck
647 E3System_Bottleneck();
648
649
650
651 // Call our implementation
652 return(E3Vector3D_To2D(vector3D, result));
653 }
654
655
656
657
658
659 //=============================================================================
660 // Q3RationalPoint3D_ToVector2D : Quesa API entry point.
661 //-----------------------------------------------------------------------------
662 TQ3Vector2D *
Q3RationalPoint3D_ToVector2D(const TQ3RationalPoint3D * rationalPoint3D,TQ3Vector2D * result)663 Q3RationalPoint3D_ToVector2D(const TQ3RationalPoint3D *rationalPoint3D, TQ3Vector2D *result)
664 {
665
666
667 // Release build checks
668 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(rationalPoint3D), NULL);
669 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
670
671
672
673 // Debug build checks
674 #if Q3_DEBUG
675 if (0) // Further checks on rationalPoint3D
676 return(NULL);
677
678 if (0) // Further checks on result
679 return(NULL);
680 #endif
681
682
683
684 // Call the bottleneck
685 E3System_Bottleneck();
686
687
688
689 // Call our implementation
690 return(E3RationalPoint3D_ToVector2D(rationalPoint3D, result));
691 }
692
693
694
695
696
697 //=============================================================================
698 // Q3Vector3D_ToRationalPoint4D : Quesa API entry point.
699 //-----------------------------------------------------------------------------
700 TQ3RationalPoint4D *
Q3Vector3D_ToRationalPoint4D(const TQ3Vector3D * vector3D,TQ3RationalPoint4D * result)701 Q3Vector3D_ToRationalPoint4D(const TQ3Vector3D *vector3D, TQ3RationalPoint4D *result)
702 {
703
704
705 // Release build checks
706 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector3D), NULL);
707 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
708
709
710
711 // Debug build checks
712 #if Q3_DEBUG
713 if (0) // Further checks on vector3D
714 return(NULL);
715
716 if (0) // Further checks on result
717 return(NULL);
718 #endif
719
720
721
722 // Call the bottleneck
723 E3System_Bottleneck();
724
725
726
727 // Call our implementation
728 return(E3Vector3D_ToRationalPoint4D(vector3D, result));
729 }
730
731
732
733
734
735 //=============================================================================
736 // Q3RationalPoint4D_ToVector3D : Quesa API entry point.
737 //-----------------------------------------------------------------------------
738 TQ3Vector3D *
Q3RationalPoint4D_ToVector3D(const TQ3RationalPoint4D * rationalPoint4D,TQ3Vector3D * result)739 Q3RationalPoint4D_ToVector3D(const TQ3RationalPoint4D *rationalPoint4D, TQ3Vector3D *result)
740 {
741
742
743 // Release build checks
744 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(rationalPoint4D), NULL);
745 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
746
747
748
749 // Debug build checks
750 #if Q3_DEBUG
751 if (0) // Further checks on rationalPoint4D
752 return(NULL);
753
754 if (0) // Further checks on result
755 return(NULL);
756 #endif
757
758
759
760 // Call the bottleneck
761 E3System_Bottleneck();
762
763
764
765 // Call our implementation
766 return(E3RationalPoint4D_ToVector3D(rationalPoint4D, result));
767 }
768
769
770
771
772
773 //=============================================================================
774 // Q3Point2D_To3D : Quesa API entry point.
775 //-----------------------------------------------------------------------------
776 TQ3RationalPoint3D *
Q3Point2D_To3D(const TQ3Point2D * point2D,TQ3RationalPoint3D * result)777 Q3Point2D_To3D(const TQ3Point2D *point2D, TQ3RationalPoint3D *result)
778 {
779
780
781 // Release build checks
782 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point2D), NULL);
783 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
784
785
786
787 // Debug build checks
788 #if Q3_DEBUG
789 if (0) // Further checks on point2D
790 return(NULL);
791
792 if (0) // Further checks on result
793 return(NULL);
794 #endif
795
796
797
798 // Call the bottleneck
799 E3System_Bottleneck();
800
801
802
803 // Call our implementation
804 return(E3Point2D_To3D(point2D, result));
805 }
806
807
808
809
810
811 //=============================================================================
812 // Q3RationalPoint3D_To2D : Quesa API entry point.
813 //-----------------------------------------------------------------------------
814 TQ3Point2D *
Q3RationalPoint3D_To2D(const TQ3RationalPoint3D * rationalPoint3D,TQ3Point2D * result)815 Q3RationalPoint3D_To2D(const TQ3RationalPoint3D *rationalPoint3D, TQ3Point2D *result)
816 {
817
818
819 // Release build checks
820 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(rationalPoint3D), NULL);
821 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
822
823
824
825 // Debug build checks
826 #if Q3_DEBUG
827 if (rationalPoint3D->w == 0.0f)
828 {
829 E3ErrorManager_PostError( kQ3ErrorInfiniteRationalPoint, kQ3False );
830 return(NULL);
831 }
832
833 if (0) // Further checks on result
834 return(NULL);
835 #endif
836
837
838
839 // Call the bottleneck
840 E3System_Bottleneck();
841
842
843
844 // Call our implementation
845 return(E3RationalPoint3D_To2D(rationalPoint3D, result));
846 }
847
848
849
850
851
852 //=============================================================================
853 // Q3Point3D_To4D : Quesa API entry point.
854 //-----------------------------------------------------------------------------
855 TQ3RationalPoint4D *
Q3Point3D_To4D(const TQ3Point3D * point3D,TQ3RationalPoint4D * result)856 Q3Point3D_To4D(const TQ3Point3D *point3D, TQ3RationalPoint4D *result)
857 {
858
859
860 // Release build checks
861 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point3D), NULL);
862 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
863
864
865
866 // Debug build checks
867 #if Q3_DEBUG
868 if (0) // Further checks on point3D
869 return(NULL);
870
871 if (0) // Further checks on result
872 return(NULL);
873 #endif
874
875
876
877 // Call the bottleneck
878 E3System_Bottleneck();
879
880
881
882 // Call our implementation
883 return(E3Point3D_To4D(point3D, result));
884 }
885
886
887
888
889
890 //=============================================================================
891 // Q3RationalPoint4D_To3D : Quesa API entry point.
892 //-----------------------------------------------------------------------------
893 TQ3Point3D *
Q3RationalPoint4D_To3D(const TQ3RationalPoint4D * rationalPoint4D,TQ3Point3D * result)894 Q3RationalPoint4D_To3D(const TQ3RationalPoint4D *rationalPoint4D, TQ3Point3D *result)
895 {
896
897
898 // Release build checks
899 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(rationalPoint4D), NULL);
900 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
901
902
903
904 // Debug build checks
905 #if Q3_DEBUG
906 if (rationalPoint4D->w == 0.0f)
907 {
908 E3ErrorManager_PostError( kQ3ErrorInfiniteRationalPoint, kQ3False );
909 return(NULL);
910 }
911
912 if (0) // Further checks on result
913 return(NULL);
914 #endif
915
916
917
918 // Call the bottleneck
919 E3System_Bottleneck();
920
921
922
923 // Call our implementation
924 return(E3RationalPoint4D_To3D(rationalPoint4D, result));
925 }
926
927
928
929
930
931 //=============================================================================
932 // Q3Point2D_ToPolar : Quesa API entry point.
933 //-----------------------------------------------------------------------------
934 #pragma mark -
935 TQ3PolarPoint *
Q3Point2D_ToPolar(const TQ3Point2D * point2D,TQ3PolarPoint * result)936 Q3Point2D_ToPolar(const TQ3Point2D *point2D, TQ3PolarPoint *result)
937 {
938
939
940 // Release build checks
941 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point2D), NULL);
942 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
943
944
945
946 // Debug build checks
947 #if Q3_DEBUG
948 if (0) // Further checks on point2D
949 return(NULL);
950
951 if (0) // Further checks on result
952 return(NULL);
953 #endif
954
955
956
957 // Call the bottleneck
958 E3System_Bottleneck();
959
960
961
962 // Call our implementation
963 return(E3Point2D_ToPolar(point2D, result));
964 }
965
966
967
968
969
970 //=============================================================================
971 // Q3PolarPoint_ToPoint2D : Quesa API entry point.
972 //-----------------------------------------------------------------------------
973 TQ3Point2D *
Q3PolarPoint_ToPoint2D(const TQ3PolarPoint * polarPoint,TQ3Point2D * result)974 Q3PolarPoint_ToPoint2D(const TQ3PolarPoint *polarPoint, TQ3Point2D *result)
975 {
976
977
978 // Release build checks
979 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(polarPoint), NULL);
980 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
981
982
983
984 // Debug build checks
985 #if Q3_DEBUG
986 if (0) // Further checks on polarPoint
987 return(NULL);
988
989 if (0) // Further checks on result
990 return(NULL);
991 #endif
992
993
994
995 // Call the bottleneck
996 E3System_Bottleneck();
997
998
999
1000 // Call our implementation
1001 return(E3PolarPoint_ToPoint2D(polarPoint, result));
1002 }
1003
1004
1005
1006
1007
1008 //=============================================================================
1009 // Q3Point3D_ToSpherical : Quesa API entry point.
1010 //-----------------------------------------------------------------------------
1011 TQ3SphericalPoint *
Q3Point3D_ToSpherical(const TQ3Point3D * point3D,TQ3SphericalPoint * result)1012 Q3Point3D_ToSpherical(const TQ3Point3D *point3D, TQ3SphericalPoint *result)
1013 {
1014
1015
1016 // Release build checks
1017 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point3D), NULL);
1018 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
1019
1020
1021
1022 // Debug build checks
1023 #if Q3_DEBUG
1024 if (0) // Further checks on point3D
1025 return(NULL);
1026
1027 if (0) // Further checks on result
1028 return(NULL);
1029 #endif
1030
1031
1032
1033 // Call the bottleneck
1034 E3System_Bottleneck();
1035
1036
1037
1038 // Call our implementation
1039 return(E3Point3D_ToSpherical(point3D, result));
1040 }
1041
1042
1043
1044
1045
1046 //=============================================================================
1047 // Q3SphericalPoint_ToPoint3D : Quesa API entry point.
1048 //-----------------------------------------------------------------------------
1049 TQ3Point3D *
Q3SphericalPoint_ToPoint3D(const TQ3SphericalPoint * sphericalPoint,TQ3Point3D * result)1050 Q3SphericalPoint_ToPoint3D(const TQ3SphericalPoint *sphericalPoint, TQ3Point3D *result)
1051 {
1052
1053
1054 // Release build checks
1055 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(sphericalPoint), NULL);
1056 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
1057
1058
1059
1060 // Debug build checks
1061 #if Q3_DEBUG
1062 if (0) // Further checks on sphericalPoint
1063 return(NULL);
1064
1065 if (0) // Further checks on result
1066 return(NULL);
1067 #endif
1068
1069
1070
1071 // Call the bottleneck
1072 E3System_Bottleneck();
1073
1074
1075
1076 // Call our implementation
1077 return(E3SphericalPoint_ToPoint3D(sphericalPoint, result));
1078 }
1079
1080
1081
1082
1083
1084 //=============================================================================
1085 // Q3Vector2D_Dot : Quesa API entry point.
1086 //-----------------------------------------------------------------------------
1087 #pragma mark -
1088 float
Q3Vector2D_Dot(const TQ3Vector2D * v1,const TQ3Vector2D * v2)1089 Q3Vector2D_Dot(const TQ3Vector2D *v1, const TQ3Vector2D *v2)
1090 {
1091
1092
1093 // Release build checks
1094 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v1), 0.0f);
1095 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v2), 0.0f);
1096
1097
1098
1099 // Debug build checks
1100 #if Q3_DEBUG
1101 if (0) // Further checks on v1
1102 return(0.0f);
1103
1104 if (0) // Further checks on v2
1105 return(0.0f);
1106 #endif
1107
1108
1109
1110 // Call the bottleneck
1111 E3System_Bottleneck();
1112
1113
1114
1115 // Call our implementation
1116 return(E3Vector2D_Dot(v1, v2));
1117 }
1118
1119
1120
1121
1122
1123 //=============================================================================
1124 // Q3Vector3D_Dot : Quesa API entry point.
1125 //-----------------------------------------------------------------------------
1126 float
Q3Vector3D_Dot(const TQ3Vector3D * v1,const TQ3Vector3D * v2)1127 Q3Vector3D_Dot(const TQ3Vector3D *v1, const TQ3Vector3D *v2)
1128 {
1129
1130
1131 // Release build checks
1132 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v1), 0.0f);
1133 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v2), 0.0f);
1134
1135
1136
1137 // Debug build checks
1138 #if Q3_DEBUG
1139 if (0) // Further checks on v1
1140 return(0.0f);
1141
1142 if (0) // Further checks on v2
1143 return(0.0f);
1144 #endif
1145
1146
1147
1148 // Call the bottleneck
1149 E3System_Bottleneck();
1150
1151
1152
1153 // Call our implementation
1154 return(E3Vector3D_Dot(v1, v2));
1155 }
1156
1157
1158
1159
1160
1161 //=============================================================================
1162 // Q3Vector3D_DotArray : Quesa API entry point.
1163 //-----------------------------------------------------------------------------
1164 TQ3Status
Q3Vector3D_DotArray(const TQ3Vector3D * inFirstVectors3D,const TQ3Vector3D * inSecondVectors3D,float * outDotProducts,TQ3Boolean * outDotLessThanZeros,TQ3Uns32 numVectors,TQ3Uns32 inStructSize,TQ3Uns32 outDotProductStructSize,TQ3Uns32 outDotLessThanZeroStructSize)1165 Q3Vector3D_DotArray(
1166 const TQ3Vector3D *inFirstVectors3D,
1167 const TQ3Vector3D *inSecondVectors3D,
1168 float *outDotProducts,
1169 TQ3Boolean *outDotLessThanZeros,
1170 TQ3Uns32 numVectors,
1171 TQ3Uns32 inStructSize,
1172 TQ3Uns32 outDotProductStructSize,
1173 TQ3Uns32 outDotLessThanZeroStructSize)
1174 {
1175
1176
1177 // Release build checks
1178 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(inFirstVectors3D), kQ3Failure);
1179 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(inSecondVectors3D), kQ3Failure);
1180 Q3_REQUIRE_OR_RESULT(outDotProducts != NULL || outDotLessThanZeros != NULL, kQ3Failure);
1181 Q3_REQUIRE_OR_RESULT(outDotProducts == NULL || Q3_VALID_PTR(outDotProducts), kQ3Failure);
1182 Q3_REQUIRE_OR_RESULT(outDotLessThanZeros == NULL || Q3_VALID_PTR(outDotLessThanZeros), kQ3Failure);
1183 Q3_REQUIRE_OR_RESULT(inStructSize >= sizeof(TQ3Vector3D), kQ3Failure);
1184 Q3_REQUIRE_OR_RESULT(outDotProducts == NULL || outDotProductStructSize >= sizeof(float), kQ3Failure);
1185 Q3_REQUIRE_OR_RESULT(outDotLessThanZeros == NULL || outDotLessThanZeroStructSize >= sizeof(TQ3Boolean), kQ3Failure);
1186
1187
1188
1189 // Debug build checks
1190 #if Q3_DEBUG
1191 if (0) // Further checks on inFirstVectors3D
1192 return(kQ3Failure);
1193
1194 if (0) // Further checks on inSecondVectors3D
1195 return(kQ3Failure);
1196
1197 if (0) // Further checks on outDotProducts
1198 return(kQ3Failure);
1199
1200 if (0) // Further checks on outDotLessThanZeros
1201 return(kQ3Failure);
1202
1203 if (0) // Further checks on numVectors
1204 return(kQ3Failure);
1205
1206 if (0) // Further checks on inStructSize
1207 return(kQ3Failure);
1208
1209 if (0) // Further checks on outDotProductStructSize
1210 return(kQ3Failure);
1211
1212 if (0) // Further checks on outDotLessThanZeroStructSize
1213 return(kQ3Failure);
1214 #endif
1215
1216
1217
1218 // Call the bottleneck
1219 E3System_Bottleneck();
1220
1221
1222
1223 // Call our implementation
1224 return(E3Vector3D_DotArray(inFirstVectors3D, inSecondVectors3D, outDotProducts, outDotLessThanZeros, numVectors, inStructSize, outDotProductStructSize, outDotLessThanZeroStructSize));
1225 }
1226
1227
1228
1229
1230
1231 //=============================================================================
1232 // Q3Vector2D_Cross : Quesa API entry point.
1233 //-----------------------------------------------------------------------------
1234 #pragma mark -
1235 float
Q3Vector2D_Cross(const TQ3Vector2D * v1,const TQ3Vector2D * v2)1236 Q3Vector2D_Cross(const TQ3Vector2D *v1, const TQ3Vector2D *v2)
1237 {
1238
1239
1240 // Release build checks
1241 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v1), 0.0f);
1242 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v2), 0.0f);
1243
1244
1245
1246 // Debug build checks
1247 #if Q3_DEBUG
1248 if (0) // Further checks on v1
1249 return(0.0f);
1250
1251 if (0) // Further checks on v2
1252 return(0.0f);
1253 #endif
1254
1255
1256
1257 // Call the bottleneck
1258 E3System_Bottleneck();
1259
1260
1261
1262 // Call our implementation
1263 return(E3Vector2D_Cross(v1, v2));
1264 }
1265
1266
1267
1268
1269
1270 //=============================================================================
1271 // Q3Point2D_CrossProductTri : Quesa API entry point.
1272 //-----------------------------------------------------------------------------
1273 float
Q3Point2D_CrossProductTri(const TQ3Point2D * p1,const TQ3Point2D * p2,const TQ3Point2D * p3)1274 Q3Point2D_CrossProductTri(const TQ3Point2D *p1, const TQ3Point2D *p2, const TQ3Point2D *p3)
1275 {
1276
1277
1278 // Release build checks
1279 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), 0.0f);
1280 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), 0.0f);
1281 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p3), 0.0f);
1282
1283
1284
1285 // Debug build checks
1286 #if Q3_DEBUG
1287 if (0) // Further checks on p1
1288 return(0.0f);
1289
1290 if (0) // Further checks on p2
1291 return(0.0f);
1292
1293 if (0) // Further checks on p3
1294 return(0.0f);
1295 #endif
1296
1297
1298
1299 // Call the bottleneck
1300 E3System_Bottleneck();
1301
1302
1303
1304 // Call our implementation
1305 return(E3Point2D_CrossProductTri(p1, p2, p3));
1306 }
1307
1308
1309
1310
1311
1312 //=============================================================================
1313 // Q3Vector3D_Cross : Quesa API entry point.
1314 //-----------------------------------------------------------------------------
1315 TQ3Vector3D *
Q3Vector3D_Cross(const TQ3Vector3D * v1,const TQ3Vector3D * v2,TQ3Vector3D * result)1316 Q3Vector3D_Cross(const TQ3Vector3D *v1, const TQ3Vector3D *v2, TQ3Vector3D *result)
1317 {
1318
1319
1320 // Release build checks
1321 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v1), NULL);
1322 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v2), NULL);
1323 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
1324
1325
1326
1327 // Debug build checks
1328 #if Q3_DEBUG
1329 if (0) // Further checks on v1
1330 return(NULL);
1331
1332 if (0) // Further checks on v2
1333 return(NULL);
1334
1335 if (0) // Further checks on result
1336 return(NULL);
1337 #endif
1338
1339
1340
1341 // Call the bottleneck
1342 E3System_Bottleneck();
1343
1344
1345
1346 // Call our implementation
1347 return(E3Vector3D_Cross(v1, v2, result));
1348 }
1349
1350
1351
1352
1353
1354 //=============================================================================
1355 // Q3Point3D_CrossProductTri : Quesa API entry point.
1356 //-----------------------------------------------------------------------------
1357 TQ3Vector3D *
Q3Point3D_CrossProductTri(const TQ3Point3D * p1,const TQ3Point3D * p2,const TQ3Point3D * p3,TQ3Vector3D * result)1358 Q3Point3D_CrossProductTri(const TQ3Point3D *p1, const TQ3Point3D *p2, const TQ3Point3D *p3, TQ3Vector3D *result)
1359 {
1360
1361
1362 // Release build checks
1363 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), NULL);
1364 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), NULL);
1365 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p3), NULL);
1366 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
1367
1368
1369
1370 // Debug build checks
1371 #if Q3_DEBUG
1372 if (0) // Further checks on p1
1373 return(NULL);
1374
1375 if (0) // Further checks on p2
1376 return(NULL);
1377
1378 if (0) // Further checks on p3
1379 return(NULL);
1380
1381 if (0) // Further checks on result
1382 return(NULL);
1383 #endif
1384
1385
1386
1387 // Call the bottleneck
1388 E3System_Bottleneck();
1389
1390
1391
1392 // Call our implementation
1393 return(E3Point3D_CrossProductTri(p1, p2, p3, result));
1394 }
1395
1396
1397
1398
1399
1400 //=============================================================================
1401 // Q3Triangle_CrossProductArray : Quesa API entry point.
1402 //-----------------------------------------------------------------------------
1403 TQ3Status
Q3Triangle_CrossProductArray(TQ3Uns32 numTriangles,const TQ3Uns8 * usageFlags,const TQ3Uns32 * theIndices,const TQ3Point3D * thePoints,TQ3Vector3D * theNormals)1404 Q3Triangle_CrossProductArray(TQ3Uns32 numTriangles,
1405 const TQ3Uns8 *usageFlags,
1406 const TQ3Uns32 *theIndices,
1407 const TQ3Point3D *thePoints,
1408 TQ3Vector3D *theNormals)
1409 {
1410
1411
1412 // Release build checks
1413 Q3_REQUIRE_OR_RESULT(numTriangles != 0, kQ3Failure);
1414 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(theIndices), kQ3Failure);
1415 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(thePoints), kQ3Failure);
1416 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(theNormals), kQ3Failure);
1417
1418
1419
1420 // Debug build checks
1421 #if Q3_DEBUG
1422 if (0) // Further checks on numTriangles
1423 return(kQ3Failure);
1424
1425 if (0) // Further checks on usageFlags
1426 return(kQ3Failure);
1427
1428 if (0) // Further checks on theIndices
1429 return(kQ3Failure);
1430
1431 if (0) // Further checks on thePoints
1432 return(kQ3Failure);
1433
1434 if (0) // Further checks on theNormals
1435 return(kQ3Failure);
1436 #endif
1437
1438
1439
1440 // Call the bottleneck
1441 E3System_Bottleneck();
1442
1443
1444
1445 // Call our implementation
1446 return(E3Triangle_CrossProductArray(numTriangles, usageFlags, theIndices, thePoints, theNormals));
1447 }
1448
1449
1450
1451
1452
1453 //=============================================================================
1454 // Q3Vector2D_Length : Quesa API entry point.
1455 //-----------------------------------------------------------------------------
1456 #pragma mark -
1457 float
Q3Vector2D_Length(const TQ3Vector2D * vector2D)1458 Q3Vector2D_Length(const TQ3Vector2D *vector2D)
1459 {
1460
1461
1462 // Release build checks
1463 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector2D), 0.0f);
1464
1465
1466
1467 // Debug build checks
1468 #if Q3_DEBUG
1469 if (0) // Further checks on vector2D
1470 return(0.0f);
1471 #endif
1472
1473
1474
1475 // Call the bottleneck
1476 E3System_Bottleneck();
1477
1478
1479
1480 // Call our implementation
1481 return(E3Vector2D_Length(vector2D));
1482 }
1483
1484
1485
1486
1487
1488 //=============================================================================
1489 // Q3Vector2D_LengthSquared : Quesa API entry point.
1490 //-----------------------------------------------------------------------------
1491 float
Q3Vector2D_LengthSquared(const TQ3Vector2D * vector2D)1492 Q3Vector2D_LengthSquared(const TQ3Vector2D *vector2D)
1493 {
1494
1495
1496 // Release build checks
1497 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector2D), 0.0f);
1498
1499
1500
1501 // Debug build checks
1502 #if Q3_DEBUG
1503 if (0) // Further checks on vector2D
1504 return(0.0f);
1505 #endif
1506
1507
1508
1509 // Call the bottleneck
1510 E3System_Bottleneck();
1511
1512
1513
1514 // Call our implementation
1515 return(E3Vector2D_LengthSquared(vector2D));
1516 }
1517
1518
1519
1520
1521
1522 //=============================================================================
1523 // Q3Vector3D_Length : Quesa API entry point.
1524 //-----------------------------------------------------------------------------
1525 float
Q3Vector3D_Length(const TQ3Vector3D * vector3D)1526 Q3Vector3D_Length(const TQ3Vector3D *vector3D)
1527 {
1528
1529
1530 // Release build checks
1531 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector3D), 0.0f);
1532
1533
1534
1535 // Debug build checks
1536 #if Q3_DEBUG
1537 if (0) // Further checks on vector3D
1538 return(0.0f);
1539 #endif
1540
1541
1542
1543 // Call the bottleneck
1544 E3System_Bottleneck();
1545
1546
1547
1548 // Call our implementation
1549 return(E3Vector3D_Length(vector3D));
1550 }
1551
1552
1553
1554
1555
1556 //=============================================================================
1557 // Q3Vector3D_LengthSquared : Quesa API entry point.
1558 //-----------------------------------------------------------------------------
1559 float
Q3Vector3D_LengthSquared(const TQ3Vector3D * vector3D)1560 Q3Vector3D_LengthSquared(const TQ3Vector3D *vector3D)
1561 {
1562
1563
1564 // Release build checks
1565 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector3D), 0.0f);
1566
1567
1568
1569 // Debug build checks
1570 #if Q3_DEBUG
1571 if (0) // Further checks on vector3D
1572 return(0.0f);
1573 #endif
1574
1575
1576
1577 // Call the bottleneck
1578 E3System_Bottleneck();
1579
1580
1581
1582 // Call our implementation
1583 return(E3Vector3D_LengthSquared(vector3D));
1584 }
1585
1586
1587
1588
1589
1590 //=============================================================================
1591 // Q3Point2D_Distance : Quesa API entry point.
1592 //-----------------------------------------------------------------------------
1593 #pragma mark -
1594 float
Q3Point2D_Distance(const TQ3Point2D * p1,const TQ3Point2D * p2)1595 Q3Point2D_Distance(const TQ3Point2D *p1, const TQ3Point2D *p2)
1596 {
1597
1598
1599 // Release build checks
1600 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), 0.0f);
1601 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), 0.0f);
1602
1603
1604
1605 // Debug build checks
1606 #if Q3_DEBUG
1607 if (0) // Further checks on p1
1608 return(0.0f);
1609
1610 if (0) // Further checks on p2
1611 return(0.0f);
1612 #endif
1613
1614
1615
1616 // Call the bottleneck
1617 E3System_Bottleneck();
1618
1619
1620
1621 // Call our implementation
1622 return(E3Point2D_Distance(p1, p2));
1623 }
1624
1625
1626
1627
1628
1629 //=============================================================================
1630 // Q3Point2D_DistanceSquared : Quesa API entry point.
1631 //-----------------------------------------------------------------------------
1632 float
Q3Point2D_DistanceSquared(const TQ3Point2D * p1,const TQ3Point2D * p2)1633 Q3Point2D_DistanceSquared(const TQ3Point2D *p1, const TQ3Point2D *p2)
1634 {
1635
1636
1637 // Release build checks
1638 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), 0.0f);
1639 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), 0.0f);
1640
1641
1642
1643 // Debug build checks
1644 #if Q3_DEBUG
1645 if (0) // Further checks on p1
1646 return(0.0f);
1647
1648 if (0) // Further checks on p2
1649 return(0.0f);
1650 #endif
1651
1652
1653
1654 // Call the bottleneck
1655 E3System_Bottleneck();
1656
1657
1658
1659 // Call our implementation
1660 return(E3Point2D_DistanceSquared(p1, p2));
1661 }
1662
1663
1664
1665
1666
1667 //=============================================================================
1668 // Q3Param2D_Distance : Quesa API entry point.
1669 //-----------------------------------------------------------------------------
1670 float
Q3Param2D_Distance(const TQ3Param2D * p1,const TQ3Param2D * p2)1671 Q3Param2D_Distance(const TQ3Param2D *p1, const TQ3Param2D *p2)
1672 {
1673
1674
1675 // Release build checks
1676 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), 0.0f);
1677 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), 0.0f);
1678
1679
1680
1681 // Debug build checks
1682 #if Q3_DEBUG
1683 if (0) // Further checks on p1
1684 return(0.0f);
1685
1686 if (0) // Further checks on p2
1687 return(0.0f);
1688 #endif
1689
1690
1691
1692 // Call the bottleneck
1693 E3System_Bottleneck();
1694
1695
1696
1697 // Call our implementation
1698 return(E3Param2D_Distance(p1, p2));
1699 }
1700
1701
1702
1703
1704
1705 //=============================================================================
1706 // Q3Param2D_DistanceSquared : Quesa API entry point.
1707 //-----------------------------------------------------------------------------
1708 float
Q3Param2D_DistanceSquared(const TQ3Param2D * p1,const TQ3Param2D * p2)1709 Q3Param2D_DistanceSquared(const TQ3Param2D *p1, const TQ3Param2D *p2)
1710 {
1711
1712
1713 // Release build checks
1714 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), 0.0f);
1715 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), 0.0f);
1716
1717
1718
1719 // Debug build checks
1720 #if Q3_DEBUG
1721 if (0) // Further checks on p1
1722 return(0.0f);
1723
1724 if (0) // Further checks on p2
1725 return(0.0f);
1726 #endif
1727
1728
1729
1730 // Call the bottleneck
1731 E3System_Bottleneck();
1732
1733
1734
1735 // Call our implementation
1736 return(E3Param2D_DistanceSquared(p1, p2));
1737 }
1738
1739
1740
1741
1742
1743 //=============================================================================
1744 // Q3RationalPoint3D_Distance : Quesa API entry point.
1745 //-----------------------------------------------------------------------------
1746 float
Q3RationalPoint3D_Distance(const TQ3RationalPoint3D * p1,const TQ3RationalPoint3D * p2)1747 Q3RationalPoint3D_Distance(const TQ3RationalPoint3D *p1, const TQ3RationalPoint3D *p2)
1748 {
1749
1750
1751 // Release build checks
1752 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), 0.0f);
1753 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), 0.0f);
1754
1755
1756
1757 // Debug build checks
1758 #if Q3_DEBUG
1759 if (0) // Further checks on p1
1760 return(0.0f);
1761
1762 if (0) // Further checks on p2
1763 return(0.0f);
1764 #endif
1765
1766
1767
1768 // Call the bottleneck
1769 E3System_Bottleneck();
1770
1771
1772
1773 // Call our implementation
1774 return(E3RationalPoint3D_Distance(p1, p2));
1775 }
1776
1777
1778
1779
1780
1781 //=============================================================================
1782 // Q3RationalPoint3D_DistanceSquared : Quesa API entry point.
1783 //-----------------------------------------------------------------------------
1784 float
Q3RationalPoint3D_DistanceSquared(const TQ3RationalPoint3D * p1,const TQ3RationalPoint3D * p2)1785 Q3RationalPoint3D_DistanceSquared(const TQ3RationalPoint3D *p1, const TQ3RationalPoint3D *p2)
1786 {
1787
1788
1789 // Release build checks
1790 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), 0.0f);
1791 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), 0.0f);
1792
1793
1794
1795 // Debug build checks
1796 #if Q3_DEBUG
1797 if (0) // Further checks on p1
1798 return(0.0f);
1799
1800 if (0) // Further checks on p2
1801 return(0.0f);
1802 #endif
1803
1804
1805
1806 // Call the bottleneck
1807 E3System_Bottleneck();
1808
1809
1810
1811 // Call our implementation
1812 return(E3RationalPoint3D_DistanceSquared(p1, p2));
1813 }
1814
1815
1816
1817
1818
1819 //=============================================================================
1820 // Q3Point3D_Distance : Quesa API entry point.
1821 //-----------------------------------------------------------------------------
1822 float
Q3Point3D_Distance(const TQ3Point3D * p1,const TQ3Point3D * p2)1823 Q3Point3D_Distance(const TQ3Point3D *p1, const TQ3Point3D *p2)
1824 {
1825
1826
1827 // Release build checks
1828 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), 0.0f);
1829 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), 0.0f);
1830
1831
1832
1833 // Debug build checks
1834 #if Q3_DEBUG
1835 if (0) // Further checks on p1
1836 return(0.0f);
1837
1838 if (0) // Further checks on p2
1839 return(0.0f);
1840 #endif
1841
1842
1843
1844 // Call the bottleneck
1845 E3System_Bottleneck();
1846
1847
1848
1849 // Call our implementation
1850 return(E3Point3D_Distance(p1, p2));
1851 }
1852
1853
1854
1855
1856
1857 //=============================================================================
1858 // Q3Point3D_DistanceSquared : Quesa API entry point.
1859 //-----------------------------------------------------------------------------
1860 float
Q3Point3D_DistanceSquared(const TQ3Point3D * p1,const TQ3Point3D * p2)1861 Q3Point3D_DistanceSquared(const TQ3Point3D *p1, const TQ3Point3D *p2)
1862 {
1863
1864
1865 // Release build checks
1866 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), 0.0f);
1867 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), 0.0f);
1868
1869
1870
1871 // Debug build checks
1872 #if Q3_DEBUG
1873 if (0) // Further checks on p1
1874 return(0.0f);
1875
1876 if (0) // Further checks on p2
1877 return(0.0f);
1878 #endif
1879
1880
1881
1882 // Call the bottleneck
1883 E3System_Bottleneck();
1884
1885
1886
1887 // Call our implementation
1888 return(E3Point3D_DistanceSquared(p1, p2));
1889 }
1890
1891
1892
1893
1894
1895 //=============================================================================
1896 // Q3RationalPoint4D_Distance : Quesa API entry point.
1897 //-----------------------------------------------------------------------------
1898 float
Q3RationalPoint4D_Distance(const TQ3RationalPoint4D * p1,const TQ3RationalPoint4D * p2)1899 Q3RationalPoint4D_Distance(const TQ3RationalPoint4D *p1, const TQ3RationalPoint4D *p2)
1900 {
1901
1902
1903 // Release build checks
1904 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), 0.0f);
1905 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), 0.0f);
1906
1907
1908
1909 // Debug build checks
1910 #if Q3_DEBUG
1911 if (0) // Further checks on p1
1912 return(0.0f);
1913
1914 if (0) // Further checks on p2
1915 return(0.0f);
1916 #endif
1917
1918
1919
1920 // Call the bottleneck
1921 E3System_Bottleneck();
1922
1923
1924
1925 // Call our implementation
1926 return(E3RationalPoint4D_Distance(p1, p2));
1927 }
1928
1929
1930
1931
1932
1933 //=============================================================================
1934 // Q3RationalPoint4D_DistanceSquared : Quesa API entry point.
1935 //-----------------------------------------------------------------------------
1936 float
Q3RationalPoint4D_DistanceSquared(const TQ3RationalPoint4D * p1,const TQ3RationalPoint4D * p2)1937 Q3RationalPoint4D_DistanceSquared(const TQ3RationalPoint4D *p1, const TQ3RationalPoint4D *p2)
1938 {
1939
1940
1941 // Release build checks
1942 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), 0.0f);
1943 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), 0.0f);
1944
1945
1946
1947 // Debug build checks
1948 #if Q3_DEBUG
1949 if (0) // Further checks on p1
1950 return(0.0f);
1951
1952 if (0) // Further checks on p2
1953 return(0.0f);
1954 #endif
1955
1956
1957
1958 // Call the bottleneck
1959 E3System_Bottleneck();
1960
1961
1962
1963 // Call our implementation
1964 return(E3RationalPoint4D_DistanceSquared(p1, p2));
1965 }
1966
1967
1968
1969
1970
1971 //=============================================================================
1972 // Q3Vector2D_Negate : Quesa API entry point.
1973 //-----------------------------------------------------------------------------
1974 #pragma mark -
1975 TQ3Vector2D *
Q3Vector2D_Negate(const TQ3Vector2D * vector2D,TQ3Vector2D * result)1976 Q3Vector2D_Negate(const TQ3Vector2D *vector2D, TQ3Vector2D *result)
1977 {
1978
1979
1980 // Release build checks
1981 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector2D), NULL);
1982 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
1983
1984
1985
1986 // Debug build checks
1987 #if Q3_DEBUG
1988 if (0) // Further checks on vector2D
1989 return(NULL);
1990
1991 if (0) // Further checks on result
1992 return(NULL);
1993 #endif
1994
1995
1996
1997 // Call the bottleneck
1998 E3System_Bottleneck();
1999
2000
2001
2002 // Call our implementation
2003 return(E3Vector2D_Negate(vector2D, result));
2004 }
2005
2006
2007
2008
2009
2010 //=============================================================================
2011 // Q3Vector3D_Negate : Quesa API entry point.
2012 //-----------------------------------------------------------------------------
2013 TQ3Vector3D *
Q3Vector3D_Negate(const TQ3Vector3D * vector3D,TQ3Vector3D * result)2014 Q3Vector3D_Negate(const TQ3Vector3D *vector3D, TQ3Vector3D *result)
2015 {
2016
2017
2018 // Release build checks
2019 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector3D), NULL);
2020 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2021
2022
2023
2024 // Debug build checks
2025 #if Q3_DEBUG
2026 if (0) // Further checks on vector3D
2027 return(NULL);
2028
2029 if (0) // Further checks on result
2030 return(NULL);
2031 #endif
2032
2033
2034
2035 // Call the bottleneck
2036 E3System_Bottleneck();
2037
2038
2039
2040 // Call our implementation
2041 return(E3Vector3D_Negate(vector3D, result));
2042 }
2043
2044
2045
2046
2047
2048 //=============================================================================
2049 // Q3Vector2D_Scale : Quesa API entry point.
2050 //-----------------------------------------------------------------------------
2051 #pragma mark -
2052 TQ3Vector2D *
Q3Vector2D_Scale(const TQ3Vector2D * vector2D,float scalar,TQ3Vector2D * result)2053 Q3Vector2D_Scale(const TQ3Vector2D *vector2D, float scalar, TQ3Vector2D *result)
2054 {
2055
2056
2057 // Release build checks
2058 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector2D), NULL);
2059 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2060
2061
2062
2063 // Debug build checks
2064 #if Q3_DEBUG
2065 if (0) // Further checks on vector2D
2066 return(NULL);
2067
2068 if (0) // Further checks on scalar
2069 return(NULL);
2070
2071 if (0) // Further checks on result
2072 return(NULL);
2073 #endif
2074
2075
2076
2077 // Call the bottleneck
2078 E3System_Bottleneck();
2079
2080
2081
2082 // Call our implementation
2083 return(E3Vector2D_Scale(vector2D, scalar, result));
2084 }
2085
2086
2087
2088
2089
2090 //=============================================================================
2091 // Q3Vector3D_Scale : Quesa API entry point.
2092 //-----------------------------------------------------------------------------
2093 TQ3Vector3D *
Q3Vector3D_Scale(const TQ3Vector3D * vector3D,float scalar,TQ3Vector3D * result)2094 Q3Vector3D_Scale(const TQ3Vector3D *vector3D, float scalar, TQ3Vector3D *result)
2095 {
2096
2097
2098 // Release build checks
2099 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector3D), NULL);
2100 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2101
2102
2103
2104 // Debug build checks
2105 #if Q3_DEBUG
2106 if (0) // Further checks on vector3D
2107 return(NULL);
2108
2109 if (0) // Further checks on scalar
2110 return(NULL);
2111
2112 if (0) // Further checks on result
2113 return(NULL);
2114 #endif
2115
2116
2117
2118 // Call the bottleneck
2119 E3System_Bottleneck();
2120
2121
2122
2123 // Call our implementation
2124 return(E3Vector3D_Scale(vector3D, scalar, result));
2125 }
2126
2127
2128
2129
2130
2131 //=============================================================================
2132 // Q3Vector2D_Normalize : Quesa API entry point.
2133 //-----------------------------------------------------------------------------
2134 #pragma mark -
2135 TQ3Vector2D *
Q3Vector2D_Normalize(const TQ3Vector2D * vector2D,TQ3Vector2D * result)2136 Q3Vector2D_Normalize(const TQ3Vector2D *vector2D, TQ3Vector2D *result)
2137 {
2138
2139
2140 // Release build checks
2141 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector2D), NULL);
2142 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2143
2144
2145
2146 // Debug build checks
2147 #if Q3_DEBUG
2148 if (0) // Further checks on vector2D
2149 return(NULL);
2150
2151 if (0) // Further checks on result
2152 return(NULL);
2153 #endif
2154
2155
2156
2157 // Call the bottleneck
2158 E3System_Bottleneck();
2159
2160
2161
2162 // Call our implementation
2163 return(E3Vector2D_Normalize(vector2D, result));
2164 }
2165
2166
2167
2168
2169
2170 //=============================================================================
2171 // Q3Vector3D_Normalize : Quesa API entry point.
2172 //-----------------------------------------------------------------------------
2173 TQ3Vector3D *
Q3Vector3D_Normalize(const TQ3Vector3D * vector3D,TQ3Vector3D * result)2174 Q3Vector3D_Normalize(const TQ3Vector3D *vector3D, TQ3Vector3D *result)
2175 {
2176
2177
2178 // Release build checks
2179 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector3D), NULL);
2180 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2181
2182
2183
2184 // Debug build checks
2185 #if Q3_DEBUG
2186 if (0) // Further checks on vector3D
2187 return(NULL);
2188
2189 if (0) // Further checks on result
2190 return(NULL);
2191 #endif
2192
2193
2194
2195 // Call the bottleneck
2196 E3System_Bottleneck();
2197
2198
2199
2200 // Call our implementation
2201 return(E3Vector3D_Normalize(vector3D, result));
2202 }
2203
2204
2205
2206
2207
2208 //=============================================================================
2209 // Q3Vector2D_Add : Quesa API entry point.
2210 //-----------------------------------------------------------------------------
2211 #pragma mark -
2212 TQ3Vector2D *
Q3Vector2D_Add(const TQ3Vector2D * v1,const TQ3Vector2D * v2,TQ3Vector2D * result)2213 Q3Vector2D_Add(const TQ3Vector2D *v1, const TQ3Vector2D *v2, TQ3Vector2D *result)
2214 {
2215
2216
2217 // Release build checks
2218 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v1), NULL);
2219 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v2), NULL);
2220 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2221
2222
2223
2224 // Debug build checks
2225 #if Q3_DEBUG
2226 if (0) // Further checks on v1
2227 return(NULL);
2228
2229 if (0) // Further checks on v2
2230 return(NULL);
2231
2232 if (0) // Further checks on result
2233 return(NULL);
2234 #endif
2235
2236
2237
2238 // Call the bottleneck
2239 E3System_Bottleneck();
2240
2241
2242
2243 // Call our implementation
2244 return(E3Vector2D_Add(v1, v2, result));
2245 }
2246
2247
2248
2249
2250
2251 //=============================================================================
2252 // Q3Vector3D_Add : Quesa API entry point.
2253 //-----------------------------------------------------------------------------
2254 TQ3Vector3D *
Q3Vector3D_Add(const TQ3Vector3D * v1,const TQ3Vector3D * v2,TQ3Vector3D * result)2255 Q3Vector3D_Add(const TQ3Vector3D *v1, const TQ3Vector3D *v2, TQ3Vector3D *result)
2256 {
2257
2258
2259 // Release build checks
2260 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v1), NULL);
2261 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v2), NULL);
2262 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2263
2264
2265
2266 // Debug build checks
2267 #if Q3_DEBUG
2268 if (0) // Further checks on v1
2269 return(NULL);
2270
2271 if (0) // Further checks on v2
2272 return(NULL);
2273
2274 if (0) // Further checks on result
2275 return(NULL);
2276 #endif
2277
2278
2279
2280 // Call the bottleneck
2281 E3System_Bottleneck();
2282
2283
2284
2285 // Call our implementation
2286 return(E3Vector3D_Add(v1, v2, result));
2287 }
2288
2289
2290
2291
2292
2293 //=============================================================================
2294 // Q3Vector2D_Subtract : Quesa API entry point.
2295 //-----------------------------------------------------------------------------
2296 TQ3Vector2D *
Q3Vector2D_Subtract(const TQ3Vector2D * v1,const TQ3Vector2D * v2,TQ3Vector2D * result)2297 Q3Vector2D_Subtract(const TQ3Vector2D *v1, const TQ3Vector2D *v2, TQ3Vector2D *result)
2298 {
2299
2300
2301 // Release build checks
2302 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v1), NULL);
2303 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v2), NULL);
2304 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2305
2306
2307
2308 // Debug build checks
2309 #if Q3_DEBUG
2310 if (0) // Further checks on v1
2311 return(NULL);
2312
2313 if (0) // Further checks on v2
2314 return(NULL);
2315
2316 if (0) // Further checks on result
2317 return(NULL);
2318 #endif
2319
2320
2321
2322 // Call the bottleneck
2323 E3System_Bottleneck();
2324
2325
2326
2327 // Call our implementation
2328 return(E3Vector2D_Subtract(v1, v2, result));
2329 }
2330
2331
2332
2333
2334
2335 //=============================================================================
2336 // Q3Vector3D_Subtract : Quesa API entry point.
2337 //-----------------------------------------------------------------------------
2338 TQ3Vector3D *
Q3Vector3D_Subtract(const TQ3Vector3D * v1,const TQ3Vector3D * v2,TQ3Vector3D * result)2339 Q3Vector3D_Subtract(const TQ3Vector3D *v1, const TQ3Vector3D *v2, TQ3Vector3D *result)
2340 {
2341
2342
2343 // Release build checks
2344 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v1), NULL);
2345 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v2), NULL);
2346 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2347
2348
2349
2350 // Debug build checks
2351 #if Q3_DEBUG
2352 if (0) // Further checks on v1
2353 return(NULL);
2354
2355 if (0) // Further checks on v2
2356 return(NULL);
2357
2358 if (0) // Further checks on result
2359 return(NULL);
2360 #endif
2361
2362
2363
2364 // Call the bottleneck
2365 E3System_Bottleneck();
2366
2367
2368
2369 // Call our implementation
2370 return(E3Vector3D_Subtract(v1, v2, result));
2371 }
2372
2373
2374
2375
2376
2377 //=============================================================================
2378 // Q3Point2D_Vector2D_Add : Quesa API entry point.
2379 //-----------------------------------------------------------------------------
2380 #pragma mark -
2381 TQ3Point2D *
Q3Point2D_Vector2D_Add(const TQ3Point2D * point2D,const TQ3Vector2D * vector2D,TQ3Point2D * result)2382 Q3Point2D_Vector2D_Add(const TQ3Point2D *point2D, const TQ3Vector2D *vector2D, TQ3Point2D *result)
2383 {
2384
2385
2386 // Release build checks
2387 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point2D), NULL);
2388 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector2D), NULL);
2389 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2390
2391
2392
2393 // Debug build checks
2394 #if Q3_DEBUG
2395 if (0) // Further checks on point2D
2396 return(NULL);
2397
2398 if (0) // Further checks on vector2D
2399 return(NULL);
2400
2401 if (0) // Further checks on result
2402 return(NULL);
2403 #endif
2404
2405
2406
2407 // Call the bottleneck
2408 E3System_Bottleneck();
2409
2410
2411
2412 // Call our implementation
2413 return(E3Point2D_Vector2D_Add(point2D, vector2D, result));
2414 }
2415
2416
2417
2418
2419
2420 //=============================================================================
2421 // Q3Param2D_Vector2D_Add : Quesa API entry point.
2422 //-----------------------------------------------------------------------------
2423 TQ3Param2D *
Q3Param2D_Vector2D_Add(const TQ3Param2D * param2D,const TQ3Vector2D * vector2D,TQ3Param2D * result)2424 Q3Param2D_Vector2D_Add(const TQ3Param2D *param2D, const TQ3Vector2D *vector2D, TQ3Param2D *result)
2425 {
2426
2427
2428 // Release build checks
2429 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(param2D), NULL);
2430 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector2D), NULL);
2431 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2432
2433
2434
2435 // Debug build checks
2436 #if Q3_DEBUG
2437 if (0) // Further checks on param2D
2438 return(NULL);
2439
2440 if (0) // Further checks on vector2D
2441 return(NULL);
2442
2443 if (0) // Further checks on result
2444 return(NULL);
2445 #endif
2446
2447
2448
2449 // Call the bottleneck
2450 E3System_Bottleneck();
2451
2452
2453
2454 // Call our implementation
2455 return(E3Param2D_Vector2D_Add(param2D, vector2D, result));
2456 }
2457
2458
2459
2460
2461
2462 //=============================================================================
2463 // Q3Point3D_Vector3D_Add : Quesa API entry point.
2464 //-----------------------------------------------------------------------------
2465 TQ3Point3D *
Q3Point3D_Vector3D_Add(const TQ3Point3D * point3D,const TQ3Vector3D * vector3D,TQ3Point3D * result)2466 Q3Point3D_Vector3D_Add(const TQ3Point3D *point3D, const TQ3Vector3D *vector3D, TQ3Point3D *result)
2467 {
2468
2469
2470 // Release build checks
2471 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point3D), NULL);
2472 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector3D), NULL);
2473 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2474
2475
2476
2477 // Debug build checks
2478 #if Q3_DEBUG
2479 if (0) // Further checks on point3D
2480 return(NULL);
2481
2482 if (0) // Further checks on vector3D
2483 return(NULL);
2484
2485 if (0) // Further checks on result
2486 return(NULL);
2487 #endif
2488
2489
2490
2491 // Call the bottleneck
2492 E3System_Bottleneck();
2493
2494
2495
2496 // Call our implementation
2497 return(E3Point3D_Vector3D_Add(point3D, vector3D, result));
2498 }
2499
2500
2501
2502
2503
2504 //=============================================================================
2505 // Q3Point2D_Vector2D_Subtract : Quesa API entry point.
2506 //-----------------------------------------------------------------------------
2507 TQ3Point2D *
Q3Point2D_Vector2D_Subtract(const TQ3Point2D * point2D,const TQ3Vector2D * vector2D,TQ3Point2D * result)2508 Q3Point2D_Vector2D_Subtract(const TQ3Point2D *point2D, const TQ3Vector2D *vector2D, TQ3Point2D *result)
2509 {
2510
2511
2512 // Release build checks
2513 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point2D), NULL);
2514 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector2D), NULL);
2515 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2516
2517
2518
2519 // Debug build checks
2520 #if Q3_DEBUG
2521 if (0) // Further checks on point2D
2522 return(NULL);
2523
2524 if (0) // Further checks on vector2D
2525 return(NULL);
2526
2527 if (0) // Further checks on result
2528 return(NULL);
2529 #endif
2530
2531
2532
2533 // Call the bottleneck
2534 E3System_Bottleneck();
2535
2536
2537
2538 // Call our implementation
2539 return(E3Point2D_Vector2D_Subtract(point2D, vector2D, result));
2540 }
2541
2542
2543
2544
2545
2546 //=============================================================================
2547 // Q3Param2D_Vector2D_Subtract : Quesa API entry point.
2548 //-----------------------------------------------------------------------------
2549 TQ3Param2D *
Q3Param2D_Vector2D_Subtract(const TQ3Param2D * param2D,const TQ3Vector2D * vector2D,TQ3Param2D * result)2550 Q3Param2D_Vector2D_Subtract(const TQ3Param2D *param2D, const TQ3Vector2D *vector2D, TQ3Param2D *result)
2551 {
2552
2553
2554 // Release build checks
2555 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(param2D), NULL);
2556 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector2D), NULL);
2557 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2558
2559
2560
2561 // Debug build checks
2562 #if Q3_DEBUG
2563 if (0) // Further checks on param2D
2564 return(NULL);
2565
2566 if (0) // Further checks on vector2D
2567 return(NULL);
2568
2569 if (0) // Further checks on result
2570 return(NULL);
2571 #endif
2572
2573
2574
2575 // Call the bottleneck
2576 E3System_Bottleneck();
2577
2578
2579
2580 // Call our implementation
2581 return(E3Param2D_Vector2D_Subtract(param2D, vector2D, result));
2582 }
2583
2584
2585
2586
2587
2588 //=============================================================================
2589 // Q3Point3D_Vector3D_Subtract : Quesa API entry point.
2590 //-----------------------------------------------------------------------------
2591 TQ3Point3D *
Q3Point3D_Vector3D_Subtract(const TQ3Point3D * point3D,const TQ3Vector3D * vector3D,TQ3Point3D * result)2592 Q3Point3D_Vector3D_Subtract(const TQ3Point3D *point3D, const TQ3Vector3D *vector3D, TQ3Point3D *result)
2593 {
2594
2595
2596 // Release build checks
2597 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point3D), NULL);
2598 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector3D), NULL);
2599 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2600
2601
2602
2603 // Debug build checks
2604 #if Q3_DEBUG
2605 if (0) // Further checks on point3D
2606 return(NULL);
2607
2608 if (0) // Further checks on vector3D
2609 return(NULL);
2610
2611 if (0) // Further checks on result
2612 return(NULL);
2613 #endif
2614
2615
2616
2617 // Call the bottleneck
2618 E3System_Bottleneck();
2619
2620
2621
2622 // Call our implementation
2623 return(E3Point3D_Vector3D_Subtract(point3D, vector3D, result));
2624 }
2625
2626
2627
2628
2629
2630 //=============================================================================
2631 // Q3Point2D_Subtract : Quesa API entry point.
2632 //-----------------------------------------------------------------------------
2633 #pragma mark -
2634 TQ3Vector2D *
Q3Point2D_Subtract(const TQ3Point2D * p1,const TQ3Point2D * p2,TQ3Vector2D * result)2635 Q3Point2D_Subtract(const TQ3Point2D *p1, const TQ3Point2D *p2, TQ3Vector2D *result)
2636 {
2637
2638
2639 // Release build checks
2640 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), NULL);
2641 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), NULL);
2642 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2643
2644
2645
2646 // Debug build checks
2647 #if Q3_DEBUG
2648 if (0) // Further checks on p1
2649 return(NULL);
2650
2651 if (0) // Further checks on p2
2652 return(NULL);
2653
2654 if (0) // Further checks on result
2655 return(NULL);
2656 #endif
2657
2658
2659
2660 // Call the bottleneck
2661 E3System_Bottleneck();
2662
2663
2664
2665 // Call our implementation
2666 return(E3Point2D_Subtract(p1, p2, result));
2667 }
2668
2669
2670
2671
2672
2673 //=============================================================================
2674 // Q3Param2D_Subtract : Quesa API entry point.
2675 //-----------------------------------------------------------------------------
2676 TQ3Vector2D *
Q3Param2D_Subtract(const TQ3Param2D * p1,const TQ3Param2D * p2,TQ3Vector2D * result)2677 Q3Param2D_Subtract(const TQ3Param2D *p1, const TQ3Param2D *p2, TQ3Vector2D *result)
2678 {
2679
2680
2681 // Release build checks
2682 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), NULL);
2683 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), NULL);
2684 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2685
2686
2687
2688 // Debug build checks
2689 #if Q3_DEBUG
2690 if (0) // Further checks on p1
2691 return(NULL);
2692
2693 if (0) // Further checks on p2
2694 return(NULL);
2695
2696 if (0) // Further checks on result
2697 return(NULL);
2698 #endif
2699
2700
2701
2702 // Call the bottleneck
2703 E3System_Bottleneck();
2704
2705
2706
2707 // Call our implementation
2708 return(E3Param2D_Subtract(p1, p2, result));
2709 }
2710
2711
2712
2713
2714
2715 //=============================================================================
2716 // Q3Point3D_Subtract : Quesa API entry point.
2717 //-----------------------------------------------------------------------------
2718 TQ3Vector3D *
Q3Point3D_Subtract(const TQ3Point3D * p1,const TQ3Point3D * p2,TQ3Vector3D * result)2719 Q3Point3D_Subtract(const TQ3Point3D *p1, const TQ3Point3D *p2, TQ3Vector3D *result)
2720 {
2721
2722
2723 // Release build checks
2724 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), NULL);
2725 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), NULL);
2726 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2727
2728
2729
2730 // Debug build checks
2731 #if Q3_DEBUG
2732 if (0) // Further checks on p1
2733 return(NULL);
2734
2735 if (0) // Further checks on p2
2736 return(NULL);
2737
2738 if (0) // Further checks on result
2739 return(NULL);
2740 #endif
2741
2742
2743
2744 // Call the bottleneck
2745 E3System_Bottleneck();
2746
2747
2748
2749 // Call our implementation
2750 return(E3Point3D_Subtract(p1, p2, result));
2751 }
2752
2753
2754
2755
2756
2757 //=============================================================================
2758 // Q3Point2D_RRatio : Quesa API entry point.
2759 //-----------------------------------------------------------------------------
2760 #pragma mark -
2761 TQ3Point2D *
Q3Point2D_RRatio(const TQ3Point2D * p1,const TQ3Point2D * p2,float r1,float r2,TQ3Point2D * result)2762 Q3Point2D_RRatio(const TQ3Point2D *p1, const TQ3Point2D *p2, float r1, float r2, TQ3Point2D *result)
2763 {
2764
2765
2766 // Release build checks
2767 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), NULL);
2768 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), NULL);
2769 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2770
2771
2772
2773 // Debug build checks
2774 #if Q3_DEBUG
2775 if (0) // Further checks on p1
2776 return(NULL);
2777
2778 if (0) // Further checks on p2
2779 return(NULL);
2780
2781 if ((r1 + r2) == 0.0f)
2782 return(NULL);
2783
2784 if (0) // Further checks on result
2785 return(NULL);
2786 #endif
2787
2788
2789
2790 // Call the bottleneck
2791 E3System_Bottleneck();
2792
2793
2794
2795 // Call our implementation
2796 return(E3Point2D_RRatio(p1, p2, r1, r2, result));
2797 }
2798
2799
2800
2801
2802
2803 //=============================================================================
2804 // Q3Param2D_RRatio : Quesa API entry point.
2805 //-----------------------------------------------------------------------------
2806 TQ3Param2D *
Q3Param2D_RRatio(const TQ3Param2D * p1,const TQ3Param2D * p2,float r1,float r2,TQ3Param2D * result)2807 Q3Param2D_RRatio(const TQ3Param2D *p1, const TQ3Param2D *p2, float r1, float r2, TQ3Param2D *result)
2808 {
2809
2810
2811 // Release build checks
2812 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), NULL);
2813 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), NULL);
2814 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2815
2816
2817
2818 // Debug build checks
2819 #if Q3_DEBUG
2820 if (0) // Further checks on p1
2821 return(NULL);
2822
2823 if (0) // Further checks on p2
2824 return(NULL);
2825
2826 if (0) // Further checks on r1
2827 return(NULL);
2828
2829 if (0) // Further checks on r2
2830 return(NULL);
2831
2832 if (0) // Further checks on result
2833 return(NULL);
2834 #endif
2835
2836
2837
2838 // Call the bottleneck
2839 E3System_Bottleneck();
2840
2841
2842
2843 // Call our implementation
2844 return(E3Param2D_RRatio(p1, p2, r1, r2, result));
2845 }
2846
2847
2848
2849
2850
2851 //=============================================================================
2852 // Q3Point3D_RRatio : Quesa API entry point.
2853 //-----------------------------------------------------------------------------
2854 TQ3Point3D *
Q3Point3D_RRatio(const TQ3Point3D * p1,const TQ3Point3D * p2,float r1,float r2,TQ3Point3D * result)2855 Q3Point3D_RRatio(const TQ3Point3D *p1, const TQ3Point3D *p2, float r1, float r2, TQ3Point3D *result)
2856 {
2857
2858
2859 // Release build checks
2860 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), NULL);
2861 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), NULL);
2862 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2863
2864
2865
2866 // Debug build checks
2867 #if Q3_DEBUG
2868 if (0) // Further checks on p1
2869 return(NULL);
2870
2871 if (0) // Further checks on p2
2872 return(NULL);
2873
2874 if ((r1 + r2) == 0.0f)
2875 return(NULL);
2876
2877 if (0) // Further checks on result
2878 return(NULL);
2879 #endif
2880
2881
2882
2883 // Call the bottleneck
2884 E3System_Bottleneck();
2885
2886
2887
2888 // Call our implementation
2889 return(E3Point3D_RRatio(p1, p2, r1, r2, result));
2890 }
2891
2892
2893
2894
2895
2896 //=============================================================================
2897 // Q3RationalPoint4D_RRatio : Quesa API entry point.
2898 //-----------------------------------------------------------------------------
2899 TQ3RationalPoint4D *
Q3RationalPoint4D_RRatio(const TQ3RationalPoint4D * p1,const TQ3RationalPoint4D * p2,float r1,float r2,TQ3RationalPoint4D * result)2900 Q3RationalPoint4D_RRatio(const TQ3RationalPoint4D *p1, const TQ3RationalPoint4D *p2, float r1, float r2, TQ3RationalPoint4D *result)
2901 {
2902
2903
2904 // Release build checks
2905 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p1), NULL);
2906 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(p2), NULL);
2907 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2908
2909
2910
2911 // Debug build checks
2912 #if Q3_DEBUG
2913 if (0) // Further checks on p1
2914 return(NULL);
2915
2916 if (0) // Further checks on p2
2917 return(NULL);
2918
2919 if ((r1 + r2) == 0.0f)
2920 return(NULL);
2921
2922 if (0) // Further checks on result
2923 return(NULL);
2924 #endif
2925
2926
2927
2928 // Call the bottleneck
2929 E3System_Bottleneck();
2930
2931
2932
2933 // Call our implementation
2934 return(E3RationalPoint4D_RRatio(p1, p2, r1, r2, result));
2935 }
2936
2937
2938
2939
2940
2941 //=============================================================================
2942 // Q3Point2D_AffineComb : Quesa API entry point.
2943 //-----------------------------------------------------------------------------
2944 #pragma mark -
2945 TQ3Point2D *
Q3Point2D_AffineComb(const TQ3Point2D * points2D,const float * weights,TQ3Uns32 numPoints,TQ3Point2D * result)2946 Q3Point2D_AffineComb(const TQ3Point2D *points2D, const float *weights, TQ3Uns32 numPoints, TQ3Point2D *result)
2947 {
2948
2949
2950 // Release build checks
2951 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(points2D), NULL);
2952 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(weights), NULL);
2953 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2954
2955
2956
2957 // Debug build checks
2958 #if Q3_DEBUG
2959 if (0) // Further checks on points2D
2960 return(NULL);
2961
2962 if (0) // Further checks on weights
2963 return(NULL);
2964
2965 if (0) // Further checks on numPoints
2966 return(NULL);
2967
2968 if (0) // Further checks on result
2969 return(NULL);
2970 #endif
2971
2972
2973
2974 // Call the bottleneck
2975 E3System_Bottleneck();
2976
2977
2978
2979 // Call our implementation
2980 return(E3Point2D_AffineComb(points2D, weights, numPoints, result));
2981 }
2982
2983
2984
2985
2986
2987 //=============================================================================
2988 // Q3Param2D_AffineComb : Quesa API entry point.
2989 //-----------------------------------------------------------------------------
2990 TQ3Param2D *
Q3Param2D_AffineComb(const TQ3Param2D * params2D,const float * weights,TQ3Uns32 numPoints,TQ3Param2D * result)2991 Q3Param2D_AffineComb(const TQ3Param2D *params2D, const float *weights, TQ3Uns32 numPoints, TQ3Param2D *result)
2992 {
2993
2994
2995 // Release build checks
2996 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(params2D), NULL);
2997 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(weights), NULL);
2998 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
2999
3000
3001
3002 // Debug build checks
3003 #if Q3_DEBUG
3004 if (0) // Further checks on params2D
3005 return(NULL);
3006
3007 if (0) // Further checks on weights
3008 return(NULL);
3009
3010 if (0) // Further checks on numPoints
3011 return(NULL);
3012
3013 if (0) // Further checks on result
3014 return(NULL);
3015 #endif
3016
3017
3018
3019 // Call the bottleneck
3020 E3System_Bottleneck();
3021
3022
3023
3024 // Call our implementation
3025 return(E3Param2D_AffineComb(params2D, weights, numPoints, result));
3026 }
3027
3028
3029
3030
3031
3032 //=============================================================================
3033 // Q3RationalPoint3D_AffineComb : Quesa API entry point.
3034 //-----------------------------------------------------------------------------
3035 TQ3RationalPoint3D *
Q3RationalPoint3D_AffineComb(const TQ3RationalPoint3D * rationalPoints3D,const float * weights,TQ3Uns32 numPoints,TQ3RationalPoint3D * result)3036 Q3RationalPoint3D_AffineComb(const TQ3RationalPoint3D *rationalPoints3D, const float *weights, TQ3Uns32 numPoints, TQ3RationalPoint3D *result)
3037 {
3038
3039
3040 // Release build checks
3041 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(rationalPoints3D), NULL);
3042 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(weights), NULL);
3043 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
3044
3045
3046
3047 // Debug build checks
3048 #if Q3_DEBUG
3049 if (0) // Further checks on rationalPoints3D
3050 return(NULL);
3051
3052 if (0) // Further checks on weights
3053 return(NULL);
3054
3055 if (0) // Further checks on numPoints
3056 return(NULL);
3057
3058 if (0) // Further checks on result
3059 return(NULL);
3060 #endif
3061
3062
3063
3064 // Call the bottleneck
3065 E3System_Bottleneck();
3066
3067
3068
3069 // Call our implementation
3070 return(E3RationalPoint3D_AffineComb(rationalPoints3D, weights, numPoints, result));
3071 }
3072
3073
3074
3075
3076
3077 //=============================================================================
3078 // Q3Point3D_AffineComb : Quesa API entry point.
3079 //-----------------------------------------------------------------------------
3080 TQ3Point3D *
Q3Point3D_AffineComb(const TQ3Point3D * points3D,const float * weights,TQ3Uns32 numPoints,TQ3Point3D * result)3081 Q3Point3D_AffineComb(const TQ3Point3D *points3D, const float *weights, TQ3Uns32 numPoints, TQ3Point3D *result)
3082 {
3083
3084
3085 // Release build checks
3086 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(points3D), NULL);
3087 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(weights), NULL);
3088 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
3089
3090
3091
3092 // Debug build checks
3093 #if Q3_DEBUG
3094 if (0) // Further checks on points3D
3095 return(NULL);
3096
3097 if (0) // Further checks on weights
3098 return(NULL);
3099
3100 if (0) // Further checks on numPoints
3101 return(NULL);
3102
3103 if (0) // Further checks on result
3104 return(NULL);
3105 #endif
3106
3107
3108
3109 // Call the bottleneck
3110 E3System_Bottleneck();
3111
3112
3113
3114 // Call our implementation
3115 return(E3Point3D_AffineComb(points3D, weights, numPoints, result));
3116 }
3117
3118
3119
3120
3121
3122 //=============================================================================
3123 // Q3RationalPoint4D_AffineComb : Quesa API entry point.
3124 //-----------------------------------------------------------------------------
3125 TQ3RationalPoint4D *
Q3RationalPoint4D_AffineComb(const TQ3RationalPoint4D * rationalPoints4D,const float * weights,TQ3Uns32 numPoints,TQ3RationalPoint4D * result)3126 Q3RationalPoint4D_AffineComb(const TQ3RationalPoint4D *rationalPoints4D, const float *weights, TQ3Uns32 numPoints, TQ3RationalPoint4D *result)
3127 {
3128
3129
3130 // Release build checks
3131 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(rationalPoints4D), NULL);
3132 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(weights), NULL);
3133 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
3134
3135
3136
3137 // Debug build checks
3138 #if Q3_DEBUG
3139 if (0) // Further checks on rationalPoints4D
3140 return(NULL);
3141
3142 if (0) // Further checks on weights
3143 return(NULL);
3144
3145 if (0) // Further checks on numPoints
3146 return(NULL);
3147
3148 if (0) // Further checks on result
3149 return(NULL);
3150 #endif
3151
3152
3153
3154 // Call the bottleneck
3155 E3System_Bottleneck();
3156
3157
3158
3159 // Call our implementation
3160 return(E3RationalPoint4D_AffineComb(rationalPoints4D, weights, numPoints, result));
3161 }
3162
3163
3164
3165
3166
3167 //=============================================================================
3168 // Q3Vector2D_Transform : Quesa API entry point.
3169 //-----------------------------------------------------------------------------
3170 #pragma mark -
3171 TQ3Vector2D *
Q3Vector2D_Transform(const TQ3Vector2D * vector2D,const TQ3Matrix3x3 * matrix3x3,TQ3Vector2D * result)3172 Q3Vector2D_Transform(const TQ3Vector2D *vector2D, const TQ3Matrix3x3 *matrix3x3, TQ3Vector2D *result)
3173 {
3174
3175
3176 // Release build checks
3177 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector2D), NULL);
3178 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), NULL);
3179 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
3180
3181
3182
3183 // Debug build checks
3184 #if Q3_DEBUG
3185 if (0) // Further checks on vector2D
3186 return(NULL);
3187
3188 if (0) // Further checks on matrix3x3
3189 return(NULL);
3190
3191 if (0) // Further checks on result
3192 return(NULL);
3193 #endif
3194
3195
3196
3197 // Call the bottleneck
3198 E3System_Bottleneck();
3199
3200
3201
3202 // Call our implementation
3203 return(E3Vector2D_Transform(vector2D, matrix3x3, result));
3204 }
3205
3206
3207
3208
3209
3210 //=============================================================================
3211 // Q3Vector3D_Transform : Quesa API entry point.
3212 //-----------------------------------------------------------------------------
3213 TQ3Vector3D *
Q3Vector3D_Transform(const TQ3Vector3D * vector3D,const TQ3Matrix4x4 * matrix4x4,TQ3Vector3D * result)3214 Q3Vector3D_Transform(const TQ3Vector3D *vector3D, const TQ3Matrix4x4 *matrix4x4, TQ3Vector3D *result)
3215 {
3216
3217
3218 // Release build checks
3219 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector3D), NULL);
3220 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
3221 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
3222
3223
3224
3225 // Debug build checks
3226 #if Q3_DEBUG
3227 if (0) // Further checks on vector3D
3228 return(NULL);
3229
3230 if (0) // Further checks on matrix4x4
3231 return(NULL);
3232
3233 if (0) // Further checks on result
3234 return(NULL);
3235 #endif
3236
3237
3238
3239 // Call the bottleneck
3240 E3System_Bottleneck();
3241
3242
3243
3244 // Call our implementation
3245 return(E3Vector3D_Transform(vector3D, matrix4x4, result));
3246 }
3247
3248
3249
3250
3251
3252 //=============================================================================
3253 // Q3Point2D_Transform : Quesa API entry point.
3254 //-----------------------------------------------------------------------------
3255 TQ3Point2D *
Q3Point2D_Transform(const TQ3Point2D * point2D,const TQ3Matrix3x3 * matrix3x3,TQ3Point2D * result)3256 Q3Point2D_Transform(const TQ3Point2D *point2D, const TQ3Matrix3x3 *matrix3x3, TQ3Point2D *result)
3257 {
3258
3259
3260 // Release build checks
3261 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point2D), NULL);
3262 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), NULL);
3263 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
3264
3265
3266
3267 // Debug build checks
3268 #if Q3_DEBUG
3269 if (0) // Further checks on point2D
3270 return(NULL);
3271
3272 if (0) // Further checks on matrix3x3
3273 return(NULL);
3274
3275 if (0) // Further checks on result
3276 return(NULL);
3277 #endif
3278
3279
3280
3281 // Call the bottleneck
3282 E3System_Bottleneck();
3283
3284
3285
3286 // Call our implementation
3287 return(E3Point2D_Transform(point2D, matrix3x3, result));
3288 }
3289
3290
3291
3292
3293
3294 //=============================================================================
3295 // Q3Param2D_Transform : Quesa API entry point.
3296 //-----------------------------------------------------------------------------
3297 TQ3Param2D *
Q3Param2D_Transform(const TQ3Param2D * param2D,const TQ3Matrix3x3 * matrix3x3,TQ3Param2D * result)3298 Q3Param2D_Transform(const TQ3Param2D *param2D, const TQ3Matrix3x3 *matrix3x3, TQ3Param2D *result)
3299 {
3300
3301
3302 // Release build checks
3303 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(param2D), NULL);
3304 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), NULL);
3305 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
3306
3307
3308
3309 // Debug build checks
3310 #if Q3_DEBUG
3311 if (0) // Further checks on param2D
3312 return(NULL);
3313
3314 if (0) // Further checks on matrix3x3
3315 return(NULL);
3316
3317 if (0) // Further checks on result
3318 return(NULL);
3319 #endif
3320
3321
3322
3323 // Call the bottleneck
3324 E3System_Bottleneck();
3325
3326
3327
3328 // Call our implementation
3329 return(E3Param2D_Transform(param2D, matrix3x3, result));
3330 }
3331
3332
3333
3334
3335
3336 //=============================================================================
3337 // Q3RationalPoint3D_Transform : Quesa API entry point.
3338 //-----------------------------------------------------------------------------
3339 TQ3RationalPoint3D *
Q3RationalPoint3D_Transform(const TQ3RationalPoint3D * rationalPoint3D,const TQ3Matrix3x3 * matrix3x3,TQ3RationalPoint3D * result)3340 Q3RationalPoint3D_Transform(const TQ3RationalPoint3D *rationalPoint3D, const TQ3Matrix3x3 *matrix3x3, TQ3RationalPoint3D *result)
3341 {
3342
3343
3344 // Release build checks
3345 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(rationalPoint3D), NULL);
3346 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), NULL);
3347 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
3348
3349
3350
3351 // Debug build checks
3352 #if Q3_DEBUG
3353 if (0) // Further checks on rationalPoint3D
3354 return(NULL);
3355
3356 if (0) // Further checks on matrix3x3
3357 return(NULL);
3358
3359 if (0) // Further checks on result
3360 return(NULL);
3361 #endif
3362
3363
3364
3365 // Call the bottleneck
3366 E3System_Bottleneck();
3367
3368
3369
3370 // Call our implementation
3371 return(E3RationalPoint3D_Transform(rationalPoint3D, matrix3x3, result));
3372 }
3373
3374
3375
3376
3377
3378 //=============================================================================
3379 // Q3Point3D_Transform : Quesa API entry point.
3380 //-----------------------------------------------------------------------------
3381 TQ3Point3D *
Q3Point3D_Transform(const TQ3Point3D * point3D,const TQ3Matrix4x4 * matrix4x4,TQ3Point3D * result)3382 Q3Point3D_Transform(const TQ3Point3D *point3D, const TQ3Matrix4x4 *matrix4x4, TQ3Point3D *result)
3383 {
3384
3385
3386 // Release build checks
3387 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point3D), NULL);
3388 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
3389 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
3390
3391
3392
3393 // Debug build checks
3394 #if Q3_DEBUG
3395 if (0) // Further checks on point3D
3396 return(NULL);
3397
3398 if (0) // Further checks on matrix4x4
3399 return(NULL);
3400
3401 if (0) // Further checks on result
3402 return(NULL);
3403 #endif
3404
3405
3406
3407 // Call the bottleneck
3408 E3System_Bottleneck();
3409
3410
3411
3412 // Call our implementation
3413 return(E3Point3D_Transform(point3D, matrix4x4, result));
3414 }
3415
3416
3417
3418
3419
3420 //=============================================================================
3421 // Q3RationalPoint4D_Transform : Quesa API entry point.
3422 //-----------------------------------------------------------------------------
3423 TQ3RationalPoint4D *
Q3RationalPoint4D_Transform(const TQ3RationalPoint4D * rationalPoint4D,const TQ3Matrix4x4 * matrix4x4,TQ3RationalPoint4D * result)3424 Q3RationalPoint4D_Transform(const TQ3RationalPoint4D *rationalPoint4D, const TQ3Matrix4x4 *matrix4x4, TQ3RationalPoint4D *result)
3425 {
3426
3427
3428 // Release build checks
3429 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(rationalPoint4D), NULL);
3430 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
3431 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
3432
3433
3434
3435 // Debug build checks
3436 #if Q3_DEBUG
3437 if (0) // Further checks on rationalPoint4D
3438 return(NULL);
3439
3440 if (0) // Further checks on matrix4x4
3441 return(NULL);
3442
3443 if (0) // Further checks on result
3444 return(NULL);
3445 #endif
3446
3447
3448
3449 // Call the bottleneck
3450 E3System_Bottleneck();
3451
3452
3453
3454 // Call our implementation
3455 return(E3RationalPoint4D_Transform(rationalPoint4D, matrix4x4, result));
3456 }
3457
3458
3459
3460
3461
3462 //=============================================================================
3463 // Q3Vector2D_To2DTransformArray : Quesa API entry point.
3464 //-----------------------------------------------------------------------------
3465 TQ3Status
Q3Vector2D_To2DTransformArray(const TQ3Vector2D * inVectors2D,const TQ3Matrix3x3 * matrix3x3,TQ3Vector2D * outVectors2D,TQ3Uns32 numVectors,TQ3Uns32 inStructSize,TQ3Uns32 outStructSize)3466 Q3Vector2D_To2DTransformArray(const TQ3Vector2D *inVectors2D, const TQ3Matrix3x3 *matrix3x3, TQ3Vector2D *outVectors2D, TQ3Uns32 numVectors, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize)
3467 {
3468
3469
3470 // Release build checks
3471 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(inVectors2D), kQ3Failure);
3472 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), kQ3Failure);
3473 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(outVectors2D), kQ3Failure);
3474 Q3_REQUIRE_OR_RESULT(inStructSize >= sizeof(TQ3Vector2D), kQ3Failure);
3475 Q3_REQUIRE_OR_RESULT(outStructSize >= sizeof(TQ3Vector2D), kQ3Failure);
3476
3477
3478
3479 // Debug build checks
3480 #if Q3_DEBUG
3481 if (0) // Further checks on inVectors2D
3482 return(kQ3Failure);
3483
3484 if (0) // Further checks on matrix3x3
3485 return(kQ3Failure);
3486
3487 if (0) // Further checks on outVectors2D
3488 return(kQ3Failure);
3489
3490 if (0) // Further checks on numVectors
3491 return(kQ3Failure);
3492
3493 if (0) // Further checks on inStructSize
3494 return(kQ3Failure);
3495
3496 if (0) // Further checks on outStructSize
3497 return(kQ3Failure);
3498 #endif
3499
3500
3501
3502 // Call the bottleneck
3503 E3System_Bottleneck();
3504
3505
3506
3507 // Call our implementation
3508 return(E3Vector2D_To2DTransformArray(inVectors2D, matrix3x3, outVectors2D, numVectors, inStructSize, outStructSize));
3509 }
3510
3511
3512
3513
3514
3515 //=============================================================================
3516 // Q3Vector3D_To3DTransformArray : Quesa API entry point.
3517 //-----------------------------------------------------------------------------
3518 TQ3Status
Q3Vector3D_To3DTransformArray(const TQ3Vector3D * inVectors3D,const TQ3Matrix4x4 * matrix4x4,TQ3Vector3D * outVectors3D,TQ3Uns32 numVectors,TQ3Uns32 inStructSize,TQ3Uns32 outStructSize)3519 Q3Vector3D_To3DTransformArray(const TQ3Vector3D *inVectors3D, const TQ3Matrix4x4 *matrix4x4, TQ3Vector3D *outVectors3D, TQ3Uns32 numVectors, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize)
3520 {
3521
3522
3523 // Release build checks
3524 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(inVectors3D), kQ3Failure);
3525 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), kQ3Failure);
3526 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(outVectors3D), kQ3Failure);
3527 Q3_REQUIRE_OR_RESULT(inStructSize >= sizeof(TQ3Vector3D), kQ3Failure);
3528 Q3_REQUIRE_OR_RESULT(outStructSize >= sizeof(TQ3Vector3D), kQ3Failure);
3529
3530
3531
3532 // Debug build checks
3533 #if Q3_DEBUG
3534 if (0) // Further checks on inVectors3D
3535 return(kQ3Failure);
3536
3537 if (0) // Further checks on matrix4x4
3538 return(kQ3Failure);
3539
3540 if (0) // Further checks on outVectors3D
3541 return(kQ3Failure);
3542
3543 if (0) // Further checks on numVectors
3544 return(kQ3Failure);
3545
3546 if (0) // Further checks on inStructSize
3547 return(kQ3Failure);
3548
3549 if (0) // Further checks on outStructSize
3550 return(kQ3Failure);
3551 #endif
3552
3553
3554
3555 // Call the bottleneck
3556 E3System_Bottleneck();
3557
3558
3559
3560 // Call our implementation
3561 return(E3Vector3D_To3DTransformArray(inVectors3D, matrix4x4, outVectors3D, numVectors, inStructSize, outStructSize));
3562 }
3563
3564
3565
3566
3567
3568 //=============================================================================
3569 // Q3Point2D_To2DTransformArray : Quesa API entry point.
3570 //-----------------------------------------------------------------------------
3571 TQ3Status
Q3Point2D_To2DTransformArray(const TQ3Point2D * inPoints2D,const TQ3Matrix3x3 * matrix3x3,TQ3Point2D * outPoints2D,TQ3Uns32 numPoints,TQ3Uns32 inStructSize,TQ3Uns32 outStructSize)3572 Q3Point2D_To2DTransformArray(const TQ3Point2D *inPoints2D, const TQ3Matrix3x3 *matrix3x3, TQ3Point2D *outPoints2D, TQ3Uns32 numPoints, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize)
3573 {
3574
3575
3576 // Release build checks
3577 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(inPoints2D), kQ3Failure);
3578 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), kQ3Failure);
3579 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(outPoints2D), kQ3Failure);
3580 Q3_REQUIRE_OR_RESULT(inStructSize >= sizeof(TQ3Point2D), kQ3Failure);
3581 Q3_REQUIRE_OR_RESULT(outStructSize >= sizeof(TQ3Point2D), kQ3Failure);
3582
3583
3584
3585 // Debug build checks
3586 #if Q3_DEBUG
3587 if (0) // Further checks on inPoints2D
3588 return(kQ3Failure);
3589
3590 if (0) // Further checks on matrix3x3
3591 return(kQ3Failure);
3592
3593 if (0) // Further checks on outPoints2D
3594 return(kQ3Failure);
3595
3596 if (0) // Further checks on numPoints
3597 return(kQ3Failure);
3598
3599 if (0) // Further checks on inStructSize
3600 return(kQ3Failure);
3601
3602 if (0) // Further checks on outStructSize
3603 return(kQ3Failure);
3604 #endif
3605
3606
3607
3608 // Call the bottleneck
3609 E3System_Bottleneck();
3610
3611
3612
3613 // Call our implementation
3614 return(E3Point2D_To2DTransformArray(inPoints2D, matrix3x3, outPoints2D, numPoints, inStructSize, outStructSize));
3615 }
3616
3617
3618
3619
3620
3621 //=============================================================================
3622 // Q3Point2D_To3DTransformArray : Quesa API entry point.
3623 //-----------------------------------------------------------------------------
3624 TQ3Status
Q3Point2D_To3DTransformArray(const TQ3Point2D * inPoints2D,const TQ3Matrix3x3 * matrix3x3,TQ3RationalPoint3D * outRationalPoints3D,TQ3Uns32 numPoints,TQ3Uns32 inStructSize,TQ3Uns32 outStructSize)3625 Q3Point2D_To3DTransformArray(const TQ3Point2D *inPoints2D, const TQ3Matrix3x3 *matrix3x3, TQ3RationalPoint3D *outRationalPoints3D, TQ3Uns32 numPoints, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize)
3626 {
3627
3628
3629 // Release build checks
3630 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(inPoints2D), kQ3Failure);
3631 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), kQ3Failure);
3632 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(outRationalPoints3D), kQ3Failure);
3633 Q3_REQUIRE_OR_RESULT(inStructSize >= sizeof(TQ3Point2D), kQ3Failure);
3634 Q3_REQUIRE_OR_RESULT(outStructSize >= sizeof(TQ3RationalPoint3D), kQ3Failure);
3635
3636
3637
3638 // Debug build checks
3639 #if Q3_DEBUG
3640 if (0) // Further checks on inPoints2D
3641 return(kQ3Failure);
3642
3643 if (0) // Further checks on matrix3x3
3644 return(kQ3Failure);
3645
3646 if (0) // Further checks on outRationalPoints3D
3647 return(kQ3Failure);
3648
3649 if (0) // Further checks on numPoints
3650 return(kQ3Failure);
3651
3652 if (0) // Further checks on inStructSize
3653 return(kQ3Failure);
3654
3655 if (0) // Further checks on outStructSize
3656 return(kQ3Failure);
3657 #endif
3658
3659
3660
3661 // Call the bottleneck
3662 E3System_Bottleneck();
3663
3664
3665
3666 // Call our implementation
3667 return(E3Point2D_To3DTransformArray(inPoints2D, matrix3x3, outRationalPoints3D, numPoints, inStructSize, outStructSize));
3668 }
3669
3670
3671
3672
3673
3674 //=============================================================================
3675 // Q3RationalPoint3D_To3DTransformArray : Quesa API entry point.
3676 //-----------------------------------------------------------------------------
3677 TQ3Status
Q3RationalPoint3D_To3DTransformArray(const TQ3RationalPoint3D * inRationalPoints3D,const TQ3Matrix3x3 * matrix3x3,TQ3RationalPoint3D * outRationalPoints3D,TQ3Uns32 numPoints,TQ3Uns32 inStructSize,TQ3Uns32 outStructSize)3678 Q3RationalPoint3D_To3DTransformArray(const TQ3RationalPoint3D *inRationalPoints3D, const TQ3Matrix3x3 *matrix3x3, TQ3RationalPoint3D *outRationalPoints3D, TQ3Uns32 numPoints, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize)
3679 {
3680
3681
3682 // Release build checks
3683 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(inRationalPoints3D), kQ3Failure);
3684 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), kQ3Failure);
3685 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(outRationalPoints3D), kQ3Failure);
3686 Q3_REQUIRE_OR_RESULT(inStructSize >= sizeof(TQ3RationalPoint3D), kQ3Failure);
3687 Q3_REQUIRE_OR_RESULT(outStructSize >= sizeof(TQ3RationalPoint3D), kQ3Failure);
3688
3689
3690
3691 // Debug build checks
3692 #if Q3_DEBUG
3693 if (0) // Further checks on inRationalPoints3D
3694 return(kQ3Failure);
3695
3696 if (0) // Further checks on matrix3x3
3697 return(kQ3Failure);
3698
3699 if (0) // Further checks on outRationalPoints3D
3700 return(kQ3Failure);
3701
3702 if (0) // Further checks on numPoints
3703 return(kQ3Failure);
3704
3705 if (0) // Further checks on inStructSize
3706 return(kQ3Failure);
3707
3708 if (0) // Further checks on outStructSize
3709 return(kQ3Failure);
3710 #endif
3711
3712
3713
3714 // Call the bottleneck
3715 E3System_Bottleneck();
3716
3717
3718
3719 // Call our implementation
3720 return(E3RationalPoint3D_To3DTransformArray(inRationalPoints3D, matrix3x3, outRationalPoints3D, numPoints, inStructSize, outStructSize));
3721 }
3722
3723
3724
3725
3726
3727 //=============================================================================
3728 // Q3Point3D_To3DTransformArray : Quesa API entry point.
3729 //-----------------------------------------------------------------------------
3730 TQ3Status
Q3Point3D_To3DTransformArray(const TQ3Point3D * inPoints3D,const TQ3Matrix4x4 * matrix4x4,TQ3Point3D * outPoints3D,TQ3Uns32 numPoints,TQ3Uns32 inStructSize,TQ3Uns32 outStructSize)3731 Q3Point3D_To3DTransformArray(const TQ3Point3D *inPoints3D, const TQ3Matrix4x4 *matrix4x4, TQ3Point3D *outPoints3D, TQ3Uns32 numPoints, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize)
3732 {
3733
3734
3735 // Release build checks
3736 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(inPoints3D), kQ3Failure);
3737 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), kQ3Failure);
3738 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(outPoints3D), kQ3Failure);
3739 Q3_REQUIRE_OR_RESULT(inStructSize >= sizeof(TQ3Point3D), kQ3Failure);
3740 Q3_REQUIRE_OR_RESULT(outStructSize >= sizeof(TQ3Point3D), kQ3Failure);
3741
3742
3743
3744 // Debug build checks
3745 #if Q3_DEBUG
3746 if (0) // Further checks on inPoints3D
3747 return(kQ3Failure);
3748
3749 if (0) // Further checks on matrix4x4
3750 return(kQ3Failure);
3751
3752 if (0) // Further checks on outPoints3D
3753 return(kQ3Failure);
3754
3755 if (0) // Further checks on numPoints
3756 return(kQ3Failure);
3757
3758 if (0) // Further checks on inStructSize
3759 return(kQ3Failure);
3760
3761 if (0) // Further checks on outStructSize
3762 return(kQ3Failure);
3763 #endif
3764
3765
3766
3767 // Call the bottleneck
3768 E3System_Bottleneck();
3769
3770
3771
3772 // Call our implementation
3773 return(E3Point3D_To3DTransformArray(inPoints3D, matrix4x4, outPoints3D, numPoints, inStructSize, outStructSize));
3774 }
3775
3776
3777
3778
3779
3780 //=============================================================================
3781 // Q3Point3D_To4DTransformArray : Quesa API entry point.
3782 //-----------------------------------------------------------------------------
3783 TQ3Status
Q3Point3D_To4DTransformArray(const TQ3Point3D * inPoints3D,const TQ3Matrix4x4 * matrix4x4,TQ3RationalPoint4D * outRationalPoints4D,TQ3Uns32 numPoints,TQ3Uns32 inStructSize,TQ3Uns32 outStructSize)3784 Q3Point3D_To4DTransformArray(const TQ3Point3D *inPoints3D, const TQ3Matrix4x4 *matrix4x4, TQ3RationalPoint4D *outRationalPoints4D, TQ3Uns32 numPoints, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize)
3785 {
3786
3787
3788 // Release build checks
3789 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(inPoints3D), kQ3Failure);
3790 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), kQ3Failure);
3791 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(outRationalPoints4D), kQ3Failure);
3792 Q3_REQUIRE_OR_RESULT(inStructSize >= sizeof(TQ3Point3D), kQ3Failure);
3793 Q3_REQUIRE_OR_RESULT(outStructSize >= sizeof(TQ3RationalPoint4D), kQ3Failure);
3794
3795
3796
3797 // Debug build checks
3798 #if Q3_DEBUG
3799 if (0) // Further checks on inPoints3D
3800 return(kQ3Failure);
3801
3802 if (0) // Further checks on matrix4x4
3803 return(kQ3Failure);
3804
3805 if (0) // Further checks on outRationalPoints4D
3806 return(kQ3Failure);
3807
3808 if (0) // Further checks on numPoints
3809 return(kQ3Failure);
3810
3811 if (0) // Further checks on inStructSize
3812 return(kQ3Failure);
3813
3814 if (0) // Further checks on outStructSize
3815 return(kQ3Failure);
3816 #endif
3817
3818
3819
3820 // Call the bottleneck
3821 E3System_Bottleneck();
3822
3823
3824
3825 // Call our implementation
3826 return(E3Point3D_To4DTransformArray(inPoints3D, matrix4x4, outRationalPoints4D, numPoints, inStructSize, outStructSize));
3827 }
3828
3829
3830
3831
3832
3833 //=============================================================================
3834 // Q3RationalPoint4D_To4DTransformArray : Quesa API entry point.
3835 //-----------------------------------------------------------------------------
3836 TQ3Status
Q3RationalPoint4D_To4DTransformArray(const TQ3RationalPoint4D * inRationalPoints4D,const TQ3Matrix4x4 * matrix4x4,TQ3RationalPoint4D * outRationalPoints4D,TQ3Uns32 numPoints,TQ3Uns32 inStructSize,TQ3Uns32 outStructSize)3837 Q3RationalPoint4D_To4DTransformArray(const TQ3RationalPoint4D *inRationalPoints4D, const TQ3Matrix4x4 *matrix4x4, TQ3RationalPoint4D *outRationalPoints4D, TQ3Uns32 numPoints, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize)
3838 {
3839
3840
3841 // Release build checks
3842 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(inRationalPoints4D), kQ3Failure);
3843 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), kQ3Failure);
3844 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(outRationalPoints4D), kQ3Failure);
3845 Q3_REQUIRE_OR_RESULT(inStructSize >= sizeof(TQ3RationalPoint4D), kQ3Failure);
3846 Q3_REQUIRE_OR_RESULT(outStructSize >= sizeof(TQ3RationalPoint4D), kQ3Failure);
3847
3848
3849
3850 // Debug build checks
3851 #if Q3_DEBUG
3852 if (0) // Further checks on inRationalPoints4D
3853 return(kQ3Failure);
3854
3855 if (0) // Further checks on matrix4x4
3856 return(kQ3Failure);
3857
3858 if (0) // Further checks on outRationalPoints4D
3859 return(kQ3Failure);
3860
3861 if (0) // Further checks on numPoints
3862 return(kQ3Failure);
3863
3864 if (0) // Further checks on inStructSize
3865 return(kQ3Failure);
3866
3867 if (0) // Further checks on outStructSize
3868 return(kQ3Failure);
3869 #endif
3870
3871
3872
3873 // Call the bottleneck
3874 E3System_Bottleneck();
3875
3876
3877
3878 // Call our implementation
3879 return(E3RationalPoint4D_To4DTransformArray(inRationalPoints4D, matrix4x4, outRationalPoints4D, numPoints, inStructSize, outStructSize));
3880 }
3881
3882
3883
3884
3885
3886 //=============================================================================
3887 // Q3Matrix3x3_SetIdentity : Quesa API entry point.
3888 //-----------------------------------------------------------------------------
3889 #pragma mark -
3890 TQ3Matrix3x3 *
Q3Matrix3x3_SetIdentity(TQ3Matrix3x3 * matrix3x3)3891 Q3Matrix3x3_SetIdentity(TQ3Matrix3x3 *matrix3x3)
3892 {
3893
3894
3895 // Release build checks
3896 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), NULL);
3897
3898
3899
3900 // Debug build checks
3901 #if Q3_DEBUG
3902 if (0) // Further checks on matrix3x3
3903 return(NULL);
3904 #endif
3905
3906
3907
3908 // Call the bottleneck
3909 E3System_Bottleneck();
3910
3911
3912
3913 // Call our implementation
3914 return(E3Matrix3x3_SetIdentity(matrix3x3));
3915 }
3916
3917
3918
3919
3920
3921 //=============================================================================
3922 // Q3Matrix4x4_SetIdentity : Quesa API entry point.
3923 //-----------------------------------------------------------------------------
3924 TQ3Matrix4x4 *
Q3Matrix4x4_SetIdentity(TQ3Matrix4x4 * matrix4x4)3925 Q3Matrix4x4_SetIdentity(TQ3Matrix4x4 *matrix4x4)
3926 {
3927
3928
3929 // Release build checks
3930 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
3931
3932
3933
3934 // Debug build checks
3935 #if Q3_DEBUG
3936 if (0) // Further checks on matrix4x4
3937 return(NULL);
3938 #endif
3939
3940
3941
3942 // Call the bottleneck
3943 E3System_Bottleneck();
3944
3945
3946
3947 // Call our implementation
3948 return(E3Matrix4x4_SetIdentity(matrix4x4));
3949 }
3950
3951
3952
3953
3954
3955 //=============================================================================
3956 // Q3Matrix3x3_SetTranslate : Quesa API entry point.
3957 //-----------------------------------------------------------------------------
3958 TQ3Matrix3x3 *
Q3Matrix3x3_SetTranslate(TQ3Matrix3x3 * matrix3x3,float xTrans,float yTrans)3959 Q3Matrix3x3_SetTranslate(TQ3Matrix3x3 *matrix3x3, float xTrans, float yTrans)
3960 {
3961
3962
3963 // Release build checks
3964 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), NULL);
3965
3966
3967
3968 // Debug build checks
3969 #if Q3_DEBUG
3970 if (0) // Further checks on matrix3x3
3971 return(NULL);
3972
3973 if (0) // Further checks on xTrans
3974 return(NULL);
3975
3976 if (0) // Further checks on yTrans
3977 return(NULL);
3978 #endif
3979
3980
3981
3982 // Call the bottleneck
3983 E3System_Bottleneck();
3984
3985
3986
3987 // Call our implementation
3988 return(E3Matrix3x3_SetTranslate(matrix3x3, xTrans, yTrans));
3989 }
3990
3991
3992
3993
3994
3995 //=============================================================================
3996 // Q3Matrix4x4_SetTranslate : Quesa API entry point.
3997 //-----------------------------------------------------------------------------
3998 TQ3Matrix4x4 *
Q3Matrix4x4_SetTranslate(TQ3Matrix4x4 * matrix4x4,float xTrans,float yTrans,float zTrans)3999 Q3Matrix4x4_SetTranslate(TQ3Matrix4x4 *matrix4x4, float xTrans, float yTrans, float zTrans)
4000 {
4001
4002
4003 // Release build checks
4004 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
4005
4006
4007
4008 // Debug build checks
4009 #if Q3_DEBUG
4010 if (0) // Further checks on matrix4x4
4011 return(NULL);
4012
4013 if (0) // Further checks on xTrans
4014 return(NULL);
4015
4016 if (0) // Further checks on yTrans
4017 return(NULL);
4018
4019 if (0) // Further checks on zTrans
4020 return(NULL);
4021 #endif
4022
4023
4024
4025 // Call the bottleneck
4026 E3System_Bottleneck();
4027
4028
4029
4030 // Call our implementation
4031 return(E3Matrix4x4_SetTranslate(matrix4x4, xTrans, yTrans, zTrans));
4032 }
4033
4034
4035
4036
4037
4038 //=============================================================================
4039 // Q3Matrix3x3_SetScale : Quesa API entry point.
4040 //-----------------------------------------------------------------------------
4041 TQ3Matrix3x3 *
Q3Matrix3x3_SetScale(TQ3Matrix3x3 * matrix3x3,float xScale,float yScale)4042 Q3Matrix3x3_SetScale(TQ3Matrix3x3 *matrix3x3, float xScale, float yScale)
4043 {
4044
4045
4046 // Release build checks
4047 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), NULL);
4048
4049
4050
4051 // Debug build checks
4052 #if Q3_DEBUG
4053 if (0) // Further checks on matrix3x3
4054 return(NULL);
4055
4056 if (0) // Further checks on xScale
4057 return(NULL);
4058
4059 if (0) // Further checks on yScale
4060 return(NULL);
4061 #endif
4062
4063
4064
4065 // Call the bottleneck
4066 E3System_Bottleneck();
4067
4068
4069
4070 // Call our implementation
4071 return(E3Matrix3x3_SetScale(matrix3x3, xScale, yScale));
4072 }
4073
4074
4075
4076
4077
4078 //=============================================================================
4079 // Q3Matrix4x4_SetScale : Quesa API entry point.
4080 //-----------------------------------------------------------------------------
4081 TQ3Matrix4x4 *
Q3Matrix4x4_SetScale(TQ3Matrix4x4 * matrix4x4,float xScale,float yScale,float zScale)4082 Q3Matrix4x4_SetScale(TQ3Matrix4x4 *matrix4x4, float xScale, float yScale, float zScale)
4083 {
4084
4085
4086 // Release build checks
4087 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
4088
4089
4090
4091 // Debug build checks
4092 #if Q3_DEBUG
4093 if (0) // Further checks on matrix4x4
4094 return(NULL);
4095
4096 if (0) // Further checks on xScale
4097 return(NULL);
4098
4099 if (0) // Further checks on yScale
4100 return(NULL);
4101
4102 if (0) // Further checks on zScale
4103 return(NULL);
4104 #endif
4105
4106
4107
4108 // Call the bottleneck
4109 E3System_Bottleneck();
4110
4111
4112
4113 // Call our implementation
4114 return(E3Matrix4x4_SetScale(matrix4x4, xScale, yScale, zScale));
4115 }
4116
4117
4118
4119
4120
4121 //=============================================================================
4122 // Q3Matrix3x3_SetRotate : Quesa API entry point.
4123 //-----------------------------------------------------------------------------
4124 TQ3Matrix3x3 *
Q3Matrix3x3_SetRotate(TQ3Matrix3x3 * matrix3x3,float angle)4125 Q3Matrix3x3_SetRotate(TQ3Matrix3x3 *matrix3x3, float angle)
4126 {
4127
4128
4129 // Release build checks
4130 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), NULL);
4131
4132
4133
4134 // Debug build checks
4135 #if Q3_DEBUG
4136 if (0) // Further checks on matrix3x3
4137 return(NULL);
4138
4139 if (0) // Further checks on angle
4140 return(NULL);
4141 #endif
4142
4143
4144
4145 // Call the bottleneck
4146 E3System_Bottleneck();
4147
4148
4149
4150 // Call our implementation
4151 return(E3Matrix3x3_SetRotate(matrix3x3, angle));
4152 }
4153
4154
4155
4156
4157
4158 //=============================================================================
4159 // Q3Matrix4x4_SetRotate_X : Quesa API entry point.
4160 //-----------------------------------------------------------------------------
4161 TQ3Matrix4x4 *
Q3Matrix4x4_SetRotate_X(TQ3Matrix4x4 * matrix4x4,float angle)4162 Q3Matrix4x4_SetRotate_X(TQ3Matrix4x4 *matrix4x4, float angle)
4163 {
4164
4165
4166 // Release build checks
4167 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
4168
4169
4170
4171 // Debug build checks
4172 #if Q3_DEBUG
4173 if (0) // Further checks on matrix4x4
4174 return(NULL);
4175
4176 if (0) // Further checks on angle
4177 return(NULL);
4178 #endif
4179
4180
4181
4182 // Call the bottleneck
4183 E3System_Bottleneck();
4184
4185
4186
4187 // Call our implementation
4188 return(E3Matrix4x4_SetRotate_X(matrix4x4, angle));
4189 }
4190
4191
4192
4193
4194
4195 //=============================================================================
4196 // Q3Matrix4x4_SetRotate_Y : Quesa API entry point.
4197 //-----------------------------------------------------------------------------
4198 TQ3Matrix4x4 *
Q3Matrix4x4_SetRotate_Y(TQ3Matrix4x4 * matrix4x4,float angle)4199 Q3Matrix4x4_SetRotate_Y(TQ3Matrix4x4 *matrix4x4, float angle)
4200 {
4201
4202
4203 // Release build checks
4204 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
4205
4206
4207
4208 // Debug build checks
4209 #if Q3_DEBUG
4210 if (0) // Further checks on matrix4x4
4211 return(NULL);
4212
4213 if (0) // Further checks on angle
4214 return(NULL);
4215 #endif
4216
4217
4218
4219 // Call the bottleneck
4220 E3System_Bottleneck();
4221
4222
4223
4224 // Call our implementation
4225 return(E3Matrix4x4_SetRotate_Y(matrix4x4, angle));
4226 }
4227
4228
4229
4230
4231
4232 //=============================================================================
4233 // Q3Matrix4x4_SetRotate_Z : Quesa API entry point.
4234 //-----------------------------------------------------------------------------
4235 TQ3Matrix4x4 *
Q3Matrix4x4_SetRotate_Z(TQ3Matrix4x4 * matrix4x4,float angle)4236 Q3Matrix4x4_SetRotate_Z(TQ3Matrix4x4 *matrix4x4, float angle)
4237 {
4238
4239
4240 // Release build checks
4241 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
4242
4243
4244
4245 // Debug build checks
4246 #if Q3_DEBUG
4247 if (0) // Further checks on matrix4x4
4248 return(NULL);
4249
4250 if (0) // Further checks on angle
4251 return(NULL);
4252 #endif
4253
4254
4255
4256 // Call the bottleneck
4257 E3System_Bottleneck();
4258
4259
4260
4261 // Call our implementation
4262 return(E3Matrix4x4_SetRotate_Z(matrix4x4, angle));
4263 }
4264
4265
4266
4267
4268
4269 //=============================================================================
4270 // Q3Matrix4x4_SetRotate_XYZ : Quesa API entry point.
4271 //-----------------------------------------------------------------------------
4272 TQ3Matrix4x4 *
Q3Matrix4x4_SetRotate_XYZ(TQ3Matrix4x4 * matrix4x4,float xAngle,float yAngle,float zAngle)4273 Q3Matrix4x4_SetRotate_XYZ(TQ3Matrix4x4 *matrix4x4, float xAngle, float yAngle, float zAngle)
4274 {
4275
4276
4277 // Release build checks
4278 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
4279
4280
4281
4282 // Debug build checks
4283 #if Q3_DEBUG
4284 if (0) // Further checks on matrix4x4
4285 return(NULL);
4286
4287 if (0) // Further checks on xAngle
4288 return(NULL);
4289
4290 if (0) // Further checks on yAngle
4291 return(NULL);
4292
4293 if (0) // Further checks on zAngle
4294 return(NULL);
4295 #endif
4296
4297
4298
4299 // Call the bottleneck
4300 E3System_Bottleneck();
4301
4302
4303
4304 // Call our implementation
4305 return(E3Matrix4x4_SetRotate_XYZ(matrix4x4, xAngle, yAngle, zAngle));
4306 }
4307
4308
4309
4310
4311
4312 //=============================================================================
4313 // Q3Matrix3x3_SetRotateAboutPoint : Quesa API entry point.
4314 //-----------------------------------------------------------------------------
4315 TQ3Matrix3x3 *
Q3Matrix3x3_SetRotateAboutPoint(TQ3Matrix3x3 * matrix3x3,const TQ3Point2D * origin,float angle)4316 Q3Matrix3x3_SetRotateAboutPoint(TQ3Matrix3x3 *matrix3x3, const TQ3Point2D *origin, float angle)
4317 {
4318
4319
4320 // Release build checks
4321 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), NULL);
4322 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(origin), NULL);
4323
4324
4325
4326 // Debug build checks
4327 #if Q3_DEBUG
4328 if (0) // Further checks on matrix3x3
4329 return(NULL);
4330
4331 if (0) // Further checks on origin
4332 return(NULL);
4333
4334 if (0) // Further checks on angle
4335 return(NULL);
4336 #endif
4337
4338
4339
4340 // Call the bottleneck
4341 E3System_Bottleneck();
4342
4343
4344
4345 // Call our implementation
4346 return(E3Matrix3x3_SetRotateAboutPoint(matrix3x3, origin, angle));
4347 }
4348
4349
4350
4351
4352
4353 //=============================================================================
4354 // Q3Matrix4x4_SetRotateAboutPoint : Quesa API entry point.
4355 //-----------------------------------------------------------------------------
4356 TQ3Matrix4x4 *
Q3Matrix4x4_SetRotateAboutPoint(TQ3Matrix4x4 * matrix4x4,const TQ3Point3D * origin,float xAngle,float yAngle,float zAngle)4357 Q3Matrix4x4_SetRotateAboutPoint(TQ3Matrix4x4 *matrix4x4, const TQ3Point3D *origin, float xAngle, float yAngle, float zAngle)
4358 {
4359
4360
4361 // Release build checks
4362 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
4363 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(origin), NULL);
4364
4365
4366
4367 // Debug build checks
4368 #if Q3_DEBUG
4369 if (0) // Further checks on matrix4x4
4370 return(NULL);
4371
4372 if (0) // Further checks on origin
4373 return(NULL);
4374
4375 if (0) // Further checks on xAngle
4376 return(NULL);
4377
4378 if (0) // Further checks on yAngle
4379 return(NULL);
4380
4381 if (0) // Further checks on zAngle
4382 return(NULL);
4383 #endif
4384
4385
4386
4387 // Call the bottleneck
4388 E3System_Bottleneck();
4389
4390
4391
4392 // Call our implementation
4393 return(E3Matrix4x4_SetRotateAboutPoint(matrix4x4, origin, xAngle, yAngle, zAngle));
4394 }
4395
4396
4397
4398
4399
4400 //=============================================================================
4401 // Q3Matrix4x4_SetRotateAboutAxis : Quesa API entry point.
4402 //-----------------------------------------------------------------------------
4403 TQ3Matrix4x4 *
Q3Matrix4x4_SetRotateAboutAxis(TQ3Matrix4x4 * matrix4x4,const TQ3Point3D * origin,const TQ3Vector3D * axis,float angle)4404 Q3Matrix4x4_SetRotateAboutAxis(TQ3Matrix4x4 *matrix4x4, const TQ3Point3D *origin, const TQ3Vector3D *axis, float angle)
4405 {
4406
4407
4408 // Release build checks
4409 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
4410 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(origin), NULL);
4411 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(axis), NULL);
4412
4413
4414
4415 // Debug build checks
4416 #if Q3_DEBUG
4417 if (0) // Further checks on origin
4418 return(NULL);
4419
4420 // Further checks on axis
4421 if (fabs( Q3FastVector3D_Length( axis ) - 1.0f ) > kQ3RealZero)
4422 {
4423 E3ErrorManager_PostWarning( kQ3WarningVector3DNotUnitLength );
4424 }
4425
4426 if (0) // Further checks on angle
4427 return(NULL);
4428 #endif
4429
4430
4431
4432 // Call the bottleneck
4433 E3System_Bottleneck();
4434
4435
4436
4437 // Call our implementation
4438 return(E3Matrix4x4_SetRotateAboutAxis(matrix4x4, origin, axis, angle));
4439 }
4440
4441
4442
4443
4444
4445 //=============================================================================
4446 // Q3Matrix4x4_SetRotateVectorToVector : Quesa API entry point.
4447 //-----------------------------------------------------------------------------
4448 TQ3Matrix4x4 *
Q3Matrix4x4_SetRotateVectorToVector(TQ3Matrix4x4 * matrix4x4,const TQ3Vector3D * v1,const TQ3Vector3D * v2)4449 Q3Matrix4x4_SetRotateVectorToVector(TQ3Matrix4x4 *matrix4x4, const TQ3Vector3D *v1, const TQ3Vector3D *v2)
4450 {
4451
4452
4453 // Release build checks
4454 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
4455 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v1), NULL);
4456 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v2), NULL);
4457
4458
4459
4460 // Debug build checks
4461 #if Q3_DEBUG
4462 if (0) // Further checks on matrix4x4
4463 return(NULL);
4464
4465 // Further checks on v1
4466 if (fabs( Q3FastVector3D_Length( v1 ) - 1.0f ) > kQ3RealZero)
4467 {
4468 E3ErrorManager_PostWarning( kQ3WarningVector3DNotUnitLength );
4469 }
4470
4471 // Further checks on v2
4472 if (fabs( Q3FastVector3D_Length( v2 ) - 1.0f ) > kQ3RealZero)
4473 {
4474 E3ErrorManager_PostWarning( kQ3WarningVector3DNotUnitLength );
4475 }
4476 #endif
4477
4478
4479
4480 // Call the bottleneck
4481 E3System_Bottleneck();
4482
4483
4484
4485 // Call our implementation
4486 return(E3Matrix4x4_SetRotateVectorToVector(matrix4x4, v1, v2));
4487 }
4488
4489
4490
4491
4492
4493 //=============================================================================
4494 // Q3Matrix4x4_SetQuaternion : Quesa API entry point.
4495 //-----------------------------------------------------------------------------
4496 TQ3Matrix4x4 *
Q3Matrix4x4_SetQuaternion(TQ3Matrix4x4 * matrix4x4,const TQ3Quaternion * quaternion)4497 Q3Matrix4x4_SetQuaternion(TQ3Matrix4x4 *matrix4x4, const TQ3Quaternion *quaternion)
4498 {
4499
4500
4501 // Release build checks
4502 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
4503 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
4504
4505
4506
4507 // Debug build checks
4508 #if Q3_DEBUG
4509 if (0) // Further checks on matrix4x4
4510 return(NULL);
4511
4512 if (0) // Further checks on quaternion
4513 return(NULL);
4514 #endif
4515
4516
4517
4518 // Call the bottleneck
4519 E3System_Bottleneck();
4520
4521
4522
4523 // Call our implementation
4524 return(E3Matrix4x4_SetQuaternion(matrix4x4, quaternion));
4525 }
4526
4527
4528
4529
4530
4531 //=============================================================================
4532 // Q3Matrix3x3_Copy : Quesa API entry point.
4533 //-----------------------------------------------------------------------------
4534 TQ3Matrix3x3 *
Q3Matrix3x3_Copy(const TQ3Matrix3x3 * matrix3x3,TQ3Matrix3x3 * result)4535 Q3Matrix3x3_Copy(const TQ3Matrix3x3 *matrix3x3, TQ3Matrix3x3 *result)
4536 {
4537
4538
4539 // Release build checks
4540 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), NULL);
4541 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
4542
4543
4544
4545 // Debug build checks
4546 #if Q3_DEBUG
4547 if (0) // Further checks on matrix3x3
4548 return(NULL);
4549
4550 if (0) // Further checks on result
4551 return(NULL);
4552 #endif
4553
4554
4555
4556 // Call the bottleneck
4557 E3System_Bottleneck();
4558
4559
4560
4561 // Call our implementation
4562 return(E3Matrix3x3_Copy(matrix3x3, result));
4563 }
4564
4565
4566
4567
4568
4569 //=============================================================================
4570 // Q3Matrix4x4_Copy : Quesa API entry point.
4571 //-----------------------------------------------------------------------------
4572 TQ3Matrix4x4 *
Q3Matrix4x4_Copy(const TQ3Matrix4x4 * matrix4x4,TQ3Matrix4x4 * result)4573 Q3Matrix4x4_Copy(const TQ3Matrix4x4 *matrix4x4, TQ3Matrix4x4 *result)
4574 {
4575
4576
4577 // Release build checks
4578 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
4579 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
4580
4581
4582
4583 // Debug build checks
4584 #if Q3_DEBUG
4585 if (0) // Further checks on matrix4x4
4586 return(NULL);
4587
4588 if (0) // Further checks on result
4589 return(NULL);
4590 #endif
4591
4592
4593
4594 // Call the bottleneck
4595 E3System_Bottleneck();
4596
4597
4598
4599 // Call our implementation
4600 return(E3Matrix4x4_Copy(matrix4x4, result));
4601 }
4602
4603
4604
4605
4606
4607 //=============================================================================
4608 // Q3Matrix3x3_Transpose : Quesa API entry point.
4609 //-----------------------------------------------------------------------------
4610 TQ3Matrix3x3 *
Q3Matrix3x3_Transpose(const TQ3Matrix3x3 * matrix3x3,TQ3Matrix3x3 * result)4611 Q3Matrix3x3_Transpose(const TQ3Matrix3x3 *matrix3x3, TQ3Matrix3x3 *result)
4612 {
4613
4614
4615 // Release build checks
4616 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), NULL);
4617 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
4618
4619
4620
4621 // Debug build checks
4622 #if Q3_DEBUG
4623 if (0) // Further checks on matrix3x3
4624 return(NULL);
4625
4626 if (0) // Further checks on result
4627 return(NULL);
4628 #endif
4629
4630
4631
4632 // Call the bottleneck
4633 E3System_Bottleneck();
4634
4635
4636
4637 // Call our implementation
4638 return(E3Matrix3x3_Transpose(matrix3x3, result));
4639 }
4640
4641
4642
4643
4644
4645 //=============================================================================
4646 // Q3Matrix4x4_Transpose : Quesa API entry point.
4647 //-----------------------------------------------------------------------------
4648 TQ3Matrix4x4 *
Q3Matrix4x4_Transpose(const TQ3Matrix4x4 * matrix4x4,TQ3Matrix4x4 * result)4649 Q3Matrix4x4_Transpose(const TQ3Matrix4x4 *matrix4x4, TQ3Matrix4x4 *result)
4650 {
4651
4652
4653 // Release build checks
4654 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
4655 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
4656
4657
4658
4659 // Debug build checks
4660 #if Q3_DEBUG
4661 if (0) // Further checks on matrix4x4
4662 return(NULL);
4663
4664 if (0) // Further checks on result
4665 return(NULL);
4666 #endif
4667
4668
4669
4670 // Call the bottleneck
4671 E3System_Bottleneck();
4672
4673
4674
4675 // Call our implementation
4676 return(E3Matrix4x4_Transpose(matrix4x4, result));
4677 }
4678
4679
4680
4681
4682
4683 //=============================================================================
4684 // Q3Matrix3x3_Determinant : Quesa API entry point.
4685 //-----------------------------------------------------------------------------
4686 float
Q3Matrix3x3_Determinant(const TQ3Matrix3x3 * matrix3x3)4687 Q3Matrix3x3_Determinant(const TQ3Matrix3x3 *matrix3x3)
4688 {
4689
4690
4691 // Release build checks
4692 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), 0.0f);
4693
4694
4695
4696 // Debug build checks
4697 #if Q3_DEBUG
4698 if (0) // Further checks on matrix3x3
4699 return(0.0f);
4700 #endif
4701
4702
4703
4704 // Call the bottleneck
4705 E3System_Bottleneck();
4706
4707
4708
4709 // Call our implementation
4710 return(E3Matrix3x3_Determinant(matrix3x3));
4711 }
4712
4713
4714
4715
4716
4717 //=============================================================================
4718 // Q3Matrix4x4_Determinant : Quesa API entry point.
4719 //-----------------------------------------------------------------------------
4720 float
Q3Matrix4x4_Determinant(const TQ3Matrix4x4 * matrix4x4)4721 Q3Matrix4x4_Determinant(const TQ3Matrix4x4 *matrix4x4)
4722 {
4723
4724
4725 // Release build checks
4726 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), 0.0f);
4727
4728
4729
4730 // Debug build checks
4731 #if Q3_DEBUG
4732 if (0) // Further checks on matrix4x4
4733 return(0.0f);
4734 #endif
4735
4736
4737
4738 // Call the bottleneck
4739 E3System_Bottleneck();
4740
4741
4742
4743 // Call our implementation
4744 return(E3Matrix4x4_Determinant(matrix4x4));
4745 }
4746
4747
4748
4749
4750
4751 //=============================================================================
4752 // Q3Matrix3x3_Adjoint : Quesa API entry point.
4753 //-----------------------------------------------------------------------------
4754 TQ3Matrix3x3 *
Q3Matrix3x3_Adjoint(const TQ3Matrix3x3 * matrix3x3,TQ3Matrix3x3 * result)4755 Q3Matrix3x3_Adjoint(const TQ3Matrix3x3 *matrix3x3, TQ3Matrix3x3 *result)
4756 {
4757
4758
4759 // Release build checks
4760 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), NULL);
4761 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
4762
4763
4764
4765 // Debug build checks
4766 #if Q3_DEBUG
4767 if (0) // Further checks on matrix3x3
4768 return(NULL);
4769
4770 if (0) // Further checks on result
4771 return(NULL);
4772 #endif
4773
4774
4775
4776 // Call the bottleneck
4777 E3System_Bottleneck();
4778
4779
4780
4781 // Call our implementation
4782 return(E3Matrix3x3_Adjoint(matrix3x3, result));
4783 }
4784
4785
4786
4787
4788
4789 //=============================================================================
4790 // Q3Matrix3x3_Invert : Quesa API entry point.
4791 //-----------------------------------------------------------------------------
4792 TQ3Matrix3x3 *
Q3Matrix3x3_Invert(const TQ3Matrix3x3 * matrix3x3,TQ3Matrix3x3 * result)4793 Q3Matrix3x3_Invert(const TQ3Matrix3x3 *matrix3x3, TQ3Matrix3x3 *result)
4794 {
4795
4796
4797 // Release build checks
4798 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix3x3), NULL);
4799 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
4800
4801
4802
4803 // Debug build checks
4804 #if Q3_DEBUG
4805 if (0) // Further checks on matrix3x3
4806 return(NULL);
4807
4808 if (0) // Further checks on result
4809 return(NULL);
4810 #endif
4811
4812
4813
4814 // Call the bottleneck
4815 E3System_Bottleneck();
4816
4817
4818
4819 // Call our implementation
4820 return(E3Matrix3x3_Invert(matrix3x3, result));
4821 }
4822
4823
4824
4825
4826
4827 //=============================================================================
4828 // Q3Matrix4x4_Invert : Quesa API entry point.
4829 //-----------------------------------------------------------------------------
4830 TQ3Matrix4x4 *
Q3Matrix4x4_Invert(const TQ3Matrix4x4 * matrix4x4,TQ3Matrix4x4 * result)4831 Q3Matrix4x4_Invert(const TQ3Matrix4x4 *matrix4x4, TQ3Matrix4x4 *result)
4832 {
4833
4834
4835 // Release build checks
4836 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
4837 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
4838
4839
4840
4841 // Debug build checks
4842 #if Q3_DEBUG
4843 if (0) // Further checks on matrix4x4
4844 return(NULL);
4845
4846 if (0) // Further checks on result
4847 return(NULL);
4848 #endif
4849
4850
4851
4852 // Call the bottleneck
4853 E3System_Bottleneck();
4854
4855
4856
4857 // Call our implementation
4858 return(E3Matrix4x4_Invert(matrix4x4, result));
4859 }
4860
4861
4862
4863
4864
4865 //=============================================================================
4866 // Q3Matrix3x3_Multiply : Quesa API entry point.
4867 //-----------------------------------------------------------------------------
4868 TQ3Matrix3x3 *
Q3Matrix3x3_Multiply(const TQ3Matrix3x3 * m1,const TQ3Matrix3x3 * m2,TQ3Matrix3x3 * result)4869 Q3Matrix3x3_Multiply(const TQ3Matrix3x3 *m1, const TQ3Matrix3x3 *m2, TQ3Matrix3x3 *result)
4870 {
4871
4872
4873 // Release build checks
4874 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(m1), NULL);
4875 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(m2), NULL);
4876 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
4877
4878
4879
4880 // Debug build checks
4881 #if Q3_DEBUG
4882 if (0) // Further checks on m1
4883 return(NULL);
4884
4885 if (0) // Further checks on m2
4886 return(NULL);
4887
4888 if (0) // Further checks on result
4889 return(NULL);
4890 #endif
4891
4892
4893
4894 // Call the bottleneck
4895 E3System_Bottleneck();
4896
4897
4898
4899 // Call our implementation
4900 return(E3Matrix3x3_Multiply(m1, m2, result));
4901 }
4902
4903
4904
4905
4906
4907 //=============================================================================
4908 // Q3Matrix4x4_Multiply : Quesa API entry point.
4909 //-----------------------------------------------------------------------------
4910 TQ3Matrix4x4 *
Q3Matrix4x4_Multiply(const TQ3Matrix4x4 * m1,const TQ3Matrix4x4 * m2,TQ3Matrix4x4 * result)4911 Q3Matrix4x4_Multiply(const TQ3Matrix4x4 *m1, const TQ3Matrix4x4 *m2, TQ3Matrix4x4 *result)
4912 {
4913
4914
4915 // Release build checks
4916 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(m1), NULL);
4917 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(m2), NULL);
4918 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
4919
4920
4921
4922 // Debug build checks
4923 #if Q3_DEBUG
4924 if (0) // Further checks on m1
4925 return(NULL);
4926
4927 if (0) // Further checks on m2
4928 return(NULL);
4929
4930 if (0) // Further checks on result
4931 return(NULL);
4932 #endif
4933
4934
4935
4936 // Call the bottleneck
4937 E3System_Bottleneck();
4938
4939
4940
4941 // Call our implementation
4942 return(E3Matrix4x4_Multiply(m1, m2, result));
4943 }
4944
4945
4946
4947
4948
4949 //=============================================================================
4950 // Q3Quaternion_Set : Quesa API entry point.
4951 //-----------------------------------------------------------------------------
4952 #pragma mark -
4953 TQ3Quaternion *
Q3Quaternion_Set(TQ3Quaternion * quaternion,float w,float x,float y,float z)4954 Q3Quaternion_Set(TQ3Quaternion *quaternion, float w, float x, float y, float z)
4955 {
4956
4957
4958 // Release build checks
4959 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
4960
4961
4962
4963 // Debug build checks
4964 #if Q3_DEBUG
4965 if (0) // Further checks on quaternion
4966 return(NULL);
4967
4968 if (0) // Further checks on w
4969 return(NULL);
4970
4971 if (0) // Further checks on x
4972 return(NULL);
4973
4974 if (0) // Further checks on y
4975 return(NULL);
4976
4977 if (0) // Further checks on z
4978 return(NULL);
4979 #endif
4980
4981
4982
4983 // Call the bottleneck
4984 E3System_Bottleneck();
4985
4986
4987
4988 // Call our implementation
4989 return(E3Quaternion_Set(quaternion, w, x, y, z));
4990 }
4991
4992
4993
4994
4995
4996 //=============================================================================
4997 // Q3Quaternion_SetIdentity : Quesa API entry point.
4998 //-----------------------------------------------------------------------------
4999 TQ3Quaternion *
Q3Quaternion_SetIdentity(TQ3Quaternion * quaternion)5000 Q3Quaternion_SetIdentity(TQ3Quaternion *quaternion)
5001 {
5002
5003
5004 // Release build checks
5005 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
5006
5007
5008
5009 // Debug build checks
5010 #if Q3_DEBUG
5011 if (0) // Further checks on quaternion
5012 return(NULL);
5013 #endif
5014
5015
5016
5017 // Call the bottleneck
5018 E3System_Bottleneck();
5019
5020
5021
5022 // Call our implementation
5023 return(E3Quaternion_SetIdentity(quaternion));
5024 }
5025
5026
5027
5028
5029
5030 //=============================================================================
5031 // Q3Quaternion_SetRotate_X : Quesa API entry point.
5032 //-----------------------------------------------------------------------------
5033 TQ3Quaternion *
Q3Quaternion_SetRotate_X(TQ3Quaternion * quaternion,float angle)5034 Q3Quaternion_SetRotate_X(TQ3Quaternion *quaternion, float angle)
5035 {
5036
5037
5038 // Release build checks
5039 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
5040
5041
5042
5043 // Debug build checks
5044 #if Q3_DEBUG
5045 if (0) // Further checks on quaternion
5046 return(NULL);
5047
5048 if (0) // Further checks on angle
5049 return(NULL);
5050 #endif
5051
5052
5053
5054 // Call the bottleneck
5055 E3System_Bottleneck();
5056
5057
5058
5059 // Call our implementation
5060 return(E3Quaternion_SetRotate_X(quaternion, angle));
5061 }
5062
5063
5064
5065
5066
5067 //=============================================================================
5068 // Q3Quaternion_SetRotate_Y : Quesa API entry point.
5069 //-----------------------------------------------------------------------------
5070 TQ3Quaternion *
Q3Quaternion_SetRotate_Y(TQ3Quaternion * quaternion,float angle)5071 Q3Quaternion_SetRotate_Y(TQ3Quaternion *quaternion, float angle)
5072 {
5073
5074
5075 // Release build checks
5076 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
5077
5078
5079
5080 // Debug build checks
5081 #if Q3_DEBUG
5082 if (0) // Further checks on quaternion
5083 return(NULL);
5084
5085 if (0) // Further checks on angle
5086 return(NULL);
5087 #endif
5088
5089
5090
5091 // Call the bottleneck
5092 E3System_Bottleneck();
5093
5094
5095
5096 // Call our implementation
5097 return(E3Quaternion_SetRotate_Y(quaternion, angle));
5098 }
5099
5100
5101
5102
5103
5104 //=============================================================================
5105 // Q3Quaternion_SetRotate_Z : Quesa API entry point.
5106 //-----------------------------------------------------------------------------
5107 TQ3Quaternion *
Q3Quaternion_SetRotate_Z(TQ3Quaternion * quaternion,float angle)5108 Q3Quaternion_SetRotate_Z(TQ3Quaternion *quaternion, float angle)
5109 {
5110
5111
5112 // Release build checks
5113 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
5114
5115
5116
5117 // Debug build checks
5118 #if Q3_DEBUG
5119 if (0) // Further checks on quaternion
5120 return(NULL);
5121
5122 if (0) // Further checks on angle
5123 return(NULL);
5124 #endif
5125
5126
5127
5128 // Call the bottleneck
5129 E3System_Bottleneck();
5130
5131
5132
5133 // Call our implementation
5134 return(E3Quaternion_SetRotate_Z(quaternion, angle));
5135 }
5136
5137
5138
5139
5140
5141 //=============================================================================
5142 // Q3Quaternion_SetRotate_XYZ : Quesa API entry point.
5143 //-----------------------------------------------------------------------------
5144 TQ3Quaternion *
Q3Quaternion_SetRotate_XYZ(TQ3Quaternion * quaternion,float xAngle,float yAngle,float zAngle)5145 Q3Quaternion_SetRotate_XYZ(TQ3Quaternion *quaternion, float xAngle, float yAngle, float zAngle)
5146 {
5147
5148
5149 // Release build checks
5150 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
5151
5152
5153
5154 // Debug build checks
5155 #if Q3_DEBUG
5156 if (0) // Further checks on quaternion
5157 return(NULL);
5158
5159 if (0) // Further checks on xAngle
5160 return(NULL);
5161
5162 if (0) // Further checks on yAngle
5163 return(NULL);
5164
5165 if (0) // Further checks on zAngle
5166 return(NULL);
5167 #endif
5168
5169
5170
5171 // Call the bottleneck
5172 E3System_Bottleneck();
5173
5174
5175
5176 // Call our implementation
5177 return(E3Quaternion_SetRotate_XYZ(quaternion, xAngle, yAngle, zAngle));
5178 }
5179
5180
5181
5182
5183
5184 //=============================================================================
5185 // Q3Quaternion_SetRotateAboutAxis : Quesa API entry point.
5186 //-----------------------------------------------------------------------------
5187 TQ3Quaternion *
Q3Quaternion_SetRotateAboutAxis(TQ3Quaternion * quaternion,const TQ3Vector3D * axis,float angle)5188 Q3Quaternion_SetRotateAboutAxis(TQ3Quaternion *quaternion, const TQ3Vector3D *axis, float angle)
5189 {
5190
5191
5192 // Release build checks
5193 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
5194 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(axis), NULL);
5195
5196
5197
5198 // Debug build checks
5199 #if Q3_DEBUG
5200 if (0) // Further checks on quaternion
5201 return(NULL);
5202
5203 // Further checks on axis
5204 if (fabs( Q3FastVector3D_Length( axis ) - 1.0f ) > kQ3RealZero)
5205 {
5206 E3ErrorManager_PostWarning( kQ3WarningVector3DNotUnitLength );
5207 }
5208
5209 if (0) // Further checks on angle
5210 return(NULL);
5211 #endif
5212
5213
5214
5215 // Call the bottleneck
5216 E3System_Bottleneck();
5217
5218
5219
5220 // Call our implementation
5221 return(E3Quaternion_SetRotateAboutAxis(quaternion, axis, angle));
5222 }
5223
5224
5225
5226
5227
5228 //=============================================================================
5229 // Q3Quaternion_SetRotateVectorToVector : Quesa API entry point.
5230 //-----------------------------------------------------------------------------
5231 TQ3Quaternion *
Q3Quaternion_SetRotateVectorToVector(TQ3Quaternion * quaternion,const TQ3Vector3D * v1,const TQ3Vector3D * v2)5232 Q3Quaternion_SetRotateVectorToVector(TQ3Quaternion *quaternion, const TQ3Vector3D *v1, const TQ3Vector3D *v2)
5233 {
5234
5235
5236 // Release build checks
5237 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
5238 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v1), NULL);
5239 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(v2), NULL);
5240
5241
5242
5243 // Debug build checks
5244 #if Q3_DEBUG
5245 if (0) // Further checks on quaternion
5246 return(NULL);
5247
5248 // Further checks on v1
5249 if (fabs( Q3FastVector3D_Length( v1 ) - 1.0f ) > kQ3RealZero)
5250 {
5251 E3ErrorManager_PostWarning( kQ3WarningVector3DNotUnitLength );
5252 }
5253
5254 // Further checks on v2
5255 if (fabs( Q3FastVector3D_Length( v2 ) - 1.0f ) > kQ3RealZero)
5256 {
5257 E3ErrorManager_PostWarning( kQ3WarningVector3DNotUnitLength );
5258 }
5259 #endif
5260
5261
5262
5263 // Call the bottleneck
5264 E3System_Bottleneck();
5265
5266
5267
5268 // Call our implementation
5269 return(E3Quaternion_SetRotateVectorToVector(quaternion, v1, v2));
5270 }
5271
5272
5273
5274
5275
5276 //=============================================================================
5277 // Q3Quaternion_SetMatrix : Quesa API entry point.
5278 //-----------------------------------------------------------------------------
5279 TQ3Quaternion *
Q3Quaternion_SetMatrix(TQ3Quaternion * quaternion,const TQ3Matrix4x4 * matrix4x4)5280 Q3Quaternion_SetMatrix(TQ3Quaternion *quaternion, const TQ3Matrix4x4 *matrix4x4)
5281 {
5282
5283
5284 // Release build checks
5285 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
5286 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(matrix4x4), NULL);
5287
5288
5289
5290 // Debug build checks
5291 #if Q3_DEBUG
5292 if (0) // Further checks on quaternion
5293 return(NULL);
5294
5295 if (0) // Further checks on matrix4x4
5296 return(NULL);
5297 #endif
5298
5299
5300
5301 // Call the bottleneck
5302 E3System_Bottleneck();
5303
5304
5305
5306 // Call our implementation
5307 return(E3Quaternion_SetMatrix(quaternion, matrix4x4));
5308 }
5309
5310
5311
5312
5313
5314 //=============================================================================
5315 // Q3Quaternion_Copy : Quesa API entry point.
5316 //-----------------------------------------------------------------------------
5317 TQ3Quaternion *
Q3Quaternion_Copy(const TQ3Quaternion * quaternion,TQ3Quaternion * result)5318 Q3Quaternion_Copy(const TQ3Quaternion *quaternion, TQ3Quaternion *result)
5319 {
5320
5321
5322 // Release build checks
5323 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
5324 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
5325
5326
5327
5328 // Debug build checks
5329 #if Q3_DEBUG
5330 if (0) // Further checks on quaternion
5331 return(NULL);
5332
5333 if (0) // Further checks on result
5334 return(NULL);
5335 #endif
5336
5337
5338
5339 // Call the bottleneck
5340 E3System_Bottleneck();
5341
5342
5343
5344 // Call our implementation
5345 return(E3Quaternion_Copy(quaternion, result));
5346 }
5347
5348
5349
5350
5351
5352 //=============================================================================
5353 // Q3Quaternion_IsIdentity : Quesa API entry point.
5354 //-----------------------------------------------------------------------------
5355 TQ3Boolean
Q3Quaternion_IsIdentity(const TQ3Quaternion * quaternion)5356 Q3Quaternion_IsIdentity(const TQ3Quaternion *quaternion)
5357 {
5358
5359
5360 // Release build checks
5361 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), kQ3False);
5362
5363
5364
5365 // Debug build checks
5366 #if Q3_DEBUG
5367 // Further checks on quaternion
5368 if (fabs( Q3FastQuaternion_Dot( quaternion, quaternion ) - 1.0f ) > 10.0f * kQ3RealZero)
5369 {
5370 E3ErrorManager_PostWarning( kQ3WarningQuaternionNotNormalized );
5371 }
5372 #endif
5373
5374
5375
5376 // Call the bottleneck
5377 E3System_Bottleneck();
5378
5379
5380
5381 // Call our implementation
5382 return(E3Quaternion_IsIdentity(quaternion));
5383 }
5384
5385
5386
5387
5388
5389 //=============================================================================
5390 // Q3Quaternion_Dot : Quesa API entry point.
5391 //-----------------------------------------------------------------------------
5392 float
Q3Quaternion_Dot(const TQ3Quaternion * q1,const TQ3Quaternion * q2)5393 Q3Quaternion_Dot(const TQ3Quaternion *q1, const TQ3Quaternion *q2)
5394 {
5395
5396
5397 // Release build checks
5398 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(q1), 0.0f);
5399 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(q2), 0.0f);
5400
5401
5402
5403 // Debug build checks
5404 #if Q3_DEBUG
5405 if (0) // Further checks on q1
5406 return(0.0f);
5407
5408 if (0) // Further checks on q2
5409 return(0.0f);
5410 #endif
5411
5412
5413
5414 // Call the bottleneck
5415 E3System_Bottleneck();
5416
5417
5418
5419 // Call our implementation
5420 return(E3Quaternion_Dot(q1, q2));
5421 }
5422
5423
5424
5425
5426
5427 //=============================================================================
5428 // Q3Quaternion_Normalize : Quesa API entry point.
5429 //-----------------------------------------------------------------------------
5430 TQ3Quaternion *
Q3Quaternion_Normalize(const TQ3Quaternion * quaternion,TQ3Quaternion * result)5431 Q3Quaternion_Normalize(const TQ3Quaternion *quaternion, TQ3Quaternion *result)
5432 {
5433
5434
5435 // Release build checks
5436 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
5437 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
5438
5439
5440
5441 // Debug build checks
5442 #if Q3_DEBUG
5443 if (0) // Further checks on quaternion
5444 return(NULL);
5445
5446 if (0) // Further checks on result
5447 return(NULL);
5448 #endif
5449
5450
5451
5452 // Call the bottleneck
5453 E3System_Bottleneck();
5454
5455
5456
5457 // Call our implementation
5458 return(E3Quaternion_Normalize(quaternion, result));
5459 }
5460
5461
5462
5463
5464
5465 //=============================================================================
5466 // Q3Quaternion_Invert : Quesa API entry point.
5467 //-----------------------------------------------------------------------------
5468 TQ3Quaternion *
Q3Quaternion_Invert(const TQ3Quaternion * quaternion,TQ3Quaternion * result)5469 Q3Quaternion_Invert(const TQ3Quaternion *quaternion, TQ3Quaternion *result)
5470 {
5471
5472
5473 // Release build checks
5474 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
5475 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
5476
5477
5478
5479 // Debug build checks
5480 #if Q3_DEBUG
5481 // Further checks on quaternion
5482 if (fabs( Q3FastQuaternion_Dot( quaternion, quaternion ) - 1.0f ) > 10.0f * kQ3RealZero)
5483 {
5484 E3ErrorManager_PostWarning( kQ3WarningQuaternionNotNormalized );
5485 }
5486
5487 if (0) // Further checks on result
5488 return(NULL);
5489 #endif
5490
5491
5492
5493 // Call the bottleneck
5494 E3System_Bottleneck();
5495
5496
5497
5498 // Call our implementation
5499 return(E3Quaternion_Invert(quaternion, result));
5500 }
5501
5502
5503
5504
5505
5506 //=============================================================================
5507 // Q3Quaternion_Multiply : Quesa API entry point.
5508 //-----------------------------------------------------------------------------
5509 TQ3Quaternion *
Q3Quaternion_Multiply(const TQ3Quaternion * q1,const TQ3Quaternion * q2,TQ3Quaternion * result)5510 Q3Quaternion_Multiply(const TQ3Quaternion *q1, const TQ3Quaternion *q2, TQ3Quaternion *result)
5511 {
5512
5513
5514 // Release build checks
5515 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(q1), NULL);
5516 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(q2), NULL);
5517 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
5518
5519
5520
5521 // Debug build checks
5522 #if Q3_DEBUG
5523 if (0) // Further checks on q1
5524 return(NULL);
5525
5526 if (0) // Further checks on q2
5527 return(NULL);
5528
5529 if (0) // Further checks on result
5530 return(NULL);
5531 #endif
5532
5533
5534
5535 // Call the bottleneck
5536 E3System_Bottleneck();
5537
5538
5539
5540 // Call our implementation
5541 return(E3Quaternion_Multiply(q1, q2, result));
5542 }
5543
5544
5545
5546
5547
5548 //=============================================================================
5549 // Q3Quaternion_MatchReflection : Quesa API entry point.
5550 //-----------------------------------------------------------------------------
5551 TQ3Quaternion *
Q3Quaternion_MatchReflection(const TQ3Quaternion * q1,const TQ3Quaternion * q2,TQ3Quaternion * result)5552 Q3Quaternion_MatchReflection(const TQ3Quaternion *q1, const TQ3Quaternion *q2, TQ3Quaternion *result)
5553 {
5554
5555
5556 // Release build checks
5557 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(q1), NULL);
5558 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(q2), NULL);
5559 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
5560
5561
5562
5563 // Debug build checks
5564 #if Q3_DEBUG
5565 if (0) // Further checks on q1
5566 return(NULL);
5567
5568 if (0) // Further checks on q2
5569 return(NULL);
5570
5571 if (0) // Further checks on result
5572 return(NULL);
5573 #endif
5574
5575
5576
5577 // Call the bottleneck
5578 E3System_Bottleneck();
5579
5580
5581
5582 // Call our implementation
5583 return(E3Quaternion_MatchReflection(q1, q2, result));
5584 }
5585
5586
5587
5588
5589
5590 //=============================================================================
5591 // Q3Quaternion_InterpolateFast : Quesa API entry point.
5592 //-----------------------------------------------------------------------------
5593 TQ3Quaternion *
Q3Quaternion_InterpolateFast(const TQ3Quaternion * q1,const TQ3Quaternion * q2,float t,TQ3Quaternion * result)5594 Q3Quaternion_InterpolateFast(const TQ3Quaternion *q1, const TQ3Quaternion *q2, float t, TQ3Quaternion *result)
5595 {
5596
5597
5598 // Release build checks
5599 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(q1), NULL);
5600 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(q2), NULL);
5601 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
5602
5603
5604
5605 // Debug build checks
5606 #if Q3_DEBUG
5607 if (0) // Further checks on q1
5608 return(NULL);
5609
5610 if (0) // Further checks on q2
5611 return(NULL);
5612
5613 if (0) // Further checks on t
5614 return(NULL);
5615
5616 if (0) // Further checks on result
5617 return(NULL);
5618 #endif
5619
5620
5621
5622 // Call the bottleneck
5623 E3System_Bottleneck();
5624
5625
5626
5627 // Call our implementation
5628 return(E3Quaternion_InterpolateFast(q1, q2, t, result));
5629 }
5630
5631
5632
5633
5634
5635 //=============================================================================
5636 // Q3Quaternion_InterpolateLinear : Quesa API entry point.
5637 //-----------------------------------------------------------------------------
5638 TQ3Quaternion *
Q3Quaternion_InterpolateLinear(const TQ3Quaternion * q1,const TQ3Quaternion * q2,float t,TQ3Quaternion * result)5639 Q3Quaternion_InterpolateLinear(const TQ3Quaternion *q1, const TQ3Quaternion *q2, float t, TQ3Quaternion *result)
5640 {
5641
5642
5643 // Release build checks
5644 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(q1), NULL);
5645 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(q2), NULL);
5646 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
5647
5648
5649
5650 // Debug build checks
5651 #if Q3_DEBUG
5652 if (0) // Further checks on q1
5653 return(NULL);
5654
5655 if (0) // Further checks on q2
5656 return(NULL);
5657
5658 if (0) // Further checks on t
5659 return(NULL);
5660
5661 if (0) // Further checks on result
5662 return(NULL);
5663 #endif
5664
5665
5666
5667 // Call the bottleneck
5668 E3System_Bottleneck();
5669
5670
5671
5672 // Call our implementation
5673 return(E3Quaternion_InterpolateLinear(q1, q2, t, result));
5674 }
5675
5676
5677
5678 //=============================================================================
5679 // Q3Quaternion_GetAxisAndAngle : Quesa API entry point.
5680 //-----------------------------------------------------------------------------
5681 TQ3Vector3D *
Q3Quaternion_GetAxisAndAngle(const TQ3Quaternion * quaternion,TQ3Vector3D * outAxis,float * outAngle)5682 Q3Quaternion_GetAxisAndAngle(const TQ3Quaternion *quaternion, TQ3Vector3D *outAxis, float *outAngle)
5683 {
5684
5685 // Release build checks
5686 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
5687
5688
5689
5690 // Debug build checks
5691 #if Q3_DEBUG
5692 // Further checks on quaternion
5693 if (fabs( Q3FastQuaternion_Dot( quaternion, quaternion ) - 1.0f ) > 10.0f * kQ3RealZero)
5694 {
5695 E3ErrorManager_PostWarning( kQ3WarningQuaternionNotNormalized );
5696 }
5697
5698 if (0) // Further checks on outAngle
5699 return(NULL);
5700
5701 if (0) // Further checks on outAxis
5702 return(NULL);
5703
5704 #endif
5705
5706
5707
5708 // Call the bottleneck
5709 E3System_Bottleneck();
5710
5711
5712
5713 // Call our implementation
5714 return(E3Quaternion_GetAxisAndAngle(quaternion, outAxis, outAngle));
5715 }
5716
5717
5718 //=============================================================================
5719 // Q3Vector3D_TransformQuaternion : Quesa API entry point.
5720 //-----------------------------------------------------------------------------
5721 TQ3Vector3D *
Q3Vector3D_TransformQuaternion(const TQ3Vector3D * vector3D,const TQ3Quaternion * quaternion,TQ3Vector3D * result)5722 Q3Vector3D_TransformQuaternion(const TQ3Vector3D *vector3D, const TQ3Quaternion *quaternion, TQ3Vector3D *result)
5723 {
5724
5725
5726 // Release build checks
5727 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(vector3D), NULL);
5728 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
5729 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
5730
5731
5732
5733 // Debug build checks
5734 #if Q3_DEBUG
5735 if (0) // Further checks on vector3D
5736 return(NULL);
5737
5738 // Further checks on quaternion
5739 if (fabs( Q3FastQuaternion_Dot( quaternion, quaternion ) - 1.0f ) > 10.0f * kQ3RealZero)
5740 {
5741 E3ErrorManager_PostWarning( kQ3WarningQuaternionNotNormalized );
5742 }
5743
5744 if (0) // Further checks on result
5745 return(NULL);
5746 #endif
5747
5748
5749
5750 // Call the bottleneck
5751 E3System_Bottleneck();
5752
5753
5754
5755 // Call our implementation
5756 return(E3Vector3D_TransformQuaternion(vector3D, quaternion, result));
5757 }
5758
5759
5760
5761
5762
5763 //=============================================================================
5764 // Q3Point3D_TransformQuaternion : Quesa API entry point.
5765 //-----------------------------------------------------------------------------
5766 TQ3Point3D *
Q3Point3D_TransformQuaternion(const TQ3Point3D * point3D,const TQ3Quaternion * quaternion,TQ3Point3D * result)5767 Q3Point3D_TransformQuaternion(const TQ3Point3D *point3D, const TQ3Quaternion *quaternion, TQ3Point3D *result)
5768 {
5769
5770
5771 // Release build checks
5772 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point3D), NULL);
5773 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(quaternion), NULL);
5774 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
5775
5776
5777
5778 // Debug build checks
5779 #if Q3_DEBUG
5780 if (0) // Further checks on point3D
5781 return(NULL);
5782
5783 // Further checks on quaternion
5784 if (fabs( Q3FastQuaternion_Dot( quaternion, quaternion ) - 1.0f ) > 10.0f * kQ3RealZero)
5785 {
5786 E3ErrorManager_PostWarning( kQ3WarningQuaternionNotNormalized );
5787 }
5788
5789 if (0) // Further checks on result
5790 return(NULL);
5791 #endif
5792
5793
5794
5795 // Call the bottleneck
5796 E3System_Bottleneck();
5797
5798
5799
5800 // Call our implementation
5801 return(E3Point3D_TransformQuaternion(point3D, quaternion, result));
5802 }
5803
5804
5805
5806
5807
5808 //=============================================================================
5809 // Q3BoundingBox_Reset : Quesa API entry point.
5810 //-----------------------------------------------------------------------------
5811 #pragma mark -
5812 TQ3BoundingBox *
Q3BoundingBox_Reset(TQ3BoundingBox * bBox)5813 Q3BoundingBox_Reset(TQ3BoundingBox *bBox)
5814 {
5815
5816
5817 // Release build checks
5818 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bBox), NULL);
5819
5820
5821
5822 // Debug build checks
5823 #if Q3_DEBUG
5824 if (0) // Further checks on bBox
5825 return(NULL);
5826 #endif
5827
5828
5829
5830 // Call the bottleneck
5831 E3System_Bottleneck();
5832
5833
5834
5835 // Call our implementation
5836 return(E3BoundingBox_Reset(bBox));
5837 }
5838
5839
5840
5841
5842
5843 //=============================================================================
5844 // Q3BoundingBox_Set : Quesa API entry point.
5845 //-----------------------------------------------------------------------------
5846 TQ3BoundingBox *
Q3BoundingBox_Set(TQ3BoundingBox * bBox,const TQ3Point3D * min,const TQ3Point3D * max,TQ3Boolean isEmpty)5847 Q3BoundingBox_Set(TQ3BoundingBox *bBox, const TQ3Point3D *min, const TQ3Point3D *max, TQ3Boolean isEmpty)
5848 {
5849
5850
5851 // Release build checks
5852 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bBox), NULL);
5853 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(min), NULL);
5854 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(max), NULL);
5855
5856
5857
5858 // Debug build checks
5859 #if Q3_DEBUG
5860 if (0) // Further checks on bBox
5861 return(NULL);
5862
5863 // Further checks on min and max
5864 if (min->x > max->x ||
5865 min->y > max->y ||
5866 min->z > max->z)
5867 return(NULL);
5868
5869 if (0) // Further checks on isEmpty
5870 return(NULL);
5871 #endif
5872
5873
5874
5875 // Call the bottleneck
5876 E3System_Bottleneck();
5877
5878
5879
5880 // Call our implementation
5881 return(E3BoundingBox_Set(bBox, min, max, isEmpty));
5882 }
5883
5884
5885
5886
5887
5888 //=============================================================================
5889 // Q3BoundingBox_SetFromPoints3D : Quesa API entry point.
5890 //-----------------------------------------------------------------------------
5891 TQ3BoundingBox *
Q3BoundingBox_SetFromPoints3D(TQ3BoundingBox * bBox,const TQ3Point3D * points3D,TQ3Uns32 numPoints,TQ3Uns32 structSize)5892 Q3BoundingBox_SetFromPoints3D(TQ3BoundingBox *bBox, const TQ3Point3D *points3D, TQ3Uns32 numPoints, TQ3Uns32 structSize)
5893 {
5894
5895
5896 // Release build checks
5897 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bBox), NULL);
5898 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(points3D), NULL);
5899
5900
5901
5902 // Debug build checks
5903 #if Q3_DEBUG
5904 if (0) // Further checks on bBox
5905 return(NULL);
5906
5907 if (0) // Further checks on points3D
5908 return(NULL);
5909
5910 if (0) // Further checks on numPoints
5911 return(NULL);
5912
5913 if (0) // Further checks on structSize
5914 return(NULL);
5915 #endif
5916
5917
5918
5919 // Call the bottleneck
5920 E3System_Bottleneck();
5921
5922
5923
5924 // Call our implementation
5925 return(E3BoundingBox_SetFromPoints3D(bBox, points3D, numPoints, structSize));
5926 }
5927
5928
5929
5930
5931
5932 //=============================================================================
5933 // Q3BoundingBox_SetFromRationalPoints4D : Quesa API entry point.
5934 //-----------------------------------------------------------------------------
5935 TQ3BoundingBox *
Q3BoundingBox_SetFromRationalPoints4D(TQ3BoundingBox * bBox,const TQ3RationalPoint4D * rationalPoints4D,TQ3Uns32 numPoints,TQ3Uns32 structSize)5936 Q3BoundingBox_SetFromRationalPoints4D(TQ3BoundingBox *bBox, const TQ3RationalPoint4D *rationalPoints4D, TQ3Uns32 numPoints, TQ3Uns32 structSize)
5937 {
5938
5939
5940 // Release build checks
5941 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bBox), NULL);
5942 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(rationalPoints4D), NULL);
5943
5944
5945
5946 // Debug build checks
5947 #if Q3_DEBUG
5948 if (0) // Further checks on bBox
5949 return(NULL);
5950
5951 if (0) // Further checks on rationalPoints4D
5952 return(NULL);
5953
5954 if (0) // Further checks on numPoints
5955 return(NULL);
5956
5957 if (0) // Further checks on structSize
5958 return(NULL);
5959 #endif
5960
5961
5962
5963 // Call the bottleneck
5964 E3System_Bottleneck();
5965
5966
5967
5968 // Call our implementation
5969 return(E3BoundingBox_SetFromRationalPoints4D(bBox, rationalPoints4D, numPoints, structSize));
5970 }
5971
5972
5973
5974
5975
5976 //=============================================================================
5977 // Q3BoundingBox_Copy : Quesa API entry point.
5978 //-----------------------------------------------------------------------------
5979 TQ3BoundingBox *
Q3BoundingBox_Copy(const TQ3BoundingBox * bBox,TQ3BoundingBox * result)5980 Q3BoundingBox_Copy(const TQ3BoundingBox *bBox, TQ3BoundingBox *result)
5981 {
5982
5983
5984 // Release build checks
5985 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bBox), NULL);
5986 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
5987
5988
5989
5990 // Debug build checks
5991 #if Q3_DEBUG
5992 if (0) // Further checks on bBox
5993 return(NULL);
5994
5995 if (0) // Further checks on result
5996 return(NULL);
5997 #endif
5998
5999
6000
6001 // Call the bottleneck
6002 E3System_Bottleneck();
6003
6004
6005
6006 // Call our implementation
6007 return(E3BoundingBox_Copy(bBox, result));
6008 }
6009
6010
6011
6012
6013
6014 //=============================================================================
6015 // Q3BoundingBox_Union : Quesa API entry point.
6016 //-----------------------------------------------------------------------------
6017 TQ3BoundingBox *
Q3BoundingBox_Union(const TQ3BoundingBox * b1,const TQ3BoundingBox * b2,TQ3BoundingBox * result)6018 Q3BoundingBox_Union(const TQ3BoundingBox *b1, const TQ3BoundingBox *b2, TQ3BoundingBox *result)
6019 {
6020
6021
6022 // Release build checks
6023 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(b1), NULL);
6024 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(b2), NULL);
6025 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
6026
6027
6028
6029 // Debug build checks
6030 #if Q3_DEBUG
6031 if (0) // Further checks on b1
6032 return(NULL);
6033
6034 if (0) // Further checks on b2
6035 return(NULL);
6036
6037 if (0) // Further checks on result
6038 return(NULL);
6039 #endif
6040
6041
6042
6043 // Call the bottleneck
6044 E3System_Bottleneck();
6045
6046
6047
6048 // Call our implementation
6049 return(E3BoundingBox_Union(b1, b2, result));
6050 }
6051
6052
6053
6054
6055
6056 //=============================================================================
6057 // Q3BoundingBox_UnionPoint3D : Quesa API entry point.
6058 //-----------------------------------------------------------------------------
6059 TQ3BoundingBox *
Q3BoundingBox_UnionPoint3D(const TQ3BoundingBox * bBox,const TQ3Point3D * point3D,TQ3BoundingBox * result)6060 Q3BoundingBox_UnionPoint3D(const TQ3BoundingBox *bBox, const TQ3Point3D *point3D, TQ3BoundingBox *result)
6061 {
6062
6063
6064 // Release build checks
6065 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bBox), NULL);
6066 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point3D), NULL);
6067 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
6068
6069
6070
6071 // Debug build checks
6072 #if Q3_DEBUG
6073 if (0) // Further checks on bBox
6074 return(NULL);
6075
6076 if (0) // Further checks on point3D
6077 return(NULL);
6078
6079 if (0) // Further checks on result
6080 return(NULL);
6081 #endif
6082
6083
6084
6085 // Call the bottleneck
6086 E3System_Bottleneck();
6087
6088
6089
6090 // Call our implementation
6091 return(E3BoundingBox_UnionPoint3D(bBox, point3D, result));
6092 }
6093
6094
6095
6096
6097
6098 //=============================================================================
6099 // Q3BoundingBox_UnionRationalPoint4D : Quesa API entry point.
6100 //-----------------------------------------------------------------------------
6101 TQ3BoundingBox *
Q3BoundingBox_UnionRationalPoint4D(const TQ3BoundingBox * bBox,const TQ3RationalPoint4D * rationalPoint4D,TQ3BoundingBox * result)6102 Q3BoundingBox_UnionRationalPoint4D(const TQ3BoundingBox *bBox, const TQ3RationalPoint4D *rationalPoint4D, TQ3BoundingBox *result)
6103 {
6104
6105
6106 // Release build checks
6107 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bBox), NULL);
6108 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(rationalPoint4D), NULL);
6109 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
6110
6111
6112
6113 // Debug build checks
6114 #if Q3_DEBUG
6115 if (0) // Further checks on bBox
6116 return(NULL);
6117
6118 if (0) // Further checks on rationalPoint4D
6119 return(NULL);
6120
6121 if (0) // Further checks on result
6122 return(NULL);
6123 #endif
6124
6125
6126
6127 // Call the bottleneck
6128 E3System_Bottleneck();
6129
6130
6131
6132 // Call our implementation
6133 return(E3BoundingBox_UnionRationalPoint4D(bBox, rationalPoint4D, result));
6134 }
6135
6136
6137
6138
6139
6140 //=============================================================================
6141 // Q3BoundingSphere_Reset : Quesa API entry point.
6142 //-----------------------------------------------------------------------------
6143 #pragma mark -
6144 TQ3BoundingSphere *
Q3BoundingSphere_Reset(TQ3BoundingSphere * bSphere)6145 Q3BoundingSphere_Reset(TQ3BoundingSphere *bSphere)
6146 {
6147
6148
6149 // Release build checks
6150 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bSphere), NULL);
6151
6152
6153
6154 // Debug build checks
6155 #if Q3_DEBUG
6156 if (0) // Further checks on bSphere
6157 return(NULL);
6158 #endif
6159
6160
6161
6162 // Call the bottleneck
6163 E3System_Bottleneck();
6164
6165
6166
6167 // Call our implementation
6168 return(E3BoundingSphere_Reset(bSphere));
6169 }
6170
6171
6172
6173
6174
6175 //=============================================================================
6176 // Q3BoundingSphere_Set : Quesa API entry point.
6177 //-----------------------------------------------------------------------------
6178 TQ3BoundingSphere *
Q3BoundingSphere_Set(TQ3BoundingSphere * bSphere,const TQ3Point3D * origin,float radius,TQ3Boolean isEmpty)6179 Q3BoundingSphere_Set(TQ3BoundingSphere *bSphere, const TQ3Point3D *origin, float radius, TQ3Boolean isEmpty)
6180 {
6181
6182
6183 // Release build checks
6184 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bSphere), NULL);
6185 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(origin), NULL);
6186
6187
6188
6189 // Debug build checks
6190 #if Q3_DEBUG
6191 if (0) // Further checks on bSphere
6192 return(NULL);
6193
6194 if (0) // Further checks on origin
6195 return(NULL);
6196
6197 if (0) // Further checks on radius
6198 return(NULL);
6199
6200 if (0) // Further checks on isEmpty
6201 return(NULL);
6202 #endif
6203
6204
6205
6206 // Call the bottleneck
6207 E3System_Bottleneck();
6208
6209
6210
6211 // Call our implementation
6212 return(E3BoundingSphere_Set(bSphere, origin, radius, isEmpty));
6213 }
6214
6215
6216
6217
6218
6219 //=============================================================================
6220 // Q3BoundingSphere_SetFromPoints3D : Quesa API entry point.
6221 //-----------------------------------------------------------------------------
6222 TQ3BoundingSphere *
Q3BoundingSphere_SetFromPoints3D(TQ3BoundingSphere * bSphere,const TQ3Point3D * points3D,TQ3Uns32 numPoints,TQ3Uns32 structSize)6223 Q3BoundingSphere_SetFromPoints3D(TQ3BoundingSphere *bSphere, const TQ3Point3D *points3D, TQ3Uns32 numPoints, TQ3Uns32 structSize)
6224 {
6225
6226
6227 // Release build checks
6228 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bSphere), NULL);
6229 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(points3D), NULL);
6230
6231
6232
6233 // Debug build checks
6234 #if Q3_DEBUG
6235 if (0) // Further checks on bSphere
6236 return(NULL);
6237
6238 if (0) // Further checks on points3D
6239 return(NULL);
6240
6241 if (0) // Further checks on numPoints
6242 return(NULL);
6243
6244 if (0) // Further checks on structSize
6245 return(NULL);
6246 #endif
6247
6248
6249
6250 // Call the bottleneck
6251 E3System_Bottleneck();
6252
6253
6254
6255 // Call our implementation
6256 return(E3BoundingSphere_SetFromPoints3D(bSphere, points3D, numPoints, structSize));
6257 }
6258
6259
6260
6261
6262
6263 //=============================================================================
6264 // Q3BoundingSphere_SetFromRationalPoints4D : Quesa API entry point.
6265 //-----------------------------------------------------------------------------
6266 TQ3BoundingSphere *
Q3BoundingSphere_SetFromRationalPoints4D(TQ3BoundingSphere * bSphere,const TQ3RationalPoint4D * rationalPoints4D,TQ3Uns32 numPoints,TQ3Uns32 structSize)6267 Q3BoundingSphere_SetFromRationalPoints4D(TQ3BoundingSphere *bSphere, const TQ3RationalPoint4D *rationalPoints4D, TQ3Uns32 numPoints, TQ3Uns32 structSize)
6268 {
6269
6270
6271 // Release build checks
6272 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bSphere), NULL);
6273 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(rationalPoints4D), NULL);
6274
6275
6276
6277 // Debug build checks
6278 #if Q3_DEBUG
6279 if (0) // Further checks on bSphere
6280 return(NULL);
6281
6282 if (0) // Further checks on rationalPoints4D
6283 return(NULL);
6284
6285 if (0) // Further checks on numPoints
6286 return(NULL);
6287
6288 if (0) // Further checks on structSize
6289 return(NULL);
6290 #endif
6291
6292
6293
6294 // Call the bottleneck
6295 E3System_Bottleneck();
6296
6297
6298
6299 // Call our implementation
6300 return(E3BoundingSphere_SetFromRationalPoints4D(bSphere, rationalPoints4D, numPoints, structSize));
6301 }
6302
6303
6304
6305
6306
6307 //=============================================================================
6308 // Q3BoundingSphere_Copy : Quesa API entry point.
6309 //-----------------------------------------------------------------------------
6310 TQ3BoundingSphere *
Q3BoundingSphere_Copy(const TQ3BoundingSphere * bSphere,TQ3BoundingSphere * result)6311 Q3BoundingSphere_Copy(const TQ3BoundingSphere *bSphere, TQ3BoundingSphere *result)
6312 {
6313
6314
6315 // Release build checks
6316 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bSphere), NULL);
6317 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
6318
6319
6320
6321 // Debug build checks
6322 #if Q3_DEBUG
6323 if (0) // Further checks on bSphere
6324 return(NULL);
6325
6326 if (0) // Further checks on result
6327 return(NULL);
6328 #endif
6329
6330
6331
6332 // Call the bottleneck
6333 E3System_Bottleneck();
6334
6335
6336
6337 // Call our implementation
6338 return(E3BoundingSphere_Copy(bSphere, result));
6339 }
6340
6341
6342
6343
6344
6345 //=============================================================================
6346 // Q3BoundingSphere_Union : Quesa API entry point.
6347 //-----------------------------------------------------------------------------
6348 TQ3BoundingSphere *
Q3BoundingSphere_Union(const TQ3BoundingSphere * s1,const TQ3BoundingSphere * s2,TQ3BoundingSphere * result)6349 Q3BoundingSphere_Union(const TQ3BoundingSphere *s1, const TQ3BoundingSphere *s2, TQ3BoundingSphere *result)
6350 {
6351
6352
6353 // Release build checks
6354 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(s1), NULL);
6355 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(s2), NULL);
6356 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
6357
6358
6359
6360 // Debug build checks
6361 #if Q3_DEBUG
6362 if (0) // Further checks on s1
6363 return(NULL);
6364
6365 if (0) // Further checks on s2
6366 return(NULL);
6367
6368 if (0) // Further checks on result
6369 return(NULL);
6370 #endif
6371
6372
6373
6374 // Call the bottleneck
6375 E3System_Bottleneck();
6376
6377
6378
6379 // Call our implementation
6380 return(E3BoundingSphere_Union(s1, s2, result));
6381 }
6382
6383
6384
6385
6386
6387 //=============================================================================
6388 // Q3BoundingSphere_UnionPoint3D : Quesa API entry point.
6389 //-----------------------------------------------------------------------------
6390 TQ3BoundingSphere *
Q3BoundingSphere_UnionPoint3D(const TQ3BoundingSphere * bSphere,const TQ3Point3D * point3D,TQ3BoundingSphere * result)6391 Q3BoundingSphere_UnionPoint3D(const TQ3BoundingSphere *bSphere, const TQ3Point3D *point3D, TQ3BoundingSphere *result)
6392 {
6393
6394
6395 // Release build checks
6396 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bSphere), NULL);
6397 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point3D), NULL);
6398 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
6399
6400
6401
6402 // Debug build checks
6403 #if Q3_DEBUG
6404 if (0) // Further checks on bSphere
6405 return(NULL);
6406
6407 if (0) // Further checks on point3D
6408 return(NULL);
6409
6410 if (0) // Further checks on result
6411 return(NULL);
6412 #endif
6413
6414
6415
6416 // Call the bottleneck
6417 E3System_Bottleneck();
6418
6419
6420
6421 // Call our implementation
6422 return(E3BoundingSphere_UnionPoint3D(bSphere, point3D, result));
6423 }
6424
6425
6426
6427
6428
6429 //=============================================================================
6430 // Q3BoundingSphere_UnionRationalPoint4D : Quesa API entry point.
6431 //-----------------------------------------------------------------------------
6432 TQ3BoundingSphere *
Q3BoundingSphere_UnionRationalPoint4D(const TQ3BoundingSphere * bSphere,const TQ3RationalPoint4D * rationalPoint4D,TQ3BoundingSphere * result)6433 Q3BoundingSphere_UnionRationalPoint4D(const TQ3BoundingSphere *bSphere, const TQ3RationalPoint4D *rationalPoint4D, TQ3BoundingSphere *result)
6434 {
6435
6436
6437 // Release build checks
6438 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bSphere), NULL);
6439 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(rationalPoint4D), NULL);
6440 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(result), NULL);
6441
6442
6443
6444 // Debug build checks
6445 #if Q3_DEBUG
6446 if (0) // Further checks on bSphere
6447 return(NULL);
6448
6449 if (0) // Further checks on rationalPoint4D
6450 return(NULL);
6451
6452 if (0) // Further checks on result
6453 return(NULL);
6454 #endif
6455
6456
6457
6458 // Call the bottleneck
6459 E3System_Bottleneck();
6460
6461
6462
6463 // Call our implementation
6464 return(E3BoundingSphere_UnionRationalPoint4D(bSphere, rationalPoint4D, result));
6465 }
6466
6467
6468
6469
6470
6471 //=============================================================================
6472 // Q3Ray3D_IntersectSphere : Quesa API entry point.
6473 //-----------------------------------------------------------------------------
6474 TQ3Boolean
Q3Ray3D_IntersectSphere(const TQ3Ray3D * theRay,const TQ3Sphere * theSphere,TQ3Point3D * hitPoint)6475 Q3Ray3D_IntersectSphere(const TQ3Ray3D *theRay, const TQ3Sphere *theSphere, TQ3Point3D *hitPoint)
6476 {
6477
6478
6479 // Release build checks
6480 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(theRay), kQ3False);
6481 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(theSphere), kQ3False);
6482 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(hitPoint), kQ3False);
6483
6484
6485
6486 // Debug build checks
6487 #if Q3_DEBUG
6488 // Further checks on theRay
6489 if (fabs( Q3FastVector3D_Length( &theRay->direction) - 1.0f ) > kQ3RealZero)
6490 {
6491 E3ErrorManager_PostWarning( kQ3WarningVector3DNotUnitLength );
6492 }
6493
6494 if (0) // Further checks on theSphere
6495 return(kQ3False);
6496
6497 if (0) // Further checks on hitPoint
6498 return(kQ3False);
6499 #endif
6500
6501
6502
6503 // Call the bottleneck
6504 E3System_Bottleneck();
6505
6506
6507
6508 // Call our implementation
6509 return(E3Ray3D_IntersectSphere(theRay, theSphere, hitPoint));
6510 }
6511
6512
6513
6514
6515
6516 //=============================================================================
6517 // Q3Ray3D_IntersectBoundingBox : Quesa API entry point.
6518 //-----------------------------------------------------------------------------
6519 TQ3Boolean
Q3Ray3D_IntersectBoundingBox(const TQ3Ray3D * theRay,const TQ3BoundingBox * theBounds,TQ3Point3D * hitPoint)6520 Q3Ray3D_IntersectBoundingBox(const TQ3Ray3D *theRay, const TQ3BoundingBox *theBounds, TQ3Point3D *hitPoint)
6521 {
6522
6523
6524 // Release build checks
6525 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(theRay), kQ3False);
6526 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(theBounds), kQ3False);
6527 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(hitPoint), kQ3False);
6528
6529
6530
6531 // Debug build checks
6532 #if Q3_DEBUG
6533 // Further checks on theRay
6534 if (fabs( Q3FastVector3D_Length( &theRay->direction) - 1.0f ) > kQ3RealZero)
6535 {
6536 E3ErrorManager_PostWarning( kQ3WarningVector3DNotUnitLength );
6537 }
6538
6539 if (0) // Further checks on theBounds
6540 return(kQ3False);
6541
6542 if (0) // Further checks on hitPoint
6543 return(kQ3False);
6544 #endif
6545
6546
6547
6548 // Call the bottleneck
6549 E3System_Bottleneck();
6550
6551
6552
6553 // Call our implementation
6554 return(E3Ray3D_IntersectBoundingBox(theRay, theBounds, hitPoint));
6555 }
6556
6557
6558
6559
6560
6561 //=============================================================================
6562 // Q3Ray3D_IntersectTriangle : Quesa API entry point.
6563 //-----------------------------------------------------------------------------
6564 TQ3Boolean
Q3Ray3D_IntersectTriangle(const TQ3Ray3D * theRay,const TQ3Point3D * point1,const TQ3Point3D * point2,const TQ3Point3D * point3,TQ3Boolean cullBackfacing,TQ3Param3D * hitPoint)6565 Q3Ray3D_IntersectTriangle(const TQ3Ray3D *theRay, const TQ3Point3D *point1, const TQ3Point3D *point2, const TQ3Point3D *point3, TQ3Boolean cullBackfacing, TQ3Param3D *hitPoint)
6566 {
6567
6568
6569 // Release build checks
6570 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(theRay), kQ3False);
6571 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point1), kQ3False);
6572 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point2), kQ3False);
6573 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(point3), kQ3False);
6574 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(hitPoint), kQ3False);
6575
6576
6577
6578 // Debug build checks
6579 #if Q3_DEBUG
6580 if (0) // Further checks on theRay
6581 return(kQ3False);
6582
6583 if (0) // Further checks on point1
6584 return(kQ3False);
6585
6586 if (0) // Further checks on point2
6587 return(kQ3False);
6588
6589 if (0) // Further checks on point3
6590 return(kQ3False);
6591
6592 if (0) // Further checks on hitPoint
6593 return(kQ3False);
6594 #endif
6595
6596
6597
6598 // Call the bottleneck
6599 E3System_Bottleneck();
6600
6601
6602
6603 // Call our implementation
6604 return(E3Ray3D_IntersectTriangle(theRay, point1, point2, point3, cullBackfacing, hitPoint));
6605 }
6606
6607
6608
6609
6610
6611 //=============================================================================
6612 // Q3Math_SquareRoot : Quesa API entry point.
6613 //-----------------------------------------------------------------------------
6614 float
Q3Math_SquareRoot(float x)6615 Q3Math_SquareRoot(float x)
6616 {
6617
6618
6619 // Release build checks
6620 Q3_REQUIRE_OR_RESULT(x >= 0.0f, 0.0f);
6621
6622
6623
6624 // Debug build checks
6625 #if Q3_DEBUG
6626 if (0) // Further checks on x
6627 return(kQ3False);
6628 #endif
6629
6630
6631
6632 // Call the bottleneck
6633 E3System_Bottleneck();
6634
6635
6636
6637 // Call our implementation
6638 return(E3Math_SquareRoot(x));
6639 }
6640
6641
6642
6643
6644
6645 //=============================================================================
6646 // Q3Math_InvSquareRoot : Quesa API entry point.
6647 //-----------------------------------------------------------------------------
6648 float
Q3Math_InvSquareRoot(float x)6649 Q3Math_InvSquareRoot(float x)
6650 {
6651
6652
6653 // Release build checks
6654 Q3_REQUIRE_OR_RESULT(x >= 0.0f, 0.0f);
6655
6656
6657
6658 // Debug build checks
6659 #if Q3_DEBUG
6660 if (0) // Further checks on x
6661 return(kQ3False);
6662 #endif
6663
6664
6665
6666 // Call the bottleneck
6667 E3System_Bottleneck();
6668
6669
6670
6671 // Call our implementation
6672 return(E3Math_InvSquareRoot(x));
6673 }
6674
6675
6676