How to find the vertices of a regular tetrahedron? a dodecahedron?
I already get the coordinate of the tetrahedron, but i don't know how to rotate it just like the gif
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityHow to find the vertices of a regular tetrahedron? a dodecahedron?
I already get the coordinate of the tetrahedron, but i don't know how to rotate it just like the gif
tet = Tetrahedron[{{0, 0, 0}, {-(1/(2 Sqrt[3])), -(1/2), Sqrt[2/3]},
{-(1/(2 Sqrt[3])), 1/2, Sqrt[2/3]}, {1/Sqrt[3], 0, Sqrt[2/3]}}]
frames = Table[Graphics3D[
GeometricTransformation[{FaceForm[Opacity[.5, Blue], Opacity[.5, Yellow]], tet},
RotationTransform[t 2 Pi, {0, 0, 1}, {0, 0, 0}]],
Lighting -> "Neutral", Boxed -> False,
PlotRange -> {{-1, 1}, {-1, 1}, {0, 1}},
ViewPoint -> {3, 4, 1}], {t, -1, 1, .01}];
ListAnimate[frames]
To get some wobbling effect, you can use RotationTransform[t 2 Pi, {0, Abs[t]/5, 1}, {.1, .2, 0}]
and use PlotRange -> {{-1, 1}, {-1, 1}, {-.1, 1}} 1.2
:
Use Export["tets.gif", frames]
to create an animated GIF file.
You can create a table of ViewPoint frames. The graphics option Viewpoint is the point in space where objects are viewed. For example I can create the polygon using the code above and then a table of the graphics with the viewpoint circling around a circle of radius 2 in the x-y plane:
myAnimationFrames=Table[Show[myTetra,ViewPoint->
{Re[2Exp[I t]],Im[2 Exp[I t]],0},PlotRange->2],
{t,0,2 \[Pi],0.2}];
And then save it to a gif file:
myAnimationName = NotebookDirectory[] <>
"myAnimationFile.gif";
Export[myAnimationName, myAnimationFrames];