Resolve max_dim error
Browse files
backend/nonreflecting_ray_tracing.py
CHANGED
@@ -25,12 +25,6 @@ def is_angle_between(angle, start, end):
|
|
25 |
return angle >= start or angle <= end
|
26 |
|
27 |
|
28 |
-
def draw_line(angle, length=max(max_dim, 500), x_0=0, y_0=0):
|
29 |
-
x_1 = length * mt.cos(angle) + x_0
|
30 |
-
y_1 = length * mt.sin(angle) + y_0
|
31 |
-
return [x_0, x_1], [y_0, y_1]
|
32 |
-
|
33 |
-
|
34 |
def nonreflecting_plotter(a = 20, b = 20, r = 15, ray_count = 50):
|
35 |
if a == 0 and b == 0:
|
36 |
raise ValueError("Circle center cannot be at the origin (0, 0).")
|
@@ -48,6 +42,12 @@ def nonreflecting_plotter(a = 20, b = 20, r = 15, ray_count = 50):
|
|
48 |
|
49 |
circle = plt.Circle((a, b), r, color='blue', fill=False)
|
50 |
ax.add_artist(circle)
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
theta_center = mt.atan2(b, a)
|
53 |
d = mt.hypot(a, b)
|
|
|
25 |
return angle >= start or angle <= end
|
26 |
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
def nonreflecting_plotter(a = 20, b = 20, r = 15, ray_count = 50):
|
29 |
if a == 0 and b == 0:
|
30 |
raise ValueError("Circle center cannot be at the origin (0, 0).")
|
|
|
42 |
|
43 |
circle = plt.Circle((a, b), r, color='blue', fill=False)
|
44 |
ax.add_artist(circle)
|
45 |
+
|
46 |
+
def draw_line(angle, length=max(max_dim, 500), x_0=0, y_0=0):
|
47 |
+
x_1 = length * mt.cos(angle) + x_0
|
48 |
+
y_1 = length * mt.sin(angle) + y_0
|
49 |
+
return [x_0, x_1], [y_0, y_1]
|
50 |
+
|
51 |
|
52 |
theta_center = mt.atan2(b, a)
|
53 |
d = mt.hypot(a, b)
|