Wolfram: Apply Transform to Graphics
Apply Geometric Transform to Graphics
GeometricTransformation[graPrims, f]-
Apply f to graPrims.
graPrims is a Graphics Primitive or a list of. It cannot be
GraphicsorGraphics3D.- f is a transformation function.
- It is typically
TransformationFunction[data]. [see Geometric Transformation Functions] - It can be a Transformation Matrix.
- It can have the form
{matrix, vector}, where the vector is used for translation.
GeometricTransformation[angs]return itself unchanged. It display effect when it is insideGraphicsorGraphics3D. GeometricTransformation[graPrims, listOfTransforms]-
do copy of multiple transformations.
Example: Basic
(* GeometricTransformation first arg should be graphics primitive or list of *) GeometricTransformation[ {Circle[], Rectangle[{0, 0}]} , RotationTransform[ 10 Degree ] ] (* result is itself, unchanged. *) (* has effect when it in inside Graphics or Graph3D *) Graphics[ GeometricTransformation[ {Circle[], Rectangle[{0, 0}]} , RotationTransform[ 10 Degree ] ], Axes -> True]
Example: Using a Matrix
(* rotate a rectangle *) Graphics[ GeometricTransformation[ {Rectangle[{0, 0}]} , RotationMatrix[ 10 Degree ] ], Axes -> True ]
Example: Using a Matrix and a Vector
(* transform by a matrix, and translate by a vector *) Graphics[ GeometricTransformation[ {Rectangle[{0, 0}]} , {RotationMatrix[ 10 Degree ], {1,1}} ], Axes -> True ]
Example: Error on Graphics or Graphics3D
(* if GeometricTransformation's args is Graphics[...], no transform is done. *) result = GeometricTransformation[ Graphics[{Rectangle[{0, 0}]}], RotationTransform[ 10 Degree ] ] (* if you show result inside Graphics[...], it's an error. *) Show[ result ]