ASin (number)  

Definition:

Returns the smallest angle (in degrees) satisfying the arc sine (inverse sine) of the supplied argument.

Parameter Description:


number=float or integer representing a ratio of the "Y" coordinate to the tangential displacement.

Command Description:

This command is used for translating X/Y coordinate values to angles. Remember that the computer screen uses an inverted y-axis (values get larger the further down the screen).

Example:

Graphics 640,480
Repeat
Cls
; Determine the positions and the length of the hypotenuse
x# = MouseX() ; displacement across the screen.
y# = MouseY() ; displacement down the screen.
r# = Sqr((x#*x#)+(y#*y#)) ; length of the hypotenuse.
; Draw the axes
Color 104,104,104
Line x#,0,x#,y# ; draw a line from the top to the cursor.
Line 0,y#,x#,y# ; draw a line from the left to the cursor.
Locate x#+10,y#-10 : Write "X=" : Print x#
Locate x#-10,y#+10 : Write "Y=" :Print y#

; reset any drawing to the top right
Origin 0,0

; Draw the angled line
Color 255,255,255
Line 0,0,x#,y# ; draw a line from the top right corner of the screen to the cursor.
theta# = ASin(y#/r#) ; the angle between the x axis and the y axis.
Locate 60,10 : Write "Angle:" : Print theta

; Draws an arc showing the angle.
For degrees#=0 To theta#; Step though all the degrees in the angle
; The next line calculates the X and Y coordinates of the point of the circle using the Sin and Cos
; commands, and multiplies it by 50 (to get a larger radius, try and change it).
cy=Sin(degrees#)*50
cx=Cos(degrees#)*50
Plot cx,cy ; Draw the current point on the circle.
Next ; Give us another angle

Flip
; Use the ESCAPE key to quit
Until KeyDown(1)
End

Index