I've written a program that calculates the rotation matrices of a cube over time. The program outputs the matrices to a data file in the form of a series of Mathematica styled matrices (i.e. {{a11,a12,a13},...}}). They are separated by line breaks.

Here is my plan:

~Write a function that associates each matrix to some time t, sequentially.

~Write a function that multiplies a cube with center at origin by the current matrix in accordance with t.

~Write a final function that take output from the previous and visualizes it with a nice 'play' button.

This is my plan, but I'm not sure how to implement it -- I'm pretty new to Mathematica. I took a nice little tutorial, but it didn't cover quite something like this. I could use some help figuring this one out!

Thank you!

  • 2
    $\begingroup$ A simple example would be helpful. Don't post the entire data, but include a couple of time-slices, ideally with a smaller number of data points if the slices are actually huge. In addition, provide data for the cube (again ideally a small example). $\endgroup$
    – march
    Jan 27, 2017 at 19:29
  • $\begingroup$ One important detail is missing from the Q: are the times equally spaced? I just assumed they are in order to give an answer that could get you started. If not, interpolation may be an option. $\endgroup$
    – Jens
    Jan 27, 2017 at 19:47
  • 1
    $\begingroup$ Storing rotations as full matrices isn't very efficient... why not store just x? Anyway, you just have to replace matrixList in my answer by your list. $\endgroup$
    – Jens
    Jan 27, 2017 at 19:51
  • 1
    $\begingroup$ @Jens, at least the matrices are of certain structure here; at worst, one will still only need to store axis+angle… $\endgroup$ Jan 27, 2017 at 19:59
  • 1
    $\begingroup$ If you want to reduce the matrices to the axis-angle information for more efficient storage, you may want to look at my answer here. $\endgroup$
    – Jens
    Jan 27, 2017 at 22:30

1 Answer 1


I am guessing you're looking for something like this:

matrixList = 
  Table[EulerMatrix[{0, Pi t/2, 0}], {t, 0, 1, .1}];

frames = Table[
    GeometricTransformation[Cuboid[{-1, -1, -1}, {1, 1, 1}], 
     rotation], Boxed -> False, Lighting -> "Neutral", 
    PlotRange -> 1.5 {{-1, 1}, {-1, 1}, {-1, 1}}], {rotation, 

  • $\begingroup$ …and the OP can use RollPitchYawMatrix[] instead if he so wishes… $\endgroup$ Jan 27, 2017 at 19:34
  • $\begingroup$ @J.M. Or solve Euler's equations etc... I assumed the matrices already exist. $\endgroup$
    – Jens
    Jan 27, 2017 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.