REM *********************************************** REM Title: Angle between vectors REM Author: Phaelax REM Downloaded from: http://dbcc.zimnox.com/ REM *********************************************** n = make vector2(1) set vector2 1, 50, 13 Alen# = length vector2(1) n = make vector2(2) set vector2 2, 27, -40 Blen# = length vector2(2) dp# = dot product vector2(1, 2) REPEAT cls if mouseclick() = 1 set vector2 1, mousex()-320, mousey()-240 Alen# = length vector2(1) dp# = dot product vector2(1, 2) endif if mouseclick() = 2 set vector2 2, mousex()-320, mousey()-240 Blen# = length vector2(2) dp# = dot product vector2(1, 2) endif a# = acos(dp# / (Alen#*Blen#)) print "Angle: ", a# ink rgb(255,0,0),0 line 320, 240, 320+x vector2(1), 240+y vector2(1) text 320+x vector2(1), 240+y vector2(1), "A" ink rgb(0,255,0),0 line 320, 240, 320+x vector2(2), 240+y vector2(2) text 320+x vector2(2), 240+y vector2(2), "B" UNTIL spacekey() end