Example 1:
/* Draw an arc from 0 radians to 1 radians */ Arc (hdc, 100, 100, 100, 0, itofix (1)); /* Draw an arc from 0.5 radians to 1.5 radians */ fixed radian1 = itofix (1); fixed radian2 = itofix (2); fixed radian05 = fdiv (radian1, radian2); fixed radian15 = fdiv (fadd (radian1, randian2), radian2); Arc (hdc, 100, 100, 100, radian05, radian15);
Example 2:
void draw_arc (HDC hdc, POINT* pts) { int sx = pts [0].x, sy = pts [0].y; int dx = pts [1].x - sx, dy = pts [1].y - sy; int r = sqrt (dx * dx * 1.0 + dy * dy * 1.0); double cos_d = dx * 1.0 / r; fixed cos_f = ftofix (cos_d); fixed ang1 = facos (cos_f); int r2; fixed ang2; if (dy > 0) { ang1 = fsub (0, ang1); } dx = pts [2].x - sx; dy = pts [2].y - sy; r2 = sqrt (dx * dx * 1.0 + dy * dy * 1.0); cos_d = dx * 1.0 / r2; cos_f = ftofix (cos_d); ang2 = facos (cos_f); if (dy > 0) { ang2 = fsub (0, ang2); } Arc (hdc, sx, sy, r, ang1, ang2); }
|
|
Calculates and returns the arc cosine of a fixed point. This function calculates the arc cosine of the fixed point x; that is the value whose cosine is x. If x falls outside the range -1 to 1, this function fails and errno is set to EDOM.
Definition at line 397 of file fixedmath.h. |
|
||||||||||||
|
Returns the sum of two fixed point values. This function adds two fixed point values x and y, and returns the sum.
Definition at line 192 of file fixedmath.h. |
|
|
Calculates and returns the arc sine of a fixed point. This function calculates the arc sine of the fixed point x; that is the value whose sine is x. If x falls outside the range -1 to 1, this function fails and errno is set to EDOM.
Definition at line 420 of file fixedmath.h. |
|
|
Calculates the arc tangent of a fixed point value. This function calculates the arc tangent of x; that is the value whose tangent is x.
|
|
||||||||||||
|
Calculates the arc tangent of two fixed point variables. This function calculates the arc tangent of the two variables x and y. It is similar to calculating the arc tangent of y / x, except that the signs of both arguments are used to determine the quadrant of the result.
|
|
|
Rounds a fixed point value to the nearest integer. This function rounds the fixed point value x to the nearest integer and returns it.
Definition at line 302 of file fixedmath.h. |
|
|
Returns the cosine of a fixed point. This function returns the cosine of the fixed point x, where x is given in radians.
Definition at line 351 of file fixedmath.h. |
|
||||||||||||
|
Returns the quotient of two fixed point values. This function returns the quotient of two fixed point values x and y.
Definition at line 282 of file fixedmath.h. |
|
||||||||||||
|
Returns the Euclidean distance from the origin. The function returns the sqrt(x*x+y*y). This is the length of the hypotenuse of a right-angle triangle with sides of length x and y, or the distance of the point (x,y) from the origin.
|
|
||||||||||||
|
Returns the product of two fixed point values. This function returns the product of two fixed point values x and y.
Definition at line 264 of file fixedmath.h. |
|
|
Returns the sine of a fixed point. This function returns the sine of the fixed point x, where x is given in radians.
Definition at line 365 of file fixedmath.h. |
|
|
Returns the non-negative square root of a fixed point value. This function returns the non-negative square root of x. It fails and sets errno to EDOM, if x is negative.
|
|
||||||||||||
|
Subtract a fixed point value from another. This function subtracts the fixed point values y from the fixed point value x, and returns the difference.
Definition at line 229 of file fixedmath.h. |
|
|
Returns the tangent of a fixed point. This function returns the tangent of the fixed point x, where x is given in radians.
Definition at line 379 of file fixedmath.h. |
|
|
Converts a fixed point value to a float point value. This function converts the specified fixed point value x to a float point value.
Definition at line 172 of file fixedmath.h. |
|
|
Converts an fixed point value to an integer. This function converts the fixed point x to an integer.
Definition at line 337 of file fixedmath.h. |
|
|
Converts a float point value to a fixed point value. This function converts the specified float point value x to a fixed point value.
Definition at line 148 of file fixedmath.h. |
|
|
Converts an integer to a fixed point value. This function converts the integer x to a fixed point value.
Definition at line 324 of file fixedmath.h. |
1.4.2