Defines | |
| #define | IW_ANGLE_2PI ((iwangle)IW_GEOM_ONE) |
| #define | IW_ANGLE_FROM_DEGREES(x) ((iwangle)(((x) * IW_ANGLE_2PI) / 360.0)) |
| #define | IW_ANGLE_FROM_RADIANS(x) ((iwangle)(((x) * IW_ANGLE_2PI) / (2 * PI))) |
| #define | IW_ANGLE_MASK_PHASE(x) ((iwangle)((x) & (IW_ANGLE_2PI - 1))) |
| #define | IW_ANGLE_PI ((iwangle)IW_GEOM_HALF) |
| #define | IW_ANGLE_Q2PI ((iwangle)IW_GEOM_QONE) |
| #define | IW_ANGLE_TO_DEGREES(x) ((int32)(((x) * 360 + (IW_ANGLE_2PI>>1)) / IW_ANGLE_2PI)) |
| #define | IW_ANGLE_TO_RADIANS(x) ((float)(((x) * PI) / IW_ANGLE_PI)) |
| #define | IW_FIXED(x) ((iwfixed)((x) * IW_GEOM_ONE)) |
| #define | IW_FIXED_FROM_FLOAT_SHIFTED(a, s) ((iwfixed)((a) * (float)(1 << (s)))) |
| #define | IW_FIXED_TO_FLOAT(a) ((float)(a) / (float)IW_GEOM_ONE) |
| #define | IW_GEOM_ACOS IwGeomACos |
| #define | IW_GEOM_ASIN IwGeomASin |
| #define | IW_GEOM_ATAN2 IwGeomAtan2 |
| #define | IW_GEOM_COS IwGeomCos |
| #define | IW_GEOM_HALF (1 << (IW_GEOM_POINT - 1)) |
| #define | IW_GEOM_ONE (1 << IW_GEOM_POINT) |
| #define | IW_GEOM_ONE2 (1 << (IW_GEOM_POINT << 1)) |
| #define | IW_GEOM_POINT 12 |
| #define | IW_GEOM_QACOS IwGeomQACos |
| #define | IW_GEOM_QASIN IwGeomQASin |
| #define | IW_GEOM_QATAN2 IwGeomQATan2 |
| #define | IW_GEOM_QCOS IwGeomQCos |
| #define | IW_GEOM_QEPSILON 0x200000 |
| #define | IW_GEOM_QHALF (1 << (IW_GEOM_QPOINT - 1)) |
| #define | IW_GEOM_QONE (1 << IW_GEOM_QPOINT) |
| #define | IW_GEOM_QONE2 ((int64)1 << (IW_GEOM_QPOINT << 1)) |
| #define | IW_GEOM_QPOINT 30 |
| #define | IW_GEOM_QPOINT_TO_GEOM_POINT (IW_GEOM_QPOINT - IW_GEOM_POINT) |
| #define | IW_GEOM_QSIN IwGeomQSin |
| #define | IW_GEOM_ROUND(a) (((a) + IW_GEOM_HALF) >> IW_GEOM_POINT) |
| #define | IW_GEOM_SIN IwGeomSin |
| #define | IW_GEOM_TAN IwGeomTan |
| #define | IW_QFIXED(x) ((iwqfixed)((x) * IW_GEOM_QONE)) |
| #define | IW_SFIXED(x) ((iwsfixed)((x) * IW_GEOM_ONE)) |
| #define | IW_SFIXED_FROM_FLOAT(a) IW_SFIXED_FROM_FIXED(IW_FIXED_FROM_FLOAT(a)) |
| #define | IW_UFIXED(x) ((iwufixed)((x) * IW_GEOM_ONE)) |
| #define | IW_USFIXED(x) ((iwusfixed)((x) * IW_GEOM_ONE)) |
| #define | PI 3.141592653589793f |
Typedefs | |
| typedef int32 | iwangle |
| typedef int32 | iwfixed |
| typedef int32 | iwqangle |
| typedef int32 | iwqfixed |
| typedef int16 | iwsfixed |
| typedef uint32 | iwufixed |
| typedef uint16 | iwusfixed |
Functions | |
| double __cdecl | acos (double) |
| double __cdecl | asin (double) |
| double __cdecl | atan2 (double, double) |
| double __cdecl | cos (double) |
| INLINE iwangle | IW_ANGLE_DIFFERENCE (iwangle x, iwangle y) |
| INLINE iwfixed | IW_FIXED_DIV (iwfixed a, iwfixed b) |
| INLINE iwfixed | IW_FIXED_DIV_SAFE (iwfixed a, iwfixed b) |
| INLINE iwfixed | IW_FIXED_FROM_FLOAT (float a) |
| INLINE iwfixed | IW_FIXED_FROM_FLOAT_CAST (float a) |
| INLINE iwfixed | IW_FIXED_MUL (iwfixed a, iwfixed b) |
| INLINE iwfixed | IW_FIXED_MUL2 (iwfixed a, iwfixed b, iwfixed d, iwfixed e) |
| INLINE iwfixed | IW_FIXED_MUL2_SAFE (iwfixed a, iwfixed b, iwfixed d, iwfixed e) |
| INLINE iwfixed | IW_FIXED_MUL3 (iwfixed a, iwfixed b, iwfixed c, iwfixed d, iwfixed e, iwfixed f) |
| INLINE iwfixed | IW_FIXED_MUL3_SAFE (iwfixed a, iwfixed b, iwfixed c, iwfixed d, iwfixed e, iwfixed f) |
| INLINE iwfixed | IW_FIXED_MUL_SAFE (iwfixed a, iwfixed b) |
| INLINE int32 | IW_MUL64_3_SHIFT (int32 a, int32 b, int32 c, int32 d, int32 e, int32 f, int32 shift) |
| INLINE int32 | IW_MUL64_SHIFT (int32 a, int32 b, int32 shift) |
| INLINE int32 | IW_MUL_2_SHIFT (int32 a, int32 b, int32 d, int32 e, int32 shift) |
| INLINE int32 | IW_MUL_3_SHIFT (int32 a, int32 b, int32 c, int32 d, int32 e, int32 f, int32 shift) |
| S3E_END_C_DECL INLINE int32 | IW_MULCHECK (const int32 a, const int32 b) |
| INLINE iwqfixed | IW_QFIXED_MUL (iwqfixed a, iwqfixed b) |
| INLINE iwqfixed | IW_QFIXED_MUL_SAFE (iwqfixed a, iwqfixed b) |
| INLINE iwsfixed | IW_SFIXED_FROM_FIXED (iwfixed a) |
| INLINE iwsfixed | IW_SFIXED_FROM_FLOAT_CAST (float a) |
| INLINE iwsfixed | IW_SFIXED_MUL (iwfixed a, iwfixed b) |
| iwfixed | IwGeomACos (iwfixed v) |
| iwfixed | IwGeomASin (iwfixed v) |
| iwangle | IwGeomAtan2 (int y, int x) |
| iwfixed | IwGeomCos (iwangle x) |
| void | IwGeomInit () |
| iwqfixed | IwGeomQACos (iwqfixed v) |
| iwqfixed | IwGeomQASin (iwqfixed v) |
| iwqfixed | IwGeomQATan2 (iwqfixed u, iwqfixed v) |
| iwqfixed | IwGeomQCos (iwqangle x) |
| iwqfixed | IwGeomQSin (iwqangle x) |
| S3E_BEGIN_C_DECL iwfixed | IwGeomSin (iwangle x) |
| iwfixed | IwGeomTan (iwangle x) |
| void | IwGeomTerminate () |
| double __cdecl | sin (double) |
| double __cdecl | sqrt (double) |
| double __cdecl | tan (double) |
| #define IW_ANGLE_2PI ((iwangle)IW_GEOM_ONE) |
(2 * PI) as an iwangle.
| #define IW_ANGLE_FROM_DEGREES | ( | x | ) | ((iwangle)(((x) * IW_ANGLE_2PI) / 360.0)) |
Converts an angle from degrees to iwangle.
| #define IW_ANGLE_FROM_RADIANS | ( | x | ) | ((iwangle)(((x) * IW_ANGLE_2PI) / (2 * PI))) |
Converts an angle from radians to iwangle.
| #define IW_ANGLE_MASK_PHASE | ( | x | ) | ((iwangle)((x) & (IW_ANGLE_2PI - 1))) |
Restricts an iwangle to the range 0 <= x < 2PI.
| #define IW_ANGLE_PI ((iwangle)IW_GEOM_HALF) |
PI as an iwangle.
| #define IW_ANGLE_Q2PI ((iwangle)IW_GEOM_QONE) |
(2 * PI) as an iwqangle.
| #define IW_ANGLE_TO_DEGREES | ( | x | ) | ((int32)(((x) * 360 + (IW_ANGLE_2PI>>1)) / IW_ANGLE_2PI)) |
Converts an angle from iwangle to degrees.
| x | Angle stored as an iwangle. |
| #define IW_ANGLE_TO_RADIANS | ( | x | ) | ((float)(((x) * PI) / IW_ANGLE_PI)) |
Converts an angle from iwangle to radians.
| #define IW_FIXED | ( | x | ) | ((iwfixed)((x) * IW_GEOM_ONE)) |
Converts a value to a iwfixed value.
| #define IW_FIXED_FROM_FLOAT_SHIFTED | ( | a, | |||
| s | ) | ((iwfixed)((a) * (float)(1 << (s)))) |
Convert a floating point number to a fixed point number with s bits of precision.
| a | The floating point number to convert. | |
| s | The number of bits in the fractional part of the fixed point representation. |
| #define IW_FIXED_TO_FLOAT | ( | a | ) | ((float)(a) / (float)IW_GEOM_ONE) |
Converts a 32 bit fixed point number to the nearest floating point number.
| a | The 32 bit fixed point number to convert. |
| #define IW_GEOM_HALF (1 << (IW_GEOM_POINT - 1)) |
One half (1/2) as a fixed point number for use with .12 formats.
| #define IW_GEOM_ONE (1 << IW_GEOM_POINT) |
One as a fixed point number for use with .12 formats.
| #define IW_GEOM_ONE2 (1 << (IW_GEOM_POINT << 1)) |
Same value as IW_GEOM_ONE * IW_GEOM_ONE
| #define IW_GEOM_POINT 12 |
Default position of fixed point, used with iwfixed and iwsfixed.
| #define IW_GEOM_QEPSILON 0x200000 |
Small delta for high-resolution fixed point calculations.
| #define IW_GEOM_QHALF (1 << (IW_GEOM_QPOINT - 1)) |
One half (1/2) as a fixed point number for use with .30 formats.
| #define IW_GEOM_QONE (1 << IW_GEOM_QPOINT) |
One as a fixed point number for use with .30 formats.
| #define IW_GEOM_QONE2 ((int64)1 << (IW_GEOM_QPOINT << 1)) |
Same value as IW_GEOM_QONE * IW_GEOM_QONE
| #define IW_GEOM_QPOINT 30 |
Default position of fixed point, used with CIwQuat.
| #define IW_GEOM_QPOINT_TO_GEOM_POINT (IW_GEOM_QPOINT - IW_GEOM_POINT) |
Right shift used to convert quaternion fixed point to that of iwfixed.
| #define IW_GEOM_ROUND | ( | a | ) | (((a) + IW_GEOM_HALF) >> IW_GEOM_POINT) |
Rounds a 32 bit fixed point number to the nearest integer.
| #define IW_QFIXED | ( | x | ) | ((iwqfixed)((x) * IW_GEOM_QONE)) |
Converts a value to an iwqfixed value.
| #define IW_SFIXED | ( | x | ) | ((iwsfixed)((x) * IW_GEOM_ONE)) |
Converts a value to a iwsfixed value.
| #define IW_SFIXED_FROM_FLOAT | ( | a | ) | IW_SFIXED_FROM_FIXED(IW_FIXED_FROM_FLOAT(a)) |
Convert a floating point number to the nearest 16 bit fixed point number.
| a | The floating point number to convert. |
| #define IW_UFIXED | ( | x | ) | ((iwufixed)((x) * IW_GEOM_ONE)) |
Converts a value to a iwufixed value.
| #define IW_USFIXED | ( | x | ) | ((iwusfixed)((x) * IW_GEOM_ONE)) |
Converts a value to a iwusfixed value.
| #define PI 3.141592653589793f |
Value of pi as a floating point number.
Typedef of char fixed point number. Typedef of 32-bit fixed point angle, where 0x800 represents PI.
Typedef of signed 32-bit high-resolution fixed point number, in 1.1.30 format.
Gets the difference between two angles in the range -IW_ANGLE_PI < (x - y) <= IW_ANGLE_PI.
Divides two iwfixed numbers in fixed point.
| a | First long operand. | |
| b | Second long operand. |
Divides two iwfixed numbers in fixed point, promoting the divident to a 64 bit number, if necessary.
| a | First long operand. | |
| b | Second long operand. |
Debug version provides overflow checking of the result.
| INLINE iwfixed IW_FIXED_FROM_FLOAT | ( | float | a | ) |
Convert a floating point number to the nearest 32 bit fixed point number. Checks for overflows in debug builds.
| a | The floating point number to convert. |
Multiplies two iwfixed numbers in fixed point.
| a | First long operand. | |
| b | Second long operand. |
Dot product of two two-coordinate, iwfixed vectors (a,b) and (d,e), in fixed point.
| a,b | First long fixed point vector. | |
| d,e | Second long fixed point vector. |
Dot product of two two-coordinate, iwfixed vectors (a,b) and (d,e), in fixed point. Calculations are made using int64 numbers.
| a,b | First long fixed point vector. | |
| d,e | Second long fixed point vector. |
Dot product of two three-coordinate, iwfixed vectors (a,b,c) and (d,e,f), in fixed point.
| a,b,c | First long fixed point vector. | |
| d,e,f | Second long fixed point vector. |
| INLINE iwfixed IW_FIXED_MUL3_SAFE | ( | iwfixed | a, | |
| iwfixed | b, | |||
| iwfixed | c, | |||
| iwfixed | d, | |||
| iwfixed | e, | |||
| iwfixed | f | |||
| ) |
Dot product of two three-coordinate, iwfixed vectors (a,b,c) and (d,e,f), in fixed point. Calculations are made using int64 numbers.
| a,b,c | First long fixed point vector. | |
| d,e,f | Second long fixed point vector. |
Multiplies two iwfixed numbers, in fixed point, using int64 numbers.
| a | First long operand. | |
| b | Second long operand. |
Dot product of two three-coordinate, int32 vectors (a,b,c) and (d,e,f), in fixed point. Accumulates in 64bit with a specified shift down
| a,b,c | First long fixed point vector. | |
| d,e,f | Second long fixed point vector. |
Multiply two int32 values Accumulates in 64bit with a specified shift down
| a | First long fixed point value. | |
| b | Second long fixed point value. |
Dot product of two two-coordinate, int32 vectors (a,b) and (d,e), in fixed point.
| a,b | First long fixed point vector. | |
| d,e | Second long fixed point vector. | |
| shift | Amount to shift down by |
Dot product of two three-coordinate, int32 vectors (a,b,c) and (d,e,f), in fixed point.
| a,b,c | First long fixed point vector. | |
| d,e,f | Second long fixed point vector. | |
| shift | Amount to shift down by |
Multiplies two 32 bit integers, asserting if there is overflow
Multiplies two iwqfixed numbers in fixed point.
| a | First long operand. | |
| b | Second long operand. |
Multiplies two iwqfixed numbers, in fixed point, using int64 numbers.
| a | First long operand. | |
| b | Second long operand. |
Converts a iwfixed value to a iwsfixed value. Checks for overflows in debug builds.
Multiplies two iwfixed numbers, in fixed point, casting the result to iwsfixed. Debug includes a test that the result will fit in an iwsfixed
| a | First long operand. | |
| b | Second long operand. |
| iwangle IwGeomAtan2 | ( | int | y, | |
| int | x | |||
| ) |
If we consider a standard graph with +ve x to the right, +ve y up, and theta measured anticlockwise from +ve x, this returns the angle in the range 0..0xfff
| y | sin | |
| x | cos |
cos function for fixed point angle.
| void IwGeomInit | ( | ) |
Initialises the IwGeom module.
atan2 function for iwqfixed
cos function for iwqfixed angle.
sin function for iwqfixed angle.
sin function for fixed point angle.
tan function for fixed point angle.
| void IwGeomTerminate | ( | ) |
Terminate IwGeom module. This is done automatically by IwGxTerminate().