Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- frame[t_] :=
- Block[{\[Theta], \[Alpha], \[Beta], dy, ey, ez},
- ez = {1/2, -(1/2), 1/Sqrt[2]};
- \[Theta] = 0;
- \[Alpha] = 0;
- \[Beta] = 0;
- dy = 1;
- If[t < 0.5,
- If[t < 0.25,
- \[Alpha] = Pi t;
- ,
- \[Alpha] = Pi/4;
- \[Beta] = (t - 0.25) Pi;
- ]
- ,
- If[t < 0.75,
- dy = 1 - 4 (t - 0.5);,
- \[Theta] = 4 Pi (t - 0.75);
- dy = 0;
- ]
- \[Alpha] = Pi/4; \[Beta] = Pi/4;
- ];
- ey = RotationMatrix[\[Beta], (RotationMatrix[\[Alpha], {0, 0,
- 1}].{1, 0, 0})].(RotationMatrix[\[Alpha], {0, 0, 1}].{0, 1,
- 0});
- Show[
- Graphics3D[{
- Gray,
- Cylinder[{{0, 0, 0} + 3 ez dy, ey/10 + 3 ez dy}, 1]}
- , PlotRange -> {{-1, 3}, {-4, 1}, {-1, 4}},
- ViewPoint -> {5, 5, 2}],
- If[t < 0.75,
- RegionPlot3D[(x^2 + z^2 <= 0.1), {x, -1, 3}, {y, -4, 1}, {z, -1,
- 4}, NormalsFunction -> None, Mesh -> None, PlotStyle -> Orange,
- PlotPoints -> 30]
- ,
- {RegionPlot3D[(x^2 + z^2 <= 0.1) && ey.{x, y, z} < 0, {x, -1,
- 3}, {y, -4, 1}, {z, -1, 4}, NormalsFunction -> None,
- Mesh -> None, PlotStyle -> Orange, PlotPoints -> 30],
- RegionPlot3D[(xt^2 + zt^2 <= 0.1 &&
- ey.{xt, yt, zt} > 0) /. {xt -> rot[\[Theta], x, y, z][[1]],
- yt -> rot[\[Theta], x, y, z][[2]],
- zt -> rot[\[Theta], x, y, z][[3]]}, {x, -1, 3}, {y, -4,
- 1}, {z, -1, 4}, NormalsFunction -> None, Mesh -> None,
- PlotStyle -> Orange, PlotPoints -> 30]
- }
- ]
- ]
- ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement