#define ASFixedNegInf ASMINInt32
#define ASFixedPosInf ASMAXInt32
#define ASFixedRectIsEmptyRect ( r )
#define ASFixedRoundToInt16 ( f )(( ASInt16 )((( f ) + fixedHalf ) >> 16 ) )
f | The fixed point number to convert.
|
#define ASFixedRoundToInt32 ( f )(( ASInt32 )((( f ) + fixedHalf ) >> 16 ) )
f | The fixed point number to convert.
|
#define ASFixedTruncToInt16 ( f )(( ASInt16 )(( f ) >> 16 ) )
f | The fixed point number to convert.
|
#define ASFixedTruncToInt32 ( f )(( ASInt32 )(( f ) >> 16 ) )
f | The fixed point number to convert.
|
#define ASInt16ToFixed ( i )(( ASFixed )( i ) *( 1 << 16 ) )
#define ASInt32ToFixed ( i )
i | The ASInt32 to convert.
|
#define ASUns16ToFixed ( i )((( i ) > 32767 ) ? ASFixedPosInf :(( ASFixed )( i ) << 16 ) )
#define FixedMatrix . . Use . ASFixedMatrix . instead . .
#define FixedMatrixP . . Use . ASFixedMatrixP . instead . .
#define FixedPointP . . Use . ASFixedPointP . instead . .
#define FixedQuad . . Use . ASFixedQuad . instead . .
#define FixedQuadP . . Use . ASFixedQuadP . instead . .
#define FixedRectP . . Use . ASFixedRectP . instead . .
#define FixedRoundToInt16 ASFixedRoundToInt16
#define FixedRoundToInt32 ASFixedRoundToInt32
#define FixedTruncToInt16 ASFixedTruncToInt16
#define FixedTruncToInt32 ASFixedTruncToInt32
float numbers are integer values). #define FloatIToFixed ( x )(( x ) > 32767 ) ? ASFixedPosInf :((( ASFixed ) x ) << 16 )
float numbers are non-negative). #define FloatNToFixed ( x )(( x ) <( - 32767 ) ) ? ASFixedNegInf :(( x ) > 32767 ) ? ASFixedPosInf :((( ASFixed )((( x ) *65536.0f + 0.5f ) ) )
#define Int16ToFixed ASInt16ToFixed
#define Int32ToFixed ASInt32ToFixed
#define fixedEight (( ASFixed ) 0x00080000L )
#define fixedEighth (( ASFixed ) 0x00002000L )
#define fixedEleven (( ASFixed ) 0x000B0000L )
#define fixedFifty (( ASFixed ) 0x00320000L )
#define fixedFive (( ASFixed ) 0x00050000L )
#define fixedFiveHundred (( ASFixed ) 0x01F40000L )
#define fixedFour (( ASFixed ) 0x00040000L )
#define fixedFourThirds (( ASFixed ) 0x00015555L )
#define fixedGolden (( ASFixed ) 0x00019e37L )
#define fixedHalf (( ASFixed ) 0x00008000L )
#define fixedHundred (( ASFixed ) 0x00640000L )
#define fixedHundredFifty (( ASFixed ) 0x00960000L )
#define fixedHundredth (( ASFixed ) 0x0000028FL )
#define fixedNegativeInfinity ASFixedNegInf
#define fixedNine (( ASFixed ) 0x00090000L )
#define fixedNinety (( ASFixed ) 0x005a0000L )
#define fixedOne (( ASFixed ) 0x00010000L )
#define fixedOne1 (( ASFixed ) 0x0000ffffL )
#define fixedOneAnd3Qtr (( ASFixed ) 0x0001C000L )
#define fixedOneAndQuarter (( ASFixed ) 0x00014000L )
#define fixedOneEighty (( ASFixed ) 0x00b40000L )
#define fixedPi2 (( ASFixed ) 0x00019220L )
#define fixedPi4 (( ASFixed ) 0x0000c910L )
#define fixedPositiveInfinity ASFixedPosInf
#define fixedQuarter (( ASFixed ) 0x00004000L )
#define fixedSeven (( ASFixed ) 0x00070000L )
#define fixedSevenEighths (( ASFixed ) 0x0000E000L )
#define fixedSeventyTwo (( ASFixed ) 0x00480000L )
#define fixedSix (( ASFixed ) 0x00060000L )
#define fixedSixteen (( ASFixed ) 0x00100000L )
#define fixedSixteenth (( ASFixed ) 0x00001000L )
#define fixedSqrtTwo (( ASFixed ) 0x00016A0AL )
#define fixedTen (( ASFixed ) 0x000A0000L )
#define fixedTenThousand (( ASFixed ) 0x27100000L )
#define fixedTenth (( ASFixed ) 0x00001999L )
#define fixedThird (( ASFixed ) 0x00005555L )
#define fixedThirtyTwo (( ASFixed ) 0x00200000L )
#define fixedThousand (( ASFixed ) 0x03E80000L )
#define fixedThree (( ASFixed ) 0x00030000L )
#define fixedThreeHalves (( ASFixed ) 0x00018000L )
#define fixedThreeQuarters (( ASFixed ) 0x0000C000L )
#define fixedTwelfth (( ASFixed ) 0x00001555L )
#define fixedTwelve (( ASFixed ) 0x000C0000L )
#define fixedTwo (( ASFixed ) 0x00020000L )
#define fixedTwoSeventy (( ASFixed ) 0x010e0000L )
#define fixedTwoThirds (( ASFixed ) 0x0000AAAAL )
#define fixedZero (( ASFixed ) 0x00000000L )
The ASFixed type is a 32-bit quantity representing a rational number with the high (low on little-endian machines) 16 bits representing the number's mantissa and the low (high on little-endian machines) 16 bits representing the fractional part. The definition is platform-dependent.
ASFixedP is a pointer to an ASFixed object.
Addition, subtraction, and negation with ASFixed types can be done with + and- operators, unless you are concerned with overflow. Overflow in ASFixed-value operations is indicated by the values fixedPositiveInfinity and fixedNegativeInfinity.
typedef ASInt32 ASFixed, *ASFixedP;
| |
|
| |
|
| |
|
| |
|
CString to a fixed point number. It processes the string from left to right only until the first invalid character is located (for example, a-z, A-Z). ASFixed ASCStringToFixed(const char *s);
s | A
CString to convert. |
s. Returns 0 if the string does not contain any valid number. CString to a fixed point number. Processes the string from left to right only until the first invalid character is located (for example, a-z, A-Z). ASFixed ASCStringToFixed(const char *s);
s | A
CString to convert. |
s, 0 if the string does not contain any valid number. ASFixed ASFixedDiv(ASFixed a, ASFixed b);
a | The dividend.
|
b | The divisor.
|
a / b. ASFixed ASFixedDiv(ASFixed a, ASFixed b);
a | The dividend.
|
b | The divisor.
|
a / b. void ASFixedMatrixConcat(ASFixedMatrixP result, const ASFixedMatrix *m1, const ASFixedMatrix *m2);
result | (Filled by the method) A pointer to matrix
m2 x m1. It is allowed for the result to point to the same location as either m1 or m2. |
m1 | A pointer to the ASFixedMatrix value for the first matrix to multiply.
|
m2 | A pointer to the ASFixedMatrix value for the second matrix to multiply.
|
void ASFixedMatrixConcat(ASFixedMatrixP result, const ASFixedMatrix *m1, const ASFixedMatrix *m2);
result | (Filled by the method) A pointer to matrix
m2 x m1. It is allowed for the result to point to the same location as either m1 or m2. |
m1 | A pointer to the ASFixedMatrix value for the first matrix to multiply.
|
m2 | A pointer to the ASFixedMatrix value for the second matrix to multiply.
|
Inverts a matrix.
If a matrix is nearly singular (which means that it has a determinant that is nearly zero), inverting and re-inverting the matrix may not yield the original matrix.
void ASFixedMatrixInvert(ASFixedMatrixP result, const ASFixedMatrixP m);
result | (Filled by the method) A pointer to
m-1. It is allowed for the result to point to the same location as m. |
m | A pointer to the ASFixedMatrix to invert.
|
Inverts a matrix.
If a matrix is nearly singular (meaning that it has a determinant of nearly zero), inverting and re-inverting the matrix may not yield the original matrix.
void ASFixedMatrixInvert(ASFixedMatrixP result, const ASFixedMatrixP m);
result | (Filled by the method) A pointer to
m-1. It is allowed for the result to point to the same location as m. |
m | A pointer to the ASFixedMatrix to invert.
|
p through the matrix m, and puts the result in result. p and result can point to the same location. void ASFixedMatrixTransform(ASFixedPointP result, const ASFixedMatrixP m, const ASFixedPointP p);
result | (Filled by the method) A pointer to the ASFixedPoint containing the result of transforming
p through m. It is allowed for the result to point to the same location as m. |
m | A pointer to the ASFixedMatrix through which
p is transformed. |
p | A pointer to the ASFixedPoint representing the point to transform through
m. |
p through the matrix m, puts result in result. p and result can point to the same place. void ASFixedMatrixTransform(ASFixedPointP result, const ASFixedMatrixP m, const ASFixedPointP p);
result | (Filled by the method) A pointer to the ASFixedPoint containing the result of transforming
p through m. It is allowed for the result to point to the same location as m. |
m | A pointer to the ASFixedMatrix through which
p is transformed. |
p | A pointer to the ASFixedPoint representing the point to transform through
m. |
void ASFixedMatrixTransformRect(ASFixedRectP result, const ASFixedMatrixP m, const ASFixedRectP r);
result | (Filled by the method) A pointer to the ASFixedRect containing the smallest bounding box for the transformed rectangle. It is allowed for the result to point to the same location as
m. result will always have bottom < top and left < right. |
m | A pointer to the ASFixedMatrix containing the matrix through which
r is transformed. |
r | A pointer to the ASFixedRect containing the rectangle to transform through
m. |
void ASFixedMatrixTransformRect(ASFixedRectP result, const ASFixedMatrixP m, const ASFixedRectP rectIn);
result | (Filled by the method) A pointer to the ASFixedRect containing the smallest bounding box for the transformed rectangle. It is allowed for the result to point to the same location as
m. The result will always have bottom < top and left < right. |
m | A pointer to the ASFixedMatrix containing the matrix through which
r is transformed. |
rectIn | A pointer to the ASFixedRect containing the rectangle to transform through
m. |
ASFixed ASFixedMul(ASFixed a, ASFixed b);
a | The first number to multiply.
|
b | The second number to multiply.
|
a and b. ASFixed ASFixedMul(ASFixed a, ASFixed b);
a | The first number to multiply.
|
b | The second number to multiply.
|
a and b. CString. Note: The precision for Mac OS numbers is valid to 9 significant digits.
void ASFixedToCString(ASFixed f, char *s, os_size_t maxLength, ASSmallCount precision);
f | The fixed number to convert.
|
s | (Filled by the method) The string corresponding to
f. |
maxLength | The maximum number of characters that
s can contain. |
precision | The number of digits to retain in the converted number.
|
CString. Note: The precision for Mac OS numbers is valid to 9 significant digits.
void ASFixedToCString(ASFixed f, char *s, os_size_t maxLength, ASSmallCount precision);
f | The fixed number to convert.
|
s | (Filled by the method) The string corresponding to
f. |
maxLength | The maximum number of characters that
s can contain. |
precision | The number of digits to retain in the converted number.
|
float. float ASFixedToFloat(ASFixed inASFixed);
inASFixed |
float representation of the ASFixed value. float to an ASFixed value. ASFixed FloatToASFixed(double inFloat);
inFloat | IN The
float value to convert. |
float value.