QD3DMath.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:40k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       QD3DMath.h
  3.  
  4.      Contains:   Math & matrix routines and definitions.
  5.  
  6.      Version:    Technology: Quickdraw 3D 1.6
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1995-2001 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QD3DMATH__
  18. #define __QD3DMATH__
  19. #ifndef __QD3D__
  20. #include "QD3D.h"
  21. #endif
  22. #include "float.h"
  23. #if PRAGMA_ONCE
  24. #pragma once
  25. #endif
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. #if PRAGMA_IMPORT
  30. #pragma import on
  31. #endif
  32. #if PRAGMA_STRUCT_ALIGN
  33.     #pragma options align=power
  34. #elif PRAGMA_STRUCT_PACKPUSH
  35.     #pragma pack(push, 2)
  36. #elif PRAGMA_STRUCT_PACK
  37.     #pragma pack(2)
  38. #endif
  39. #if PRAGMA_ENUM_ALWAYSINT
  40.     #if defined(__fourbyteints__) && !__fourbyteints__ 
  41.         #define __QD3DMATH__RESTORE_TWOBYTEINTS
  42.         #pragma fourbyteints on
  43.     #endif
  44.     #pragma enumsalwaysint on
  45. #elif PRAGMA_ENUM_OPTIONS
  46.     #pragma option enum=int
  47. #elif PRAGMA_ENUM_PACK
  48.     #if __option(pack_enums)
  49.         #define __QD3DMATH__RESTORE_PACKED_ENUMS
  50.         #pragma options(!pack_enums)
  51.     #endif
  52. #endif
  53. /******************************************************************************
  54.  **                                                                          **
  55.  **                         Constant Definitions                             **
  56.  **                                                                          **
  57.  *****************************************************************************/
  58. /*
  59.  *  Real zero definition
  60.  */
  61. #ifdef FLT_EPSILON
  62.     #define kQ3RealZero         (FLT_EPSILON)
  63. #else
  64.     #define kQ3RealZero         ((float)1.19209290e-07)
  65. #endif
  66. #ifdef FLT_MAX
  67.  #define kQ3MaxFloat         (FLT_MAX)
  68. #else
  69.     #define kQ3MaxFloat         ((float)3.40282347e+38)
  70. #endif
  71. /*
  72.  *  Values of PI
  73.  */
  74. #define kQ3Pi                   ((float)3.1415926535898)
  75. #define kQ32Pi                  ((float)(2.0 * 3.1415926535898))
  76. #define kQ3PiOver2              ((float)(3.1415926535898 / 2.0))
  77. #define kQ33PiOver2             ((float)(3.0 * 3.1415926535898 / 2.0))
  78. /******************************************************************************
  79.  **                                                                          **
  80.  **                         Miscellaneous Functions                          **
  81.  **                                                                          **
  82.  *****************************************************************************/
  83. #define Q3Math_DegreesToRadians(x)  ((float)((x) *  kQ3Pi / 180.0f))
  84. #define Q3Math_RadiansToDegrees(x)  ((float)((x) * 180.0f / kQ3Pi))
  85. #define Q3Math_Min(x,y)             ((x) <= (y) ? (x) : (y))
  86. #define Q3Math_Max(x,y)             ((x) >= (y) ? (x) : (y))
  87. /******************************************************************************
  88.  **                                                                          **
  89.  **                         Point and Vector Creation                        **
  90.  **                                                                          **
  91.  *****************************************************************************/
  92. #if CALL_NOT_IN_CARBON
  93. EXTERN_API_C( TQ3Point2D *)
  94. Q3Point2D_Set                   (TQ3Point2D *           point2D,
  95.                                  float                  x,
  96.                                  float                  y);
  97. EXTERN_API_C( TQ3Param2D *)
  98. Q3Param2D_Set                   (TQ3Param2D *           param2D,
  99.                                  float                  u,
  100.                                  float                  v);
  101. EXTERN_API_C( TQ3Point3D *)
  102. Q3Point3D_Set                   (TQ3Point3D *           point3D,
  103.                                  float                  x,
  104.                                  float                  y,
  105.                                  float                  z);
  106. EXTERN_API_C( TQ3RationalPoint3D *)
  107. Q3RationalPoint3D_Set           (TQ3RationalPoint3D *   point3D,
  108.                                  float                  x,
  109.                                  float                  y,
  110.                                  float                  w);
  111. EXTERN_API_C( TQ3RationalPoint4D *)
  112. Q3RationalPoint4D_Set           (TQ3RationalPoint4D *   point4D,
  113.                                  float                  x,
  114.                                  float                  y,
  115.                                  float                  z,
  116.                                  float                  w);
  117. EXTERN_API_C( TQ3Vector2D *)
  118. Q3Vector2D_Set                  (TQ3Vector2D *          vector2D,
  119.                                  float                  x,
  120.                                  float                  y);
  121. EXTERN_API_C( TQ3Vector3D *)
  122. Q3Vector3D_Set                  (TQ3Vector3D *          vector3D,
  123.                                  float                  x,
  124.                                  float                  y,
  125.                                  float                  z);
  126. EXTERN_API_C( TQ3PolarPoint *)
  127. Q3PolarPoint_Set                (TQ3PolarPoint *        polarPoint,
  128.                                  float                  r,
  129.                                  float                  theta);
  130. EXTERN_API_C( TQ3SphericalPoint *)
  131. Q3SphericalPoint_Set            (TQ3SphericalPoint *    sphericalPoint,
  132.                                  float                  rho,
  133.                                  float                  theta,
  134.                                  float                  phi);
  135. /******************************************************************************
  136.  **                                                                          **
  137.  **                 Point and Vector Dimension Conversion                    **
  138.  **                                                                          **
  139.  *****************************************************************************/
  140. EXTERN_API_C( TQ3Point3D *)
  141. Q3Point2D_To3D                  (const TQ3Point2D *     point2D,
  142.                                  TQ3Point3D *           result);
  143. EXTERN_API_C( TQ3Point2D *)
  144. Q3RationalPoint3D_To2D          (const TQ3RationalPoint3D * point3D,
  145.                                  TQ3Point2D *           result);
  146. EXTERN_API_C( TQ3RationalPoint4D *)
  147. Q3Point3D_To4D                  (const TQ3Point3D *     point3D,
  148.                                  TQ3RationalPoint4D *   result);
  149. EXTERN_API_C( TQ3Point3D *)
  150. Q3RationalPoint4D_To3D          (const TQ3RationalPoint4D * point4D,
  151.                                  TQ3Point3D *           result);
  152. EXTERN_API_C( TQ3Vector3D *)
  153. Q3Vector2D_To3D                 (const TQ3Vector2D *    vector2D,
  154.                                  TQ3Vector3D *          result);
  155. EXTERN_API_C( TQ3Vector2D *)
  156. Q3Vector3D_To2D                 (const TQ3Vector3D *    vector3D,
  157.                                  TQ3Vector2D *          result);
  158. /******************************************************************************
  159.  **                                                                          **
  160.  **                         Point Subtraction                                **
  161.  **                                                                          **
  162.  *****************************************************************************/
  163. EXTERN_API_C( TQ3Vector2D *)
  164. Q3Point2D_Subtract              (const TQ3Point2D *     p1,
  165.                                  const TQ3Point2D *     p2,
  166.                                  TQ3Vector2D *          result);
  167. EXTERN_API_C( TQ3Vector2D *)
  168. Q3Param2D_Subtract              (const TQ3Param2D *     p1,
  169.                                  const TQ3Param2D *     p2,
  170.                                  TQ3Vector2D *          result);
  171. EXTERN_API_C( TQ3Vector3D *)
  172. Q3Point3D_Subtract              (const TQ3Point3D *     p1,
  173.                                  const TQ3Point3D *     p2,
  174.                                  TQ3Vector3D *          result);
  175. /******************************************************************************
  176.  **                                                                          **
  177.  **                         Point Distance                                   **
  178.  **                                                                          **
  179.  *****************************************************************************/
  180. EXTERN_API_C( float )
  181. Q3Point2D_Distance              (const TQ3Point2D *     p1,
  182.                                  const TQ3Point2D *     p2);
  183. EXTERN_API_C( float )
  184. Q3Point2D_DistanceSquared       (const TQ3Point2D *     p1,
  185.                                  const TQ3Point2D *     p2);
  186. EXTERN_API_C( float )
  187. Q3Param2D_Distance              (const TQ3Param2D *     p1,
  188.                                  const TQ3Param2D *     p2);
  189. EXTERN_API_C( float )
  190. Q3Param2D_DistanceSquared       (const TQ3Param2D *     p1,
  191.                                  const TQ3Param2D *     p2);
  192. EXTERN_API_C( float )
  193. Q3RationalPoint3D_Distance      (const TQ3RationalPoint3D * p1,
  194.                                  const TQ3RationalPoint3D * p2);
  195. EXTERN_API_C( float )
  196. Q3RationalPoint3D_DistanceSquared (const TQ3RationalPoint3D * p1,
  197.                                  const TQ3RationalPoint3D * p2);
  198. EXTERN_API_C( float )
  199. Q3Point3D_Distance              (const TQ3Point3D *     p1,
  200.                                  const TQ3Point3D *     p2);
  201. EXTERN_API_C( float )
  202. Q3Point3D_DistanceSquared       (const TQ3Point3D *     p1,
  203.                                  const TQ3Point3D *     p2);
  204. EXTERN_API_C( float )
  205. Q3RationalPoint4D_Distance      (const TQ3RationalPoint4D * p1,
  206.                                  const TQ3RationalPoint4D * p2);
  207. EXTERN_API_C( float )
  208. Q3RationalPoint4D_DistanceSquared (const TQ3RationalPoint4D * p1,
  209.                                  const TQ3RationalPoint4D * p2);
  210. /******************************************************************************
  211.  **                                                                          **
  212.  **                         Point Relative Ratio                             **
  213.  **                                                                          **
  214.  *****************************************************************************/
  215. EXTERN_API_C( TQ3Point2D *)
  216. Q3Point2D_RRatio                (const TQ3Point2D *     p1,
  217.                                  const TQ3Point2D *     p2,
  218.                                  float                  r1,
  219.                                  float                  r2,
  220.                                  TQ3Point2D *           result);
  221. EXTERN_API_C( TQ3Param2D *)
  222. Q3Param2D_RRatio                (const TQ3Param2D *     p1,
  223.                                  const TQ3Param2D *     p2,
  224.                                  float                  r1,
  225.                                  float                  r2,
  226.                                  TQ3Param2D *           result);
  227. EXTERN_API_C( TQ3Point3D *)
  228. Q3Point3D_RRatio                (const TQ3Point3D *     p1,
  229.                                  const TQ3Point3D *     p2,
  230.                                  float                  r1,
  231.                                  float                  r2,
  232.                                  TQ3Point3D *           result);
  233. EXTERN_API_C( TQ3RationalPoint4D *)
  234. Q3RationalPoint4D_RRatio        (const TQ3RationalPoint4D * p1,
  235.                                  const TQ3RationalPoint4D * p2,
  236.                                  float                  r1,
  237.                                  float                  r2,
  238.                                  TQ3RationalPoint4D *   result);
  239. /******************************************************************************
  240.  **                                                                          **
  241.  **                 Point / Vector Addition & Subtraction                    **
  242.  **                                                                          **
  243.  *****************************************************************************/
  244. EXTERN_API_C( TQ3Point2D *)
  245. Q3Point2D_Vector2D_Add          (const TQ3Point2D *     point2D,
  246.                                  const TQ3Vector2D *    vector2D,
  247.                                  TQ3Point2D *           result);
  248. EXTERN_API_C( TQ3Param2D *)
  249. Q3Param2D_Vector2D_Add          (const TQ3Param2D *     param2D,
  250.                                  const TQ3Vector2D *    vector2D,
  251.                                  TQ3Param2D *           result);
  252. EXTERN_API_C( TQ3Point3D *)
  253. Q3Point3D_Vector3D_Add          (const TQ3Point3D *     point3D,
  254.                                  const TQ3Vector3D *    vector3D,
  255.                                  TQ3Point3D *           result);
  256. EXTERN_API_C( TQ3Point2D *)
  257. Q3Point2D_Vector2D_Subtract     (const TQ3Point2D *     point2D,
  258.                                  const TQ3Vector2D *    vector2D,
  259.                                  TQ3Point2D *           result);
  260. EXTERN_API_C( TQ3Param2D *)
  261. Q3Param2D_Vector2D_Subtract     (const TQ3Param2D *     param2D,
  262.                                  const TQ3Vector2D *    vector2D,
  263.                                  TQ3Param2D *           result);
  264. EXTERN_API_C( TQ3Point3D *)
  265. Q3Point3D_Vector3D_Subtract     (const TQ3Point3D *     point3D,
  266.                                  const TQ3Vector3D *    vector3D,
  267.                                  TQ3Point3D *           result);
  268. /******************************************************************************
  269.  **                                                                          **
  270.  **                             Vector Scale                                 **
  271.  **                                                                          **
  272.  *****************************************************************************/
  273. EXTERN_API_C( TQ3Vector2D *)
  274. Q3Vector2D_Scale                (const TQ3Vector2D *    vector2D,
  275.                                  float                  scalar,
  276.                                  TQ3Vector2D *          result);
  277. EXTERN_API_C( TQ3Vector3D *)
  278. Q3Vector3D_Scale                (const TQ3Vector3D *    vector3D,
  279.                                  float                  scalar,
  280.                                  TQ3Vector3D *          result);
  281. /******************************************************************************
  282.  **                                                                          **
  283.  **                             Vector Length                                **
  284.  **                                                                          **
  285.  *****************************************************************************/
  286. EXTERN_API_C( float )
  287. Q3Vector2D_Length               (const TQ3Vector2D *    vector2D);
  288. EXTERN_API_C( float )
  289. Q3Vector3D_Length               (const TQ3Vector3D *    vector3D);
  290. /******************************************************************************
  291.  **                                                                          **
  292.  **                             Vector Normalize                             **
  293.  **                                                                          **
  294.  *****************************************************************************/
  295. EXTERN_API_C( TQ3Vector2D *)
  296. Q3Vector2D_Normalize            (const TQ3Vector2D *    vector2D,
  297.                                  TQ3Vector2D *          result);
  298. EXTERN_API_C( TQ3Vector3D *)
  299. Q3Vector3D_Normalize            (const TQ3Vector3D *    vector3D,
  300.                                  TQ3Vector3D *          result);
  301. /******************************************************************************
  302.  **                                                                          **
  303.  **                 Vector/Vector Addition and Subtraction                   **
  304.  **                                                                          **
  305.  *****************************************************************************/
  306. EXTERN_API_C( TQ3Vector2D *)
  307. Q3Vector2D_Add                  (const TQ3Vector2D *    v1,
  308.                                  const TQ3Vector2D *    v2,
  309.                                  TQ3Vector2D *          result);
  310. EXTERN_API_C( TQ3Vector3D *)
  311. Q3Vector3D_Add                  (const TQ3Vector3D *    v1,
  312.                                  const TQ3Vector3D *    v2,
  313.                                  TQ3Vector3D *          result);
  314. EXTERN_API_C( TQ3Vector2D *)
  315. Q3Vector2D_Subtract             (const TQ3Vector2D *    v1,
  316.                                  const TQ3Vector2D *    v2,
  317.                                  TQ3Vector2D *          result);
  318. EXTERN_API_C( TQ3Vector3D *)
  319. Q3Vector3D_Subtract             (const TQ3Vector3D *    v1,
  320.                                  const TQ3Vector3D *    v2,
  321.                                  TQ3Vector3D *          result);
  322. /******************************************************************************
  323.  **                                                                          **
  324.  **                             Cross Product                                **
  325.  **                                                                          **
  326.  *****************************************************************************/
  327. EXTERN_API_C( float )
  328. Q3Vector2D_Cross                (const TQ3Vector2D *    v1,
  329.                                  const TQ3Vector2D *    v2);
  330. EXTERN_API_C( TQ3Vector3D *)
  331. Q3Vector3D_Cross                (const TQ3Vector3D *    v1,
  332.                                  const TQ3Vector3D *    v2,
  333.                                  TQ3Vector3D *          result);
  334. EXTERN_API_C( TQ3Vector3D *)
  335. Q3Point3D_CrossProductTri       (const TQ3Point3D *     point1,
  336.                                  const TQ3Point3D *     point2,
  337.                                  const TQ3Point3D *     point3,
  338.                                  TQ3Vector3D *          crossVector);
  339. /******************************************************************************
  340.  **                                                                          **
  341.  **                             Dot Product                                  **
  342.  **                                                                          **
  343.  *****************************************************************************/
  344. EXTERN_API_C( float )
  345. Q3Vector2D_Dot                  (const TQ3Vector2D *    v1,
  346.                                  const TQ3Vector2D *    v2);
  347. EXTERN_API_C( float )
  348. Q3Vector3D_Dot                  (const TQ3Vector3D *    v1,
  349.                                  const TQ3Vector3D *    v2);
  350. /******************************************************************************
  351.  **                                                                          **
  352.  **                     Point and Vector Transformation                      **
  353.  **                                                                          **
  354.  *****************************************************************************/
  355. EXTERN_API_C( TQ3Vector2D *)
  356. Q3Vector2D_Transform            (const TQ3Vector2D *    vector2D,
  357.                                  const TQ3Matrix3x3 *   matrix3x3,
  358.                                  TQ3Vector2D *          result);
  359. EXTERN_API_C( TQ3Vector3D *)
  360. Q3Vector3D_Transform            (const TQ3Vector3D *    vector3D,
  361.                                  const TQ3Matrix4x4 *   matrix4x4,
  362.                                  TQ3Vector3D *          result);
  363. EXTERN_API_C( TQ3Point2D *)
  364. Q3Point2D_Transform             (const TQ3Point2D *     point2D,
  365.                                  const TQ3Matrix3x3 *   matrix3x3,
  366.                                  TQ3Point2D *           result);
  367. EXTERN_API_C( TQ3Param2D *)
  368. Q3Param2D_Transform             (const TQ3Param2D *     param2D,
  369.                                  const TQ3Matrix3x3 *   matrix3x3,
  370.                                  TQ3Param2D *           result);
  371. EXTERN_API_C( TQ3Point3D *)
  372. Q3Point3D_Transform             (const TQ3Point3D *     point3D,
  373.                                  const TQ3Matrix4x4 *   matrix4x4,
  374.                                  TQ3Point3D *           result);
  375. EXTERN_API_C( TQ3RationalPoint4D *)
  376. Q3RationalPoint4D_Transform     (const TQ3RationalPoint4D * point4D,
  377.                                  const TQ3Matrix4x4 *   matrix4x4,
  378.                                  TQ3RationalPoint4D *   result);
  379. EXTERN_API_C( TQ3Status )
  380. Q3Point3D_To3DTransformArray    (const TQ3Point3D *     inPoint3D,
  381.                                  const TQ3Matrix4x4 *   matrix,
  382.                                  TQ3Point3D *           outPoint3D,
  383.                                  long                   numPoints,
  384.                                  unsigned long          inStructSize,
  385.                                  unsigned long          outStructSize);
  386. EXTERN_API_C( TQ3Status )
  387. Q3Point3D_To4DTransformArray    (const TQ3Point3D *     inPoint3D,
  388.                                  const TQ3Matrix4x4 *   matrix,
  389.                                  TQ3RationalPoint4D *   outPoint4D,
  390.                                  long                   numPoints,
  391.                                  unsigned long          inStructSize,
  392.                                  unsigned long          outStructSize);
  393. EXTERN_API_C( TQ3Status )
  394. Q3RationalPoint4D_To4DTransformArray (const TQ3RationalPoint4D * inPoint4D,
  395.                                  const TQ3Matrix4x4 *   matrix,
  396.                                  TQ3RationalPoint4D *   outPoint4D,
  397.                                  long                   numPoints,
  398.                                  unsigned long          inStructSize,
  399.                                  unsigned long          outStructSize);
  400. /******************************************************************************
  401.  **                                                                          **
  402.  **                             Vector Negation                              **
  403.  **                                                                          **
  404.  *****************************************************************************/
  405. EXTERN_API_C( TQ3Vector2D *)
  406. Q3Vector2D_Negate               (const TQ3Vector2D *    vector2D,
  407.                                  TQ3Vector2D *          result);
  408. EXTERN_API_C( TQ3Vector3D *)
  409. Q3Vector3D_Negate               (const TQ3Vector3D *    vector3D,
  410.                                  TQ3Vector3D *          result);
  411. /******************************************************************************
  412.  **                                                                          **
  413.  **                 Point conversion from cartesian to polar                 **
  414.  **                                                                          **
  415.  *****************************************************************************/
  416. EXTERN_API_C( TQ3PolarPoint *)
  417. Q3Point2D_ToPolar               (const TQ3Point2D *     point2D,
  418.                                  TQ3PolarPoint *        result);
  419. EXTERN_API_C( TQ3Point2D *)
  420. Q3PolarPoint_ToPoint2D          (const TQ3PolarPoint *  polarPoint,
  421.                                  TQ3Point2D *           result);
  422. EXTERN_API_C( TQ3SphericalPoint *)
  423. Q3Point3D_ToSpherical           (const TQ3Point3D *     point3D,
  424.                                  TQ3SphericalPoint *    result);
  425. EXTERN_API_C( TQ3Point3D *)
  426. Q3SphericalPoint_ToPoint3D      (const TQ3SphericalPoint * sphericalPoint,
  427.                                  TQ3Point3D *           result);
  428. /******************************************************************************
  429.  **                                                                          **
  430.  **                         Point Affine Combinations                        **
  431.  **                                                                          **
  432.  *****************************************************************************/
  433. EXTERN_API_C( TQ3Point2D *)
  434. Q3Point2D_AffineComb            (const TQ3Point2D *     points2D,
  435.                                  const float *          weights,
  436.                                  unsigned long          nPoints,
  437.                                  TQ3Point2D *           result);
  438. EXTERN_API_C( TQ3Param2D *)
  439. Q3Param2D_AffineComb            (const TQ3Param2D *     params2D,
  440.                                  const float *          weights,
  441.                                  unsigned long          nPoints,
  442.                                  TQ3Param2D *           result);
  443. EXTERN_API_C( TQ3RationalPoint3D *)
  444. Q3RationalPoint3D_AffineComb    (const TQ3RationalPoint3D * points3D,
  445.                                  const float *          weights,
  446.                                  unsigned long          numPoints,
  447.                                  TQ3RationalPoint3D *   result);
  448. EXTERN_API_C( TQ3Point3D *)
  449. Q3Point3D_AffineComb            (const TQ3Point3D *     points3D,
  450.                                  const float *          weights,
  451.                                  unsigned long          numPoints,
  452.                                  TQ3Point3D *           result);
  453. EXTERN_API_C( TQ3RationalPoint4D *)
  454. Q3RationalPoint4D_AffineComb    (const TQ3RationalPoint4D * points4D,
  455.                                  const float *          weights,
  456.                                  unsigned long          numPoints,
  457.                                  TQ3RationalPoint4D *   result);
  458. /******************************************************************************
  459.  **                                                                          **
  460.  **                             Matrix Functions                             **
  461.  **                                                                          **
  462.  *****************************************************************************/
  463. EXTERN_API_C( TQ3Matrix3x3 *)
  464. Q3Matrix3x3_Copy                (const TQ3Matrix3x3 *   matrix3x3,
  465.                                  TQ3Matrix3x3 *         result);
  466. EXTERN_API_C( TQ3Matrix4x4 *)
  467. Q3Matrix4x4_Copy                (const TQ3Matrix4x4 *   matrix4x4,
  468.                                  TQ3Matrix4x4 *         result);
  469. EXTERN_API_C( TQ3Matrix3x3 *)
  470. Q3Matrix3x3_SetIdentity         (TQ3Matrix3x3 *         matrix3x3);
  471. EXTERN_API_C( TQ3Matrix4x4 *)
  472. Q3Matrix4x4_SetIdentity         (TQ3Matrix4x4 *         matrix4x4);
  473. EXTERN_API_C( TQ3Matrix3x3 *)
  474. Q3Matrix3x3_Transpose           (const TQ3Matrix3x3 *   matrix3x3,
  475.                                  TQ3Matrix3x3 *         result);
  476. EXTERN_API_C( TQ3Matrix4x4 *)
  477. Q3Matrix4x4_Transpose           (const TQ3Matrix4x4 *   matrix4x4,
  478.                                  TQ3Matrix4x4 *         result);
  479. EXTERN_API_C( TQ3Matrix3x3 *)
  480. Q3Matrix3x3_Invert              (const TQ3Matrix3x3 *   matrix3x3,
  481.                                  TQ3Matrix3x3 *         result);
  482. EXTERN_API_C( TQ3Matrix4x4 *)
  483. Q3Matrix4x4_Invert              (const TQ3Matrix4x4 *   matrix4x4,
  484.                                  TQ3Matrix4x4 *         result);
  485. EXTERN_API_C( TQ3Matrix3x3 *)
  486. Q3Matrix3x3_Adjoint             (const TQ3Matrix3x3 *   matrix3x3,
  487.                                  TQ3Matrix3x3 *         result);
  488. EXTERN_API_C( TQ3Matrix3x3 *)
  489. Q3Matrix3x3_Multiply            (const TQ3Matrix3x3 *   matrixA,
  490.                                  const TQ3Matrix3x3 *   matrixB,
  491.                                  TQ3Matrix3x3 *         result);
  492. EXTERN_API_C( TQ3Matrix4x4 *)
  493. Q3Matrix4x4_Multiply            (const TQ3Matrix4x4 *   matrixA,
  494.                                  const TQ3Matrix4x4 *   matrixB,
  495.                                  TQ3Matrix4x4 *         result);
  496. EXTERN_API_C( TQ3Matrix3x3 *)
  497. Q3Matrix3x3_SetTranslate        (TQ3Matrix3x3 *         matrix3x3,
  498.                                  float                  xTrans,
  499.                                  float                  yTrans);
  500. EXTERN_API_C( TQ3Matrix3x3 *)
  501. Q3Matrix3x3_SetScale            (TQ3Matrix3x3 *         matrix3x3,
  502.                                  float                  xScale,
  503.                                  float                  yScale);
  504. EXTERN_API_C( TQ3Matrix3x3 *)
  505. Q3Matrix3x3_SetRotateAboutPoint (TQ3Matrix3x3 *         matrix3x3,
  506.                                  const TQ3Point2D *     origin,
  507.                                  float                  angle);
  508. EXTERN_API_C( TQ3Matrix4x4 *)
  509. Q3Matrix4x4_SetTranslate        (TQ3Matrix4x4 *         matrix4x4,
  510.                                  float                  xTrans,
  511.                                  float                  yTrans,
  512.                                  float                  zTrans);
  513. EXTERN_API_C( TQ3Matrix4x4 *)
  514. Q3Matrix4x4_SetScale            (TQ3Matrix4x4 *         matrix4x4,
  515.                                  float                  xScale,
  516.                                  float                  yScale,
  517.                                  float                  zScale);
  518. EXTERN_API_C( TQ3Matrix4x4 *)
  519. Q3Matrix4x4_SetRotateAboutPoint (TQ3Matrix4x4 *         matrix4x4,
  520.                                  const TQ3Point3D *     origin,
  521.                                  float                  xAngle,
  522.                                  float                  yAngle,
  523.                                  float                  zAngle);
  524. EXTERN_API_C( TQ3Matrix4x4 *)
  525. Q3Matrix4x4_SetRotateAboutAxis  (TQ3Matrix4x4 *         matrix4x4,
  526.                                  const TQ3Point3D *     origin,
  527.                                  const TQ3Vector3D *    orientation,
  528.                                  float                  angle);
  529. EXTERN_API_C( TQ3Matrix4x4 *)
  530. Q3Matrix4x4_SetRotate_X         (TQ3Matrix4x4 *         matrix4x4,
  531.                                  float                  angle);
  532. EXTERN_API_C( TQ3Matrix4x4 *)
  533. Q3Matrix4x4_SetRotate_Y         (TQ3Matrix4x4 *         matrix4x4,
  534.                                  float                  angle);
  535. EXTERN_API_C( TQ3Matrix4x4 *)
  536. Q3Matrix4x4_SetRotate_Z         (TQ3Matrix4x4 *         matrix4x4,
  537.                                  float                  angle);
  538. EXTERN_API_C( TQ3Matrix4x4 *)
  539. Q3Matrix4x4_SetRotate_XYZ       (TQ3Matrix4x4 *         matrix4x4,
  540.                                  float                  xAngle,
  541.                                  float                  yAngle,
  542.                                  float                  zAngle);
  543. EXTERN_API_C( TQ3Matrix4x4 *)
  544. Q3Matrix4x4_SetRotateVectorToVector (TQ3Matrix4x4 *     matrix4x4,
  545.                                  const TQ3Vector3D *    v1,
  546.                                  const TQ3Vector3D *    v2);
  547. EXTERN_API_C( TQ3Matrix4x4 *)
  548. Q3Matrix4x4_SetQuaternion       (TQ3Matrix4x4 *         matrix,
  549.                                  const TQ3Quaternion *  quaternion);
  550. EXTERN_API_C( float )
  551. Q3Matrix3x3_Determinant         (const TQ3Matrix3x3 *   matrix3x3);
  552. EXTERN_API_C( float )
  553. Q3Matrix4x4_Determinant         (const TQ3Matrix4x4 *   matrix4x4);
  554. /******************************************************************************
  555.  **                                                                          **
  556.  **                             Quaternion Routines                          **
  557.  **                                                                          **
  558.  *****************************************************************************/
  559. EXTERN_API_C( TQ3Quaternion *)
  560. Q3Quaternion_Set                (TQ3Quaternion *        quaternion,
  561.                                  float                  w,
  562.                                  float                  x,
  563.                                  float                  y,
  564.                                  float                  z);
  565. EXTERN_API_C( TQ3Quaternion *)
  566. Q3Quaternion_SetIdentity        (TQ3Quaternion *        quaternion);
  567. EXTERN_API_C( TQ3Quaternion *)
  568. Q3Quaternion_Copy               (const TQ3Quaternion *  quaternion,
  569.                                  TQ3Quaternion *        result);
  570. EXTERN_API_C( TQ3Boolean )
  571. Q3Quaternion_IsIdentity         (const TQ3Quaternion *  quaternion);
  572. EXTERN_API_C( TQ3Quaternion *)
  573. Q3Quaternion_Invert             (const TQ3Quaternion *  quaternion,
  574.                                  TQ3Quaternion *        result);
  575. EXTERN_API_C( TQ3Quaternion *)
  576. Q3Quaternion_Normalize          (const TQ3Quaternion *  quaternion,
  577.                                  TQ3Quaternion *        result);
  578. EXTERN_API_C( float )
  579. Q3Quaternion_Dot                (const TQ3Quaternion *  q1,
  580.                                  const TQ3Quaternion *  q2);
  581. EXTERN_API_C( TQ3Quaternion *)
  582. Q3Quaternion_Multiply           (const TQ3Quaternion *  q1,
  583.                                  const TQ3Quaternion *  q2,
  584.                                  TQ3Quaternion *        result);
  585. EXTERN_API_C( TQ3Quaternion *)
  586. Q3Quaternion_SetRotateAboutAxis (TQ3Quaternion *        quaternion,
  587.                                  const TQ3Vector3D *    axis,
  588.                                  float                  angle);
  589. EXTERN_API_C( TQ3Quaternion *)
  590. Q3Quaternion_SetRotate_XYZ      (TQ3Quaternion *        quaternion,
  591.                                  float                  xAngle,
  592.                                  float                  yAngle,
  593.                                  float                  zAngle);
  594. EXTERN_API_C( TQ3Quaternion *)
  595. Q3Quaternion_SetRotate_X        (TQ3Quaternion *        quaternion,
  596.                                  float                  angle);
  597. EXTERN_API_C( TQ3Quaternion *)
  598. Q3Quaternion_SetRotate_Y        (TQ3Quaternion *        quaternion,
  599.                                  float                  angle);
  600. EXTERN_API_C( TQ3Quaternion *)
  601. Q3Quaternion_SetRotate_Z        (TQ3Quaternion *        quaternion,
  602.                                  float                  angle);
  603. EXTERN_API_C( TQ3Quaternion *)
  604. Q3Quaternion_SetMatrix          (TQ3Quaternion *        quaternion,
  605.                                  const TQ3Matrix4x4 *   matrix);
  606. EXTERN_API_C( TQ3Quaternion *)
  607. Q3Quaternion_SetRotateVectorToVector (TQ3Quaternion *   quaternion,
  608.                                  const TQ3Vector3D *    v1,
  609.                                  const TQ3Vector3D *    v2);
  610. EXTERN_API_C( TQ3Quaternion *)
  611. Q3Quaternion_MatchReflection    (const TQ3Quaternion *  q1,
  612.                                  const TQ3Quaternion *  q2,
  613.                                  TQ3Quaternion *        result);
  614. EXTERN_API_C( TQ3Quaternion *)
  615. Q3Quaternion_InterpolateFast    (const TQ3Quaternion *  q1,
  616.                                  const TQ3Quaternion *  q2,
  617.                                  float                  t,
  618.                                  TQ3Quaternion *        result);
  619. EXTERN_API_C( TQ3Quaternion *)
  620. Q3Quaternion_InterpolateLinear  (const TQ3Quaternion *  q1,
  621.                                  const TQ3Quaternion *  q2,
  622.                                  float                  t,
  623.                                  TQ3Quaternion *        result);
  624. EXTERN_API_C( TQ3Vector3D *)
  625. Q3Vector3D_TransformQuaternion  (const TQ3Vector3D *    vector3D,
  626.                                  const TQ3Quaternion *  quaternion,
  627.                                  TQ3Vector3D *          result);
  628. EXTERN_API_C( TQ3Point3D *)
  629. Q3Point3D_TransformQuaternion   (const TQ3Point3D *     point3D,
  630.                                  const TQ3Quaternion *  quaternion,
  631.                                  TQ3Point3D *           result);
  632. /******************************************************************************
  633.  **                                                                          **
  634.  **                             Volume Routines                              **
  635.  **                                                                          **
  636.  *****************************************************************************/
  637. EXTERN_API_C( TQ3BoundingBox *)
  638. Q3BoundingBox_Copy              (const TQ3BoundingBox * src,
  639.                                  TQ3BoundingBox *       dest);
  640. EXTERN_API_C( TQ3BoundingBox *)
  641. Q3BoundingBox_Union             (const TQ3BoundingBox * v1,
  642.                                  const TQ3BoundingBox * v2,
  643.                                  TQ3BoundingBox *       result);
  644. EXTERN_API_C( TQ3BoundingBox *)
  645. Q3BoundingBox_Set               (TQ3BoundingBox *       bBox,
  646.                                  const TQ3Point3D *     min,
  647.                                  const TQ3Point3D *     max,
  648.                                  TQ3Boolean             isEmpty);
  649. EXTERN_API_C( TQ3BoundingBox *)
  650. Q3BoundingBox_UnionPoint3D      (const TQ3BoundingBox * bBox,
  651.                                  const TQ3Point3D *     point3D,
  652.                                  TQ3BoundingBox *       result);
  653. EXTERN_API_C( TQ3BoundingBox *)
  654. Q3BoundingBox_UnionRationalPoint4D (const TQ3BoundingBox * bBox,
  655.                                  const TQ3RationalPoint4D * point4D,
  656.                                  TQ3BoundingBox *       result);
  657. EXTERN_API_C( TQ3BoundingBox *)
  658. Q3BoundingBox_SetFromPoints3D   (TQ3BoundingBox *       bBox,
  659.                                  const TQ3Point3D *     points3D,
  660.                                  unsigned long          numPoints,
  661.                                  unsigned long          structSize);
  662. EXTERN_API_C( TQ3BoundingBox *)
  663. Q3BoundingBox_SetFromRationalPoints4D (TQ3BoundingBox * bBox,
  664.                                  const TQ3RationalPoint4D * points4D,
  665.                                  unsigned long          numPoints,
  666.                                  unsigned long          structSize);
  667. /******************************************************************************
  668.  **                                                                          **
  669.  **                             Sphere Routines                              **
  670.  **                                                                          **
  671.  *****************************************************************************/
  672. EXTERN_API_C( TQ3BoundingSphere *)
  673. Q3BoundingSphere_Copy           (const TQ3BoundingSphere * src,
  674.                                  TQ3BoundingSphere *    dest);
  675. EXTERN_API_C( TQ3BoundingSphere *)
  676. Q3BoundingSphere_Union          (const TQ3BoundingSphere * s1,
  677.                                  const TQ3BoundingSphere * s2,
  678.                                  TQ3BoundingSphere *    result);
  679. EXTERN_API_C( TQ3BoundingSphere *)
  680. Q3BoundingSphere_Set            (TQ3BoundingSphere *    bSphere,
  681.                                  const TQ3Point3D *     origin,
  682.                                  float                  radius,
  683.                                  TQ3Boolean             isEmpty);
  684. EXTERN_API_C( TQ3BoundingSphere *)
  685. Q3BoundingSphere_UnionPoint3D   (const TQ3BoundingSphere * bSphere,
  686.                                  const TQ3Point3D *     point3D,
  687.                                  TQ3BoundingSphere *    result);
  688. EXTERN_API_C( TQ3BoundingSphere *)
  689. Q3BoundingSphere_UnionRationalPoint4D (const TQ3BoundingSphere * bSphere,
  690.                                  const TQ3RationalPoint4D * point4D,
  691.                                  TQ3BoundingSphere *    result);
  692. EXTERN_API_C( TQ3BoundingSphere *)
  693. Q3BoundingSphere_SetFromPoints3D (TQ3BoundingSphere *   bSphere,
  694.                                  const TQ3Point3D *     points3D,
  695.                                  unsigned long          numPoints,
  696.                                  unsigned long          structSize);
  697. EXTERN_API_C( TQ3BoundingSphere *)
  698. Q3BoundingSphere_SetFromRationalPoints4D (TQ3BoundingSphere * bSphere,
  699.                                  const TQ3RationalPoint4D * points4D,
  700.                                  unsigned long          numPoints,
  701.                                  unsigned long          structSize);
  702. #endif  /* CALL_NOT_IN_CARBON */
  703. #if PRAGMA_ENUM_ALWAYSINT
  704.     #pragma enumsalwaysint reset
  705.     #ifdef __QD3DMATH__RESTORE_TWOBYTEINTS
  706.         #pragma fourbyteints off
  707.     #endif
  708. #elif PRAGMA_ENUM_OPTIONS
  709.     #pragma option enum=reset
  710. #elif defined(__QD3DMATH__RESTORE_PACKED_ENUMS)
  711.     #pragma options(pack_enums)
  712. #endif
  713. #if PRAGMA_STRUCT_ALIGN
  714.     #pragma options align=reset
  715. #elif PRAGMA_STRUCT_PACKPUSH
  716.     #pragma pack(pop)
  717. #elif PRAGMA_STRUCT_PACK
  718.     #pragma pack()
  719. #endif
  720. #ifdef PRAGMA_IMPORT_OFF
  721. #pragma import off
  722. #elif PRAGMA_IMPORT
  723. #pragma import reset
  724. #endif
  725. #ifdef __cplusplus
  726. }
  727. #endif
  728. #endif /* __QD3DMATH__ */