I'm new to Mathematica, and I'm trying to figure out how to visualise a rotated cuboid as an output of its rotation matrix and original dimensions using Graphics3D
. I am aware this is quite a rudimentary question, but I somehow cannot figure it out despite hours of trying out codes :(
So, simplistically, I have a cuboid, and I apply a rotation transformation function on it, so I write my code as such:
OriginalCuboid = {{x1,y1,z1},{x2,y2,z2}}
RotationMatrixforCuboid = RotationTransform[θ,{1,0,0},{0,0,0}]
RotatedCuboid = RotationMatrixforCuboid[OriginalCuboid]
Mathematica gives an output of "RotatedCuboid
" in the form of a Parallelepiped
, like so:
Parallelepiped[{point,vector1,vector2,vector3}]
I'm already a little confused because shouldn't it be returning the expression for a cuboid? But sure, I'll take it. So now I want to visualise this using Graphics3D
. But for some reason, when using this syntax:
Manipulate[Graphics3D[Opacity[0.5, Red], EdgeForm[Black],{*Insert shape here*}, Axes->True, AxesLabel->{"X", "Y", "Z"}, PlotRange->{{-20,20},{-20,20},{-20,20}}],{{θ,0, "θ rotation"},0,360,1}]
there was an error when I tried to plug "RotatedCuboid
" into {Insert shape here} of the code above. There's also an error when I tried to give the Parallelepiped
output expression a placeholder name, like such:
RotatedParallelepiped=*whatever, the output of the parallelepiped expression, was*
This is the error:
Coordinate {*whatever my coordinate is* should be a triple of numbers or a Scaled form.
It's driving me insane because the only thing working for me right now is manually copying and pasting the output expression for the Parallelepiped
. However, I have multiple Parallelepiped
in my actual code, and their expressions are extremely long and inefficient.
Could a kind soul please help me out? Feel free to ask any follow-up questions to clarify if there's anything I'm not clear about. Thank you in advance!
RotationMatrix
is Mathematica's function so it can not be used as a variable (you cannot assign any value to it). WhatRotationMatrixforCuboid
is? I do not see any definition of it in your code. $\endgroup$