EasyGUI  Version v1.0
Mathematical

Common mathematical functions used by GUI. More...

Functions

uint8_t gui_math_sqrt (float x, float *const result)
 Calculate square of input value. More...
 
uint8_t gui_math_rsqrt (float x, float *const result)
 Calculate reverse square of input value. More...
 
uint8_t gui_math_distancebetweenxy (float x1, float y1, float x2, float y2, float *const result)
 Calculate distance between 2 XY points. More...
 
uint8_t gui_math_centerofxy (float x1, float y1, float x2, float y2, float *const resultx, float *const resulty)
 Calculate center XY coordinate between 2 XY points. More...
 

Detailed Description

Common mathematical functions used by GUI.

Function Documentation

◆ gui_math_centerofxy()

uint8_t gui_math_centerofxy ( float  x1,
float  y1,
float  x2,
float  y2,
float *const  resultx,
float *const  resulty 
)

Calculate center XY coordinate between 2 XY points.

\(\ c_x=\frac{x_1+x_2}{2}\)

\(\ c_y=\frac{y_1+y_2}{2}\)

Parameters
[in]x1X position of point 1
[in]y1Y position of point 1
[in]x2X position of point 2
[in]y2Y position of point 2
[out]resultxPointer to float variable to store result about X position to
[out]resultyPointer to float variable to store result about Y position to
Returns
1 on success, 0 otherwise

◆ gui_math_distancebetweenxy()

uint8_t gui_math_distancebetweenxy ( float  x1,
float  y1,
float  x2,
float  y2,
float *const  result 
)

Calculate distance between 2 XY points.

\(\ y=sqrt{((x_1-x_2)^2+(y_1-y_2)^2)}\)

Parameters
[in]x1X position of point 1
[in]y1Y position of point 1
[in]x2X position of point 2
[in]y2Y position of point 2
[out]resultPointer to float variable to store result to
Returns
1 on success, 0 otherwise

◆ gui_math_rsqrt()

uint8_t gui_math_rsqrt ( float  x,
float *const  result 
)

Calculate reverse square of input value.

\(\ y=\frac{1}{sqrt{(x)}}\)

Parameters
[in]xNumber to calculate reverse square from
[out]resultPointer to float variable to store result to
Returns
1 on success, 0 otherwise

◆ gui_math_sqrt()

uint8_t gui_math_sqrt ( float  x,
float *const  result 
)

Calculate square of input value.

\(\ y=sqrt{(x)}\)

Parameters
[in]xNumber to calculate square from
[out]resultPointer to float variable to store result to
Returns
1 on success, 0 otherwise