获取位置旋转弧度.bas
资源名称:vbmcrisrc.rar [点击查看]
上传用户:pcw2004
上传日期:2022-02-02
资源大小:743k
文件大小:1k
源码类别:
DirextX编程
开发平台:
Visual Basic
- Attribute VB_Name = "获取位置旋转弧度"
- Option Explicit
- ' Download by http://www.codefans.net
- Public Const PI = 3.1415928
- Public Function GetRot(X As Single, Y As Single) As Single
- If X > 0 And Y > 0 Then GetRot = PI + Atn(X / Y)
- If X > 0 And Y < 0 Then GetRot = 2 * PI + Atn(X / Y)
- If X < 0 And Y > 0 Then GetRot = PI + Atn(X / Y)
- If X < 0 And Y < 0 Then GetRot = 2 * PI + Atn(X / Y)
- If X = 0 Then GetRot = CSng(IIf(Y <= 0, 0, PI)) 'PI / 2, 3 * PI / 2))
- If Y = 0 Then GetRot = CSng(IIf(X < 0, PI / 2, 3 * PI / 2))
- End Function