Last active
April 28, 2022 01:47
-
-
Save GGLinnk/7f67f3c08a01543cc9e45bf63eb3e1b3 to your computer and use it in GitHub Desktop.
Python Maths : Calculate the distance of two points from polar coordinates (angle and distance from point 0).
This file contains 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 | |
def polar_distance(self, distance: float, distance_cmp: float, angle: float, angle_cmp: float): | |
p1 = distance | |
p2 = distance_cmp | |
a = math.cos(angle_cmp - angle) | |
return math.sqrt(p1 ** 2 + p2 ** 2 - 2 * p1 * p2 * a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment