Hola
Necesito calcular el ángulo entre dos puntos y buscando en
google, he encontrado una función para VB .NET.
Yo utilizo VB 6 y parece que no tengo la función atan2
¿Pueden ayudarme? Les adjunto la susodicha función.
Gracias.
Private Function AngleToPoint(ByVal Origin As Point, _
ByVal Target As Point) As Single
'a cool little utility function,
'given two points finds the angle between them
'forced me to recall my highschool math,
'but the task is made easier by a special overload to
'Atan that takes X,Y co-ordinates.
Dim Angle As Single
Target.X = Target.X - Origin.X
Target.Y = Target.Y - Origin.Y
Angle = Math.Atan2(Target.Y, Target.X) / (Math.PI /
180)
Return Angle
End Function
Leer las respuestas