nilo de roock
nilo de roock

Reputation: 4157

Question about the RotationTransform function in Mathematica

Background:

  a = 0; b = 0; c = 0;
  Manipulate[Graphics3D[
    GeometricTransformation[
     {Cuboid[{0, 0, 0}, {1, 1, 1}]},
     {RotationTransform[x, {1, 1, 0}, {a, b, c}]}], 
    ViewPoint -> Left], {x, 0, 2 \[Pi]}]

My question concerns RotationTransform with the following signature:

  RotationTransform[x, {1, 1, 0}, {a, b, c}]

The documentation says: "gives a 3D rotation around the axis w anchored at the point p", in the example above w={1,1,0} and p={a,b,c}.

To my surprise the rotation acts the same no matter what values I assign to (a,b,c). I assume that I don't understand the docs, made an error somewhere. I would have expected at least a different rotation for different values of a,b,c. Changing the vector w behaves as expected.

Please explain the purpose of p.

Upvotes: 6

Views: 556

Answers (2)

Nasser
Nasser

Reputation: 13141

May be this will make it clear. It does have an effect. I show the anchor point, and the axis.

Manipulate[
  Module[{w={1,0,0},p={-2,2}},
    Graphics3D[
    {
       {Opacity->.4,GeometricTransformation[
         {Cuboid[{0,0,0}]},RotationTransform[angle,w,{a,b,c}]]
        },

       {Blue,PointSize[0.05],Point[{a,b,c}]},
       {Red,Thick,Line[{{a,b,c},{a,b,c}+w}]}
    },

    ImageSize->300,
    ImagePadding->2,AxesOrigin->{0,0,0},
    ImageMargins->2,ViewAngle->All,
    Axes->True,
    Ticks->None,
    PlotRange->{p,p,p}
    ]
  ],

  {angle,0,2 \[Pi],ImageSize->Tiny},
  {{a,0,"a"},0,1,.1,Appearance->"Labeled",ImageSize->Tiny},
  {{b,0,"b"},0,1,.1,Appearance->"Labeled",ImageSize->Tiny},
  {{c,0,"c"},0,1,.1,Appearance->"Labeled",ImageSize->Tiny},

   ControlPlacement->Left
]

enter image description here

Upvotes: 4

Dr. belisarius
Dr. belisarius

Reputation: 61056

Consider the following example from the help:

gr={Cuboid[],AbsolutePointSize[10],Opacity[1],{Magenta,Point[{0,0,0}]},   
   {Green,Point[{1,1,1}]}};

p = {1,1,1};
Graphics3D[{{Opacity[.35], Blue, gr}, 
  GeometricTransformation[{Opacity[.85], Red, gr}, 
   RotationTransform[Pi/6, {0, 0, 1}, p]]}, Boxed -> False]

enter image description here

And now with :

p={1,0,0};

enter image description here

Upvotes: 6

Related Questions