vg4->misc->angle_from_xy()
Return angle according to a given x-/y-direction.
SYNTAX
int
vg4->misc->angle_from_xy(int xdelta, int ydelta, int *pixelpercent)
FUNCTION PARAMETERS
xdelta | x-direction in 1/100 pixels |
ydelta | y-direction in 1/100 pixels |
pixelpercent | Percent of pixels on which xdelta/ydelta is based, may be NULL |
RETURN VALUE
Returns the angle in degrees from 0 to 359,
or -1 if xdelta and ydelta are both 0
DESCRIPTION
Return angle according to a given x-/y-direction.
The parameter pixelpercent, if not NULL, returns the velocity of the x-/y-direction.
EXAMPLE
int angle, xdelta, ydelta, pixelpercent; /* x-direction shall be 0.87 pixels to the right */ xdelta = 87; /* y-direction shall be 0.5 pixels upward */ ydelta = -50; angle = vg4->misc->angle_from_xy(xdelta, ydelta, &pixelpercent); /* now angle is 60, and pixelpercent is 100 which means based on 1 pixel */ /* x-direction shall be 1.74 pixels to the right */ xdelta = 174; /* y-direction shall be 1 pixel upward */ ydelta = -100; angle = vg4->misc->angle_from_xy(xdelta, ydelta, &pixelpercent); /* now angle is 60, and pixelpercent is 200 which means based on 2 pixels */
SEE ALSO