- Home
·
- Math/Dates
·
- Wandelt kartesische in Polarkoordinaten und umgekehrt. *Bugfix*
Wandelt kartesische in Polarkoordinaten und umgekehrt. *Bugfix*
Wandelt kartesische in Polarkoordinaten und umgekehrt. *Bugfix*
Rate Wandelt kartesische in Polarkoordinaten und umgekehrt. *Bugfix*
(1(1 Vote))
Angle As Single
Radius As Single
X As Single
Y As Single
End Type
Private Function Pi() As Double
Pi = 4 * Atn(1)
End Function
Private Function GradToRad(Grad As Single) As Single
GradToRad = Grad * Pi / 180
End Function
Public Function RadToGrad(Rad As Single) As Single
GradToRad = Rad * 180 / Pi
End Function
Private Function Arccos(Number As Double) As Double
Arccos = Atn(-Number / Sqr(-Number * Number + 1)) + 2 * Atn(1)
End Function
Private Sub PolarToKart(ByRef PolarPoint As Point)
With PolarPoint
.X = .Radius * Cos(GradToRad(.Angle))
.Y = .Radius * Sin(GradToRad(.Angle))
End With
End Sub
Private Sub KartToPolar(ByRef KartPoint As Point)
With KartPoint
.Radius = Sqr(.X ^ 2 + .Y ^ 2)
.Angle = RadToGrad(Sgn(.Y + 1 - Abs(Sgn(Y))) * Arccos(.X / .Radius))
End With
End Sub
Wandelt kartesische in Polarkoordinaten und umgekehrt. *Bugfix* Comments
No comments yet — be the first to post one!
Post a Comment