Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -107,7 +107,7 @@ def plot_triangle(x1, y1, x2, y2, x3, y3, I_x, I_y, U_x, U_y, G_x, G_y, midpoint
|
|
| 107 |
vertex_name = ["A", "B", "C"]
|
| 108 |
for i, (vx, vy) in enumerate(vertices):
|
| 109 |
ax.scatter(vx, vy, color=vertex_color, zorder=3)
|
| 110 |
-
ax.text(vx+
|
| 111 |
|
| 112 |
# Plot key points with their corresponding colors
|
| 113 |
key_points = [
|
|
@@ -127,7 +127,7 @@ def plot_triangle(x1, y1, x2, y2, x3, y3, I_x, I_y, U_x, U_y, G_x, G_y, midpoint
|
|
| 127 |
midpoint_name = ["M1", "M2", "M3"]
|
| 128 |
for i, (mx, my) in enumerate(midpoints):
|
| 129 |
ax.scatter(mx, my, color=midpoint_color, zorder=3)
|
| 130 |
-
ax.text(mx+
|
| 131 |
|
| 132 |
|
| 133 |
# Draw the inscribed circle (incircle)
|
|
@@ -151,8 +151,10 @@ def plot_triangle(x1, y1, x2, y2, x3, y3, I_x, I_y, U_x, U_y, G_x, G_y, midpoint
|
|
| 151 |
plt.Line2D([0], [0], marker='o', color='w', markerfacecolor=incenter_color, markersize=7, label=key_points_labels[0]),
|
| 152 |
plt.Line2D([0], [0], marker='o', color='w', markerfacecolor=circumcenter_color, markersize=7, label=key_points_labels[1]),
|
| 153 |
plt.Line2D([0], [0], marker='o', color='w', markerfacecolor=centroid_color, markersize=7, label=key_points_labels[2])
|
|
|
|
|
|
|
| 154 |
]
|
| 155 |
-
ax.legend(handles=handles, loc='upper left', fontsize=
|
| 156 |
|
| 157 |
# Adjust the plot limits and aspect ratio
|
| 158 |
padding = 5
|
|
|
|
| 107 |
vertex_name = ["A", "B", "C"]
|
| 108 |
for i, (vx, vy) in enumerate(vertices):
|
| 109 |
ax.scatter(vx, vy, color=vertex_color, zorder=3)
|
| 110 |
+
ax.text(vx+0.5, vy+0.5, vertex_name[i], fontsize=10, ha="left", va="bottom", color=vertex_color)
|
| 111 |
|
| 112 |
# Plot key points with their corresponding colors
|
| 113 |
key_points = [
|
|
|
|
| 127 |
midpoint_name = ["M1", "M2", "M3"]
|
| 128 |
for i, (mx, my) in enumerate(midpoints):
|
| 129 |
ax.scatter(mx, my, color=midpoint_color, zorder=3)
|
| 130 |
+
ax.text(mx+0.5, my+0.5, midpoint_name[i], fontsize=10, ha="left", va="bottom", color=midpoint_color)
|
| 131 |
|
| 132 |
|
| 133 |
# Draw the inscribed circle (incircle)
|
|
|
|
| 151 |
plt.Line2D([0], [0], marker='o', color='w', markerfacecolor=incenter_color, markersize=7, label=key_points_labels[0]),
|
| 152 |
plt.Line2D([0], [0], marker='o', color='w', markerfacecolor=circumcenter_color, markersize=7, label=key_points_labels[1]),
|
| 153 |
plt.Line2D([0], [0], marker='o', color='w', markerfacecolor=centroid_color, markersize=7, label=key_points_labels[2])
|
| 154 |
+
plt.Line2D([0], [0], marker='o', color='w', markerfacecolor="blue", markersize=7, label=f"Area :, {area:.1f}")
|
| 155 |
+
plt.Line2D([0], [0], marker='o', color='w', markerfacecolor="lightblue", markersize=7, label=f"Perimeter :, {perimeter:.1f}")
|
| 156 |
]
|
| 157 |
+
ax.legend(handles=handles, loc='upper left', fontsize=9)
|
| 158 |
|
| 159 |
# Adjust the plot limits and aspect ratio
|
| 160 |
padding = 5
|