News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Question about "GetAngle2D"

Started by ale870, September 13, 2006, 07:44:33 AM

Previous topic - Next topic

ale870

Hello,
I found this function, but I don't understand how it works.

Help says:

"GetAngle2D() returns the angle (in degrees) of two given points. X1 and Y1 define the position of Point 1, while X2 and Y2 define the position of Point 2. "

But... how can I create an angle using two points?  ???
--Alessandro

kevin

#1
 see   Projects/Math/GetAngle2D

PlayBASIC Code: [Select]
   CreateConvexShape 1,50,3

shapePosX#=400
shapePosY#=400



Do
Cls 0

mx#=MouseX()
my#=MouseY()

CircleC mx#,my#,10,1,RGB(255,0,0)

angle#=GetAngle2D(shapePosX#,shapePosY#,mx#,my#)

RotateShape 1,angle#,1
DrawShape 1,shapePosX#,shapePosY#,2

Line shapePosX#,shapePosY#,CosNewValue(shapePosX#,angle#,100),SinNewValue(shapePosy#,angle#,100)
Sync
Loop





  - See PlayBASIC Help Files GETANGLE2D


ale870

Thank you!
I will check and study  :D

--Alessandro