Skip to main content
edited tags
Link
Michael E2
  • 258.7k
  • 21
  • 370
  • 830
Source Link
Stratus
  • 3.1k
  • 13
  • 25

How to plot a cube using `ParametricPlot3D`?

I have this code that plots a cube rotating around the z axes. I'm using a table of points and Graphics3D to visualize the motion. Is there a way to plot it using ParametricPlot3D?

enter image description here

delta = 0.1; map[x_, theta_] := { x[[1]] Cos[theta] - x[[2]] Sin[theta], x[[2]] Cos[theta] + x[[1]] Sin[theta], x[[3]]} tab = Table[ map[{x, y, z}, 0], {x, 0, 1, delta}, {y, 0, 1, delta}, {z, 0, 1, delta}]; tab2 = Table[ map[{x, y, z}, Pi/6], {x, 0, 1, delta}, {y, 0, 1, delta}, {z, 0, 1, delta}]; gp1 = Graphics3D[{Pink, Table[Point[ Flatten[tab, 2][[i]]] , {i, 1, Length[Flatten[tab, 2]]}]}]; gp2 = Graphics3D[{Black, Table[Point[ Flatten[tab2, 2][[i]]] , {i, 1, Length[Flatten[tab2, 2]]}]}]; Show[gp1, gp2]