Message Boards Message Boards

0
|
2108 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Add a vector onto the specific column of TransformationFunction.

Posted 1 year ago

I've the following command:

In[7]:= RotationTransform[Pi,{1,0,0},{x,1/2,1/4}]

Out[7]= TransformationFunction[( \!\(\*
TagBox[GridBox[{
{"1", "0", "0", "0"},
{"0", 
RowBox[{"-", "1"}], "0", "1"},
{"0", "0", 
RowBox[{"-", "1"}], 
FractionBox["1", "2"]},
{"0", "0", "0", "1"}
},
AutoDelete->False,
GridBoxDividers->{"Columns" -> {{False}}, 
        "ColumnsIndexed" -> {-2 -> True}, "Rows" -> {{False}}, 
        "RowsIndexed" -> {-2 -> True}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}],
#& ]\) )]

And I want to add the vector {1/2,0,0} onto the first three rows of the last column, i.e., obtain the following form:

TransformationFunction[( \!\(\*
TagBox[GridBox[{
{"1", "0", "0", 
FractionBox["1", "2"]},
{"0", 
RowBox[{"-", "1"}], "0", "1"},
{"0", "0", 
RowBox[{"-", "1"}], 
FractionBox["1", "2"]},
{"0", "0", "0", "1"}
},
AutoDelete->False,
GridBoxDividers->{"Columns" -> {{False}}, 
        "ColumnsIndexed" -> {-2 -> True}, "Rows" -> {{False}}, 
        "RowsIndexed" -> {-2 -> True}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}],
#& ]\) )]

How can I achieve this aim?

Regards, Zhao

POSTED BY: Hongyi Zhao
2 Replies
Posted 1 year ago

Hi Henrik Schachner,

Thank you very much. It does the trick.

N.B.: I noticed another wonderful example, helpful to understand the RotationTransform function in Mathematica

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
]

Best, Zhao

POSTED BY: Hongyi Zhao

Zhao,

here is one way: Let g be your original transformation function,

g = RotationTransform[Pi, {1, 0, 0}, {x, 1/2, 1/4}]

then what you need is an additional translation by {1/2, 0, 0}:

TransformationFunction[TransformationMatrix[g].TransformationMatrix[TranslationTransform[{1/2, 0, 0}]]]
POSTED BY: Henrik Schachner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract