deroulecylindre
Author: Daniel Mentrard
Date: 13 Juin 2014

Roll or unroll

r

h

RECTANGLE -->CURVED SURFACE
      set height & radius sliders
useRoll/Unroll slider to wrap rectangle 
Rigthclick on sheet and move to 3Drotate

B_1 = (10.25751248788527, -3.044029493717567)
View3D = (-488.026661399058, -509.5135230877083)
xa: x(View3D)
sinphi: sin(xa)
cosphi: cos(xa)
ya: y(View3D)
sintheta: sin(ya)
costheta: cos(ya)
Zoom = 1.1 (slider from 1 to 5, step 0.1)
Z: (x(B_1), y(B_1) + Zoom * costheta)
w = Vector(B_1, Z)
Y: (x(B_1) + Zoom * cosphi, y(B_1) + Zoom * sinphi * sintheta)
v = Vector(B_1, Y)
xy: -Zoom * cosphi * sintheta
X: (x(B_1) + Zoom * sinphi, y(B_1) + xy)
u = Vector(B_1, X)
O = (0.44326697886383415, 1.2417368081116014)
height = 2.1 (slider from 0 to 5, step 0.1)
radius = 4.4 (slider from 0.1 to 5, step 0.1)
Close = 0.2792526803190927 rad (slider from 0 to 1.5707963267948966, step 0.017453292519943295)
B: O + radius * u - height * v
I: B - radius / π * cos(Close) * v + radius / π * sin(Close) * w
Sides = 6 (slider from 3 to 50, step 1)
h = If(Sides ≟ 3, 90, If[Sides ≟ 4, 0, If[Sides ≟ 5, 270, If[Sides ≟ 6, 180, If[Sides ≟ 7, 100, If[Sides ≟ 8, 0, If[Sides ≟ 9, 270, If[Sides ≟ 10, 180, If[Sides ≟ 11, 100, If[Sides ≟ 12, 0, 0]]]]]]]]])
Rotate = 0.7 (slider from 0 to 1, step 0.1)
d = 270 (slider from 0 to 360, step 1)
aa: 360 / (Sides + 1)
g = 1 (slider from -5 to 5, step 0.1)
k = 1 (slider from -5 to 5, step 0.1)
a = OrthogonalLine(View3D, yAxis)
b = OrthogonalLine(View3D, xAxis)
c: cos(ya)
A: O + radius * u + height * v
U: A + radius / π * cos(Close) * v + radius / π * sin(Close) * w
C: O - radius * u + height * v
D: O - radius * u + height * v
T = Dilate(D, Rotate, A)
T'_1 = Translate(T, Vector[radius / 3.141592653589793 * w])
G: T'_1
N: G - radius / 3.141592653589793 * w
M: N + radius / 3.141592653589793 * cos(Close) * v + radius / 3.141592653589793 * sin(Close) * w
z = Vector(A, U)
T''_1 = Translate(T'_1, Vector[A, B])
J: T''_1
Q: J - radius / 3.141592653589793 * w
R: Q - radius / 3.141592653589793 * cos(Close) * v + radius / 3.141592653589793 * sin(Close) * w
m = Vector(Q, R)
liste1 = Sequence(Segment[If[i / Sides - Rotate < 0, A - i / Sides * 2 * radius * u, T'_1 - radius / 3.141592653589793 * cos(((i / Sides - Rotate) * 360)°) * w - radius / 3.141592653589793 * sin(((i / Sides - Rotate) * 360)°) * u], If[i / Sides - Rotate < 0, B - i / Sides * 2 * radius * u, T''_1 - radius / 3.141592653589793 * cos(((i / Sides - Rotate) * 360)°) * w - radius / 3.141592653589793 * sin(((i / Sides - Rotate) * 360)°) * u]], i, 0, Sides)
e = Segment(D, A)
E = Point(e)
t' = AffineRatio(A, D, E)
P = If(t' - Rotate < 0, E, T'_1 - radius / 3.141592653589793 * cos(((t' - Rotate) * 360)°) * w - radius / 3.141592653589793 * sin(((t' - Rotate) * 360)°) * u)
lieu1 = Locus(P, E)
P' = Translate(P, Vector[A, B])
lieu2 = Locus(P', E)
F = Midpoint(E, A)
f = Element(liste1, 1)
h_1 = Element(liste1, Sides + 1)
liste2 = Sequence(If[i / Sides - Rotate < 0, A - i / Sides * 2 * radius * u, T'_1 - radius / 3.141592653589793 * cos(((i / Sides - Rotate) * 360)°) * w - radius / 3.141592653589793 * sin(((i / Sides - Rotate) * 360)°) * u], i, 0, Sides)
liste3 = Sequence(If[i / Sides - Rotate < 0, B - i / Sides * 2 * radius * u, T''_1 - radius / 3.141592653589793 * cos(((i / Sides - Rotate) * 360)°) * w - radius / 3.141592653589793 * sin(((i / Sides - Rotate) * 360)°) * u], i, 0, Sides)
liste4 = Sequence(Polygon[Element[liste3, i], Element[liste3, i + 1], Element[liste2, i + 1], Element[liste2, i]], i, 0, Sides)
F' = Mirror(F, O)
liste6 = Sequence((x(R), y(R)) + radius / 3.141592653589793 * cos(0°) * cos(i°) * u + sin(0°) * cos(i°) * v + sin(i°) * m, i, 0, 360, 360 / Sides)
H = Midpoint(h_1)
T' = Mirror(T, H)
s = Conic(Element[liste6, 1], Element[liste6, 5], Element[liste6, 8], Element[liste6, 12], Element[liste6, 15])
J' = Translate(J, Vector[-height * v])
K = Midpoint(J, G)
liste8 = Sequence(Polygon[Element[liste3, i], Element[liste3, i + 1], Element[liste2, i + 1], Element[liste2, i]], i, 0, Sides)
L = (-500, -500)
l = Segment(M, N)
liste5 = Sequence((x(U), y(U)) + radius / π * cos(0°) * cos(i° + h * ° / Sides) * u + sin(0) * cos(i° + h * ° / Sides) * v + sin(i° + h * ° / Sides) * z, i, 0, 360, 360 / Sides)
t = Segment(B, I)
S = Midpoint(t)
liste7 = Sequence(Segment[Element[liste5, i], Element[liste5, i + 1]], i, 1, Sides + 1)
ll = Vector(B, I)
liste9 = Sequence((x(I), y(I)) + radius / π * cos(0°) * cos(i° + h * ° / Sides) * u - sin(0) * cos(i° + h * ° / Sides) * v + sin(i° + h * ° / Sides) * ll, i, 0, 360, 360 / Sides)
poly1 = Polygon(liste5)
poly2 = Polygon(liste9)
i = Segment(I, U)
liste10 = Sequence(Segment[Element[liste3, i], Element[liste3, i + 1]], i, 0, Sides)
liste11 = Sequence(Segment[Element[liste2, i + 1], Element[liste2, i]], i, 0, Sides)
liste12 = Sequence(Segment[Element[liste9, i], Element[liste9, i + 1]], i, 1, Sides + 1)
liste13 = Sequence(Polygon[Element[liste3, i], Element[liste3, i + 1], Element[liste2, i + 1], Element[liste2, i]], i, 0, Sides)
AA: View3D + (1000, 0)
BB: View3D + (1000, 1000)
CC: View3D + (0, 1000)
poly3, view3d, aa_1, bb, cc = Polygon(View3D, AA, BB, CC)