Created
August 1, 2024 18:02
-
-
Save hernandohhoyos/91e79cc6afe2b184469da5bbf138e6bd to your computer and use it in GitHub Desktop.
Calcular la posición de un segundo punto en un espacio 2D dados un punto inicial, una distancia, un eje, una altura y un ángulo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import numpy as np | |
def calculate_neigbor_vector(a, distance, degrees, height=0): | |
a = np.array(a) | |
radians = math.radians(degrees) | |
x2 = a[0] + distance * math.cos(radians) | |
y2 = a[1] + distance * math.sin(radians) | |
z2 = a[2] + distance * math.sin(radians) * height | |
return np.array((x2, y2, z2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment