diff --git a/basictypes.py b/basictypes.py index 4d3055c..ae36187 100644 --- a/basictypes.py +++ b/basictypes.py @@ -74,11 +74,15 @@ class Line: class WallIDMismatch (RuntimeError): ... # Helper methods -def polar_to_cart(self, r, theta_deg) -> tuple: +def polar_to_cart(r, theta_deg) -> tuple: #print('polar to cart ',r, theta_deg) x = r * math.cos(deg_to_rad(theta_deg)) y = r * math.sin(deg_to_rad(theta_deg)) return x,y def deg_to_rad(theta_deg) -> float: - return theta_deg*(math.pi/180) \ No newline at end of file + return theta_deg*(math.pi/180) + +def point_from_polar(r, theta, wall_id) -> PointWithID: + x, y = polar_to_cart(r, theta) + return PointWithID(x, y, wall_id)