VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Wandelt kartesische in Polarkoordinaten und umgekehrt. *Bugfix*

by D.Progs (2 Submissions)
Category: Math/Dates
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 30th November 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Wandelt kartesische in Polarkoordinaten und umgekehrt. *Bugfix*

Rate Wandelt kartesische in Polarkoordinaten und umgekehrt. *Bugfix*



    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


Download this snippet    Add to My Saved Code

Wandelt kartesische in Polarkoordinaten und umgekehrt. *Bugfix* Comments

No comments have been posted about Wandelt kartesische in Polarkoordinaten und umgekehrt. *Bugfix*. Why not be the first to post a comment about Wandelt kartesische in Polarkoordinaten und umgekehrt. *Bugfix*.

Post your comment

Subject:
Message:
0/1000 characters