image
    GETANGLE
GETANGLE returnangle x1var, y1var, x2var, y2var

returnangle
x1var
y1var
x2var
y2var
variable name to be replaced
-20000 to 20000 INT or RND variable: x position of xy1
-20000 to 20000 INT or RND variable: y position of xy1
-20000 to 20000 INT or RND variable: x position of xy2
-20000 to 20000 INT or RND variable: y position of xy2


This allows you to retrieve the angle of a line given its start x,y and end x,y points
NOTE:
when you retrieve an angle it will be formatted into the host variable.
So if you are wanting degrees, make sure the host variable is defined as 1, 359
E.G. if the stored variable was 3000 and the host variables MAX was 2000, it would be formatted to that maximum, which is 2000.


 

Example:



SYS-NOWELCOME
DEFINE INT temp 0, 360
DEFINE INT x 0, SYS_WIDTH
DEFINE INT y 0, SYS_HEIGHT
BEGIN
CLS
CONVERT VJO_INT0 TO x
CONVERT VJO_INT1 TO y
GETANGLE temp SYS_H_WIDTH, SYS_H_HEIGHT, x, y
LINE SYS_H_WIDTH, SYS_H_HEIGHT, x, y
PRINT "angle = %temp%"
END

This is a simple example of a line from the centre of the screen to the input x,y values (defined by vjo0, vjo1).
The resulting line is drawn along with the angle fo the line.




 Related Commands: