Perimeter rectangle
Author: Irina Boyadzhiev
Date: 15 February 2013

roll

Drag to roll the rectangle

Ponga el cursor sobre el punto y deslícelo para ver el perímetro del rectángulo

Si usted desea cambiar el tamaño del rectángulo basta poner el cursor sobre un vértice del rectángulo.

Instrucciones

Perímetro de rectángulo

O = (0, 0)
v = UnitOrthogonalVector(xAxis)
E = Point(xAxis)
i = -1 (slider from -1 to 6.283185307179586, step 0.1)
α = If(i > 0, i, 0)
tr = If(i ≤ 0, i, 0)
K = (13, 2)
L = (-2, 2)
n = Ray(L, K)
B = Point(n)
u = UnitVector(Segment[B, O])
B' = Translate(B, Vector[(tr + 1) * u * Distance[B, O]])
J = (-2, 6)
l = Ray(L, J)
A = Point(l)
A' = Translate(A, Vector[(tr + 1) * u * Distance[B, O]])
b = OrthogonalLine(A, l)
C = Point(b)
C' = Translate(C, Vector[(tr + 1) * u * Distance[B, O]])
c = Segment(A, C)
d = OrthogonalLine(C, c)
h = Length(Vector[A, C])
a = Segment(A, B)
e = OrthogonalLine(B, a)
D = Intersect(d, e)
D' = Translate(D, Vector[(tr + 1) * u * Distance[B, O]])
β = Angle(E, O, D')
m = If(α < β, 1, Div[α - β, 1.5708] + 2)
AngR = If(m ≟ 1, α, α - β - (m - 2) * 3.141592653589793 / 2)
t = Length(Vector[A, B])
long = Max(h, t)
list1: {0, h, h + t, t + 2 * h, 2 * t + 2 * h}
list2 = Sequence((Element[list1, k], 0), k, 1, 5)
D_1 = If(m ≟ 1, D', If[Distance[Element[list2, m - 1], Element[list2, m]] ≟ h, Element[list2, m] + v * t, Element[list2, m] + v * h])
C_1 = If(m ≟ 1, C', If[Distance[Element[list2, m - 1], Element[list2, m]] ≟ h, Element[list2, m - 1] + v * t, Element[list2, m - 1] + v * h])
B_1 = If(m ≟ 1, B', Element[list2, m])
A_1 = If(m ≟ 1, A', Element[list2, m - 1])
cent = Element(list2, m)
I = Rotate(C_1, -AngR, cent)
H = Rotate(D_1, -AngR, cent)
G = Rotate(B_1, -AngR, cent)
F = Rotate(A_1, -AngR, cent)
poly3', f_1, g_1, h_1, i_1 = Polygon(F, G, H, I)
a11 = Line(A, B)
poly1, a_1, b_1, d_1, c_1 = Polygon(A, B, D, C)
poly1', a', b', d', c' = Polygon(A', B', D', C')
list3 = Append(A', list2)
poly3, a_2, b_2, d_2, c_2 = Polygon(A_1, B_1, D_1, C_1)
list4 = Sequence(Segment[Element[list2, k], Element[list2, k + 1]], k, 1, 4)
side1 = Element(list4, 1)
side2 = Element(list4, 2)
side3 = Element(list4, 3)
colorf = If(f_1 ≟ long, 1, 0)
side4 = Element(list4, 4)
colorh = If(h_1 ≟ long, 1, 0)
colorg = If(g_1 ≟ long, 1, 0)
colori = If(i_1 ≟ long, 1, 0)
text1: "Sum = " + (x(Element[list2, m]))
M = Point(A, Vector[UnitVector[l]])
N = Point((x(C), y(C) + 0.5), Vector[UnitVector[c]])
co1 = If(side1 ≟ long, 1, 0)
co2 = If(side2 ≟ long, 1, 0)
co3 = If(side3 ≟ long, 1, 0)
co4 = If(side4 ≟ long, 1, 0)
f = Vector((x(A) - 0.5, y(A)), (x(M) - 0.5, y(A) + 1.3))
z = Vector((x(A) - 0.5, y(A)), (x(M) - 0.5, y(A) - 1.3))
Pos: (Corner[2] + Corner[1]) / 2
P: (x(Pos), y(Pos) + 2)
g = Vector((x(C) - 0.5, y(C) + 0.5), (x(N) + 0.5, y(N)))
w = Vector((x(C) + 0.5, y(C) + 0.5), (x(N) - 2.5, y(N)))