Rectangle Pouring

Pour!

New Rect

Rectangle Pouring Inc.

       pours without a spill!

SPILL!

“We pour rectangles of equal perimeter
or your money back”

Good Pouring!
Now, you can drag to make your own pouring rectangles!
Don't spill!

h_1: y = 14 - x
J = (18, 4)
j = Line(J, xAxis)
constrain_C = Segment((10, 4), (0, 14))
C = Point(constrain_C)
b = OrthogonalLine(C, yAxis)
a = OrthogonalLine(C, xAxis)
A = (0, 4)
d = OrthogonalLine(A, yAxis)
D = Intersect(a, d)
c = OrthogonalLine(A, xAxis)
B = Intersect(b, c)
tgtRectangle, tgt_w, d_1, c_1, tgt_h = Polygon(A, D, C, B)
tgtPerim: (2 * (tgt_w + tgt_h))
k = Circle(J, tgtPerim / 2)
K = Intersect(k, j, 2)
RandRect = RandomUniform(x(J) + 1, x(K) - 1)
E = Intersect(xAxis, yAxis)
F = Point(Circle[E, tgt_w])
e = Segment(E, F)
G = Point(Circle[F, tgt_h])
f = Segment(F, G)
H = Point(Circle[G, c_1])
g = Segment(G, H)
I = Point(Circle[H, d_1])
h = Segment(H, I)
l = Segment(J, K)
L = Point(l)
p = Circle(L, K)
m = OrthogonalLine(L, l)
M = Intersect(p, m, 2)
n = OrthogonalLine(M, yAxis)
q = OrthogonalLine(J, l)
N = Intersect(n, q)
PouringRectangle, j_1, l_1, m_1, n_1 = Polygon(J, L, M, N)
newAreaHeight: Area[PouringRectangle] / tgt_w
r = Circle(D, newAreaHeight)
P, Q = Intersect(r, a)
s = OrthogonalLine(Q, a)
R = Intersect(c, s)
t_1 = Segment(R, Q)
pouredAreaRectangle, a_2, d_2, q_1, r_1 = Polygon(A, D, Q, R)
i: x(D) + t_1
t = 0 (slider from 0 to 1, step 0.01)
u = Vector(D, Q)
waterT: (x(D), y(D)) + (t * u)
v = Vector(J, N)
waterS: (x(N), y(N)) - (t * v)
f_1 = Line(waterS, m_1)
T = Intersect(f_1, l_1)
g_1 = Line(waterT, tgt_w)
O = Intersect(g_1, r_1)
poly1, a_1, d_3, watert, o = Polygon(A, D, waterT, O)
poly2, j_2, l_2, t_2, waters = Polygon(J, L, T, waterS)
V: (x(waterT) + 2, y(waterT) - 1)
S = Midpoint(l)
buttontoggle = true
L_1: (RandRect, y(J))
pourC = 0
text2: "" + pourC + ""
goodPourer: pourC > 2
spilt = false
e_1 = Circle(J, tgt_w)
U = Intersect(e_1, l)
legred_B: Min[x(L), x(U)] - x(J)
legred_U: tgt_w - legred_B
k_1 = Circle(L, legred_U)
W = Intersect(k_1, l_1)
legred_1 = Segment(J, (Min[x(U), x(L)], y(U)))
legred_2 = Segment(L, W)
legblue_2 = Segment(W, M)
legblue_1 = Segment((Min[x(U), x(L)], y(U)), L)
i_1 = LineBisector(N, M)
p_1 = LineBisector(N, J)
W' = Mirror(W, p_1)
W'' = Mirror(W', i_1)
Z: (Min[x(U), x(L)], y(U))
Z' = Mirror(Z, p_1)
Z'' = Mirror(Z', i_1)
leggreen_1 = Segment(M, Z'')
legorange_1 = Segment(Z'', N)
leggreen_2 = Segment(N, W'')
legorange_2 = Segment(W'', J)