MiniGUI API Reference (MiniGUI-Standalone)
v3.2.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
|
Functions | |
MG_EXPORT fixed | fixsqrt (fixed x) |
Returns the non-negative square root of a fixed point value. More... | |
MG_EXPORT fixed | fixhypot (fixed x, fixed y) |
Returns the Euclidean distance from the origin. More... | |
MG_EXPORT fixed | fixatan (fixed x) |
Calculates the arc tangent of a fixed point value. More... | |
MG_EXPORT fixed | fixatan2 (fixed y, fixed x) |
Calculates the arc tangent of two fixed point variables. More... | |
static fixed | ftofix (double x) |
Converts a float point value to a fixed point value. More... | |
static double | fixtof (fixed x) |
Converts a fixed point value to a float point value. More... | |
static fixed | fixadd (fixed x, fixed y) |
Returns the sum of two fixed point values. More... | |
static fixed | fixsub (fixed x, fixed y) |
Subtract a fixed point value from another. More... | |
MG_EXPORT fixed | fixmul (fixed x, fixed y) |
Returns the product of two fixed point values. More... | |
MG_EXPORT fixed | fixdiv (fixed x, fixed y) |
Returns the quotient of two fixed point values. More... | |
static int | fixceil (fixed x) |
Rounds a fixed point value to the nearest integer. More... | |
static fixed | itofix (int x) |
Converts an integer to a fixed point value. More... | |
static int | fixtoi (fixed x) |
Converts an fixed point value to an integer. More... | |
static fixed | fixcos (fixed x) |
Returns the cosine of a fixed point. More... | |
static fixed | fixsin (fixed x) |
Returns the sine of a fixed point. More... | |
static fixed | fixtan (fixed x) |
Returns the tangent of a fixed point. More... | |
static fixed | fixacos (fixed x) |
Calculates and returns the arc cosine of a fixed point. More... | |
static fixed | fixasin (fixed x) |
Calculates and returns the arc sine of a fixed point. More... | |
You know that the float point mathematics routines are very expensive. If you do not want precision mathematics result, you can use fixed point. MiniGUI uses a double word (32-bit) integer to represent a fixed point ranged from -32767.0 to 32767.0, and defines some fixed point mathematics routines for your application. Some GDI functions need fixed point math routines, like Arc.
Example 1:
Example 2:
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 411 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.
x | x,y: Two addends. |
y | x,y: Two addends. |
Definition at line 217 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 434 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.
|
inlinestatic |
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 316 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 365 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.
x | The dividend. |
y | The divisor. |
Referenced by fixsub().
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.
x | The faciend. |
y | The multiplicato. |
Referenced by fixsub().
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 379 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.
x | The minuend. |
y | The subtrahend. |
Definition at line 254 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 393 of file fixedmath.h.
|
inlinestatic |
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 197 of file fixedmath.h.
|
inlinestatic |
Converts an fixed point value to an integer.
This function converts the fixed point x to an integer.
Definition at line 351 of file fixedmath.h.
|
inlinestatic |
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 173 of file fixedmath.h.
|
inlinestatic |
Converts an integer to a fixed point value.
This function converts the integer x to a fixed point value.
Definition at line 338 of file fixedmath.h.