Date: 02-16-2022
Return to Index
created by gbSnippets
Function ArcSin(ByVal Value As Double) As Double
Function = Atn(Value / Sqr(1 - Value * Value))
End Function
Function ArcCos(ByVal Value As Double) As Double
Function = 1.570796326794895# - ArcSin(Value)
End Function
Sub GetAnglesToPoint1(RX As Single, RY As Single)
RX = Atn(P(1).z/P(1).y)
If P(1).y < 0 Then
RX = RX + 3.14159
ElseIf P(1).z < 0 Then
RX = RX + 3.14159*2
End If
RY = Atn(P(1).z/P(1).x)
If P(1).x < 0 Then
RY = RY + 3.14159
ElseIf P(1).z < 0 Then
RY = RY + 3.14159*2
End If
End Sub
Sub GetCurrentRotation 'sets Global varibales CurrentRx/CurrentRY
GetAnglesToPoint1 CurrentRX, CurrentRY
' CurrentRX = CurrentRX - RXOffSet
' CurrentRY = CurrentRY - RYOffset
Statusbar Set Text hDlg, %IDC_Statusbar, 1, 0, "Rotation About X Axis: " + Format$(CurrentRX * 180 / 3.14159,"##0") + " Rotation About Y Axis: " + Format$(CurrentRY * 180 / 3.14159,"##0") + Str$(P(1).x) + Str$(P(1).Y) + Str$(p(1).Z)
End Sub
'gbs_01294
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm