I am trying to graph various vectors of a $3\times3$ matrix to make a box by writing a function that takes in a $3\times3$ matrix and then plots the polygons created from it. Let the 3 column vectors be $\vec{A}$, $\vec{B}$, and $\vec{C}$, then for example one face of the box is given by the polygon
P1 = Polygon[O, A, A + B, B]
where O
is the origin. There are 5 additional polygons that make up the surface of the box; however, I can't figure out how to set up function correctly. Here is my code so far:
plotBox[{ {a_, b_, c_}, {d_, e_, f_ }, {g_, h_, i_} }] :=
P1 = Polygon[{{0, 0, 0}, {a, d, g}, {a + b, d + e, g + h}, {b, e,
h}}]
Graphics3D[{P1}]
Now if I call plotBox
and pass it a $3\times3$ matrix, it will simply output the Polygon
that was created. However, if I go to where I actually wrote the function and hit Shift+Enter, then it will Graphics3D
the plotBox
I entered in. What exactly am I doing wrong here?