Well... Whenever I'm doing something mathematical in a program, I try to make up my own coordinate system. In this case, I wanted the screens bottom left corner to be at <-1,-1>, and its top right corner to be <1,1>. The center of the screen is at <0,0>.
That means that if you said:
screenLine(-1,-1,1,1)
a line would be drawn from the bottom left corner of the screen to the top right corner of the screen.
So, now we can imagine the screen to be a coordinate plane, viewed from -1 to 1 on both the x and y axes. posX and posY represent the mouse's coordinates in this system.
So, in a right triangle with sides a,b, and h, where a is the adjacent side and b is the opposite side:
cos(x)=a/h=posx/(posx^2+posy^2)
sin(x)=b/h=posy/(posx^2+posy^2)
tan(x)=b/a=posy/posx
Here's some code that illustrates that better:
global returnX as float
global returnY as float
posx as float
posy as float
do
cls
ink rgb(100,100,100),0
line 0,screen height()/2,screen width(),screen height()/2
line screen width()/2,0,screen width()/2,screen height()
transformFromScreen(mousex(),mousey()) `get the mouse position
posx=returnX
posy=returnY
ink rgb(200,0,0),0 `x
screenLine(0,0,posx,0)
screenText(posx/2,-.01,"a")
ink rgb(0,0,200),0 `y
screenLine(posx,0,posx,posy)
screenText(posx+.01,posy/2.0,"b")
ink rgb(200,200,0),0`hypotenuse
screenLine(0,0,posx,posy)
screenText(posx/2.0,posy/2.0,"h")
drawArc(wrapvalue(atanfull(posy,posx)),.1)
hyp#=sqrt(posx*posx+posy*posy)
text 0,0,"cos(ang)=a/h="+str$(posx/hyp#)
text 0,16,"sin(ang)=b/h="+str$(posy/hyp#)
text 0,32,"tan(ang)=b/a="+str$(posy/posx)
text 0,48,"ang="+str$(wrapvalue(atanfull(posy,posx)),2)
sync
loop
end
function drawArc(ang as float, radius as float)
ink rgb(0,255,255),0
n as float
xl as float
yl as float
xl=radius
for n=0.0 to ang step 5
screenLine(xl,yl,cos(n)*radius,sin(n)*radius)
xl=cos(n)*radius
yl=sin(n)*radius
next
transformToScreen(xl,yl)
circle returnX,returnY,3
screenText(radius/2.0,radius/2.0,"ang")
endfunction
function screenText(x as float, y as float, txt as string)
transformToScreen(x,y)
text returnx,returny,txt
endfunction
function screenLine(x as float, y as float, x2 as float, y2 as float)
y3 as float
x3 as float
transformToScreen(x,y)
x3=returnX
y3=returnY
transformToSCreen(x2,y2)
line returnX,returnY,x3,y3
endfunction
function transformFromScreen(x as integer, y as integer)
returnX=x*2.0/screen width()-1
returnY=-(y*2.0/screen height()-1)
endfunction
function transformToScreen(x as float, y as float)
returnX=(x+1)/2.0*screen width()
returnY=(-y+1)/2.0*screen height()
endfunction
So, in short, all that other stuff just transforms my coordinate system (from <-1,-1> to <1,1>

, to screen coordinates (from <0,0> to <screen width(), screen height()>

, because I think its simpler to treat coordinates that way.
Hmm... Are you familiar with using sine, cosine, and tangent? I had a hard time connecting all the different things like the unit circle, weird wavy graphs, and direction, when I started learning about trig stuff.