#colors
c = ["#073EA5FF", "#073EA588", "#55C667FF", "#55C66788"]
#Original triangle vertices and sides.
t0 = [(0, 0), (4, 3), (4, 0), (0, 0)]
#Original triangle labels.
text0 = [("a", (3.9, 1.6), c[0], 'right', 'top'),
("b", (2.1, 0.1), c[0], 'left', 'bottom'),
("c", (2.1, 1.6), c[0], 'left', 'top')]
#New triangle vertices and sides.
add0 = [[t0[1], (8, 0), t0[2]],
[t0[1], (5, 0), t0[2]],
[t0[0], (4, -3), t0[2]],
[t0[0], (4, -2), t0[2]],
[t0[0], (4, -7/6), t0[2]],
[t0[0], (4, 4), t0[1]],
[t0[1], (5.12, 3.84), t0[2]]]
#New triangle labels.
addtext0 = [[("c", (5.9, 1.6), c[2], 'right', 'top'),
("b", (5.9, 0.1), c[2], 'right', 'bottom')],
[("√(a²+(c-b)²)", (4.55, 1.6), c[2], 'left', 'top'),
("c-b", (4.45, 0.1), c[2], 'center', 'bottom')],
[("a", (3.9, -1.6), c[2], 'right', 'bottom'),
("c", (2.1, -1.6), c[2], 'left', 'bottom')],
[("√(b²+(c-a)²)", (2, -1), c[2], 'right', 'top'),
("c-a", (3.9, -1), c[2], 'right', 'center')],
[("c²/2a", (2, -7/9), c[2], 'center', 'top'),
("c²/2a-a", (4.1, -7/12), c[2], 'left', 'center')],
[("b√2", (2.2, 2.6), c[2], 'center', 'bottom'),
("b-a", (4.1, 3.5), c[2], 'left', 'center')],
[("2b²/c-c", (4.56, 3.42), c[2], 'right', 'bottom'),
("b", (4.55, 2.1), c[2], 'right', 'center')]]
#Triangles.
def triangle(points, ec, fc, ls, lw, closed):
return(mpP(points,
edgecolor = ec,
facecolor = fc,
ls = ls,
lw = lw,
closed = closed))
#Clear axes.
def clearAx(ax):
ax.spines["top"].set_visible(False)
ax.spines["right"].set_visible(False)
ax.spines["bottom"].set_visible(False)
ax.spines["left"].set_visible(False)
ax.set_xticks([])
ax.set_yticks([])
return(ax)