# Is it possible to manipulate a graphics object with 3 rotation transforms simultaneously?

The code that I have written has an unintended consequence that I'm not sure how to get around. I want 3 rotation transforms to be applied simultaneously to 1 graphics object. Instead, I get 3 separate separate copies of the graphics object, one per transformation.

The documentation does state that this will be the outcome of using multiple transformations on a graphics object.

GeometricTransformation[g, {t1, t2, ...}]
represents multiple copies of g transformed by a collection of transformations.

My question is: how is it possible to achieve the the outcome that I described instead of getting multiple copies?

Here is the code I am executing:

Manipulate[
Graphics3D[{
EdgeForm[None],
GeometricTransformation[Cylinder[],
{RotationTransform[a Pi, {1, 0, 0}],
RotationTransform[b Pi, {0, 1, 0}],
RotationTransform[c Pi, {0, 0, 1}]}]}],
{{a, 0}, -1, 1},
{{b, 0}, -1, 1},
{{c, 0}, -1, 1},
SaveDefinitions -> True]


If anyone could show me a way to accomplish this, I'd appreciate it.

-

RotationTransform[a Pi, {1, 0, 0}] is nothing more than a matrix, so you can compose/combine such functions using matrix multiplication. For example:

Graphics3D[{EdgeForm[None],
GeometricTransformation[Cylinder[],
RotationTransform[.5 Pi, {1, 0, 0}].RotationTransform[0.2 Pi, {0, 1, 0}].RotationTransform[0.1 Pi, {0, 1, 0}]]}]


In the above code the dot . stands for matrix multiplication, which applies the various transformations in sequence.

-
Interesting. Strictly speaking, a transform is a TransformationFunction of a matrix, and I had always used TransformationMatrix to get the matrix to work with. The manual does not seem to include your usage of Dot. Is it documented or did you just happen on it some way? –  Michael E2 Oct 9 '13 at 10:22
This is very insightful! Makes a lot of sense now. Thank you! –  Zer0 Oct 9 '13 at 12:26
@Michael E2 You are correct in that these are TransformationFunctions (and not, strictly speaking, the matrices themselves). For example, Dot does not work in all cases: you cannot take the product of a RotationMatrix and a vector. I don't recall when I first saw this. –  bill s Oct 9 '13 at 13:18
Manipulate[Graphics3D[{EdgeForm[None],
GeometricTransformation[Cylinder[],
Composition[
RotationTransform[a Pi, {1, 0, 0}],
RotationTransform[b Pi, {0, 1, 0}],
RotationTransform[c Pi, {0, 1, 0}]]]}],
{{a, 0}, -1, 1}, {{b, 0}, -1, 1}, {{c, 0}, -1, 1},
SaveDefinitions -> True]


(I'm not sure which order you want, and whether the c rotation is meant to be about the y-axis as in the OP's code.)

-
This is perfect! Thanks! And yeah, the c rotation was meant to be about the z-axis {0,0,1}, that was just a mistake. Of course, rotation about the z-axis for a cylinder does absolutely nothing because of symmetry, but I will use this transformation for a number of different objects. Thanks again. –  Zer0 Oct 9 '13 at 12:25