Draw highlights.
(
ax: matplotlib.axes.Axes,
name: str,
args: list[gm.Point],
lcolor: Any,
color1: Any,
color2: Any,
)
| 1056 | |
| 1057 | |
| 1058 | def highlight( |
| 1059 | ax: matplotlib.axes.Axes, |
| 1060 | name: str, |
| 1061 | args: list[gm.Point], |
| 1062 | lcolor: Any, |
| 1063 | color1: Any, |
| 1064 | color2: Any, |
| 1065 | ) -> None: |
| 1066 | """Draw highlights.""" |
| 1067 | args = list(map(lambda x: x.num if isinstance(x, gm.Point) else x, args)) |
| 1068 | |
| 1069 | if name == 'cyclic': |
| 1070 | a, b, c, d = args |
| 1071 | _draw_circle(ax, Circle(p1=a, p2=b, p3=c), color=color1, lw=2.0) |
| 1072 | if name == 'coll': |
| 1073 | a, b, c = args |
| 1074 | a, b = max(a, b, c), min(a, b, c) |
| 1075 | _draw_line(ax, a, b, color=color1, lw=2.0) |
| 1076 | if name == 'para': |
| 1077 | a, b, c, d = args |
| 1078 | _draw_line(ax, a, b, color=color1, lw=2.0) |
| 1079 | _draw_line(ax, c, d, color=color2, lw=2.0) |
| 1080 | if name == 'eqangle': |
| 1081 | a, b, c, d, e, f, g, h = args |
| 1082 | |
| 1083 | x = line_line_intersection(Line(a, b), Line(c, d)) |
| 1084 | if b.distance(x) > a.distance(x): |
| 1085 | a, b = b, a |
| 1086 | if d.distance(x) > c.distance(x): |
| 1087 | c, d = d, c |
| 1088 | a, b, d = x, a, c |
| 1089 | |
| 1090 | y = line_line_intersection(Line(e, f), Line(g, h)) |
| 1091 | if f.distance(y) > e.distance(y): |
| 1092 | e, f = f, e |
| 1093 | if h.distance(y) > g.distance(y): |
| 1094 | g, h = h, g |
| 1095 | e, f, h = y, e, g |
| 1096 | |
| 1097 | _draw_line(ax, a, b, color=lcolor, lw=2.0) |
| 1098 | _draw_line(ax, a, d, color=lcolor, lw=2.0) |
| 1099 | _draw_line(ax, e, f, color=lcolor, lw=2.0) |
| 1100 | _draw_line(ax, e, h, color=lcolor, lw=2.0) |
| 1101 | if color1 == '--': |
| 1102 | color1 = 'red' |
| 1103 | draw_angle(ax, a, b, d, color=color1, alpha=0.5) |
| 1104 | if color2 == '--': |
| 1105 | color2 = 'red' |
| 1106 | draw_angle(ax, e, f, h, color=color2, alpha=0.5) |
| 1107 | if name == 'perp': |
| 1108 | a, b, c, d = args |
| 1109 | _draw_line(ax, a, b, color=color1, lw=2.0) |
| 1110 | _draw_line(ax, c, d, color=color1, lw=2.0) |
| 1111 | if name == 'ratio': |
| 1112 | a, b, c, d, m, n = args |
| 1113 | _draw_line(ax, a, b, color=color1, lw=2.0) |
| 1114 | _draw_line(ax, c, d, color=color2, lw=2.0) |
| 1115 | if name == 'cong': |
no test coverage detected