WolframLang: Apply Transform to Graphics
Apply Geometric Transform to Graphics
use
GeometricTransformation
to apply a transformation function to
Graphics Primitives
GeometricTransformation[graPrims, f]
-
- applies f to graPrims.
- graPrims should be graphics primitives, not
Graphics
object.
- f is typically
TransformationFunction[data]
. WolframLang: Geometric Transformation Functions - It can be a
matrix
. - It can be a
{matrix, vector}
, where the vector is used for translation. WolframLang: Transformation Matrix
GeometricTransformation[angs]
return itself unchanged. It display effect when it is insideGraphics
orGraphics3D
.
GeometricTransformation[graPrims, listOfTransforms]
-
do multiple transforms.
Example: Basic
gp = {Circle[], Rectangle[{0, 0}]}; (* GeometricTransformation first arg should be graphics primitive or list of *) (* result is itself, unchanged. *) GeometricTransformation[ gp , ShearingTransform[Pi/4, {1, 0}, {0, 1}]] (* has effect when it in inside Graphics or Graph3D *) Graphics[ GeometricTransformation[ gp , ShearingTransform[Pi/4, {1, 0}, {0, 1}]], 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 If Not on Graphics Primitive
(* 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 ]
WolframLang, Graphics Programing
- WolframLang: Plot and Visualization
- WolframLang: Graphics Primitives
- WolframLang: Graphics Directives
- WolframLang: Extract Graphics from Plot
- WolframLang: Geometric Transformation Functions
- WolframLang: Compose Transformations
- WolframLang: Apply Transform to Graphics
- WolframLang: Translate Copy Graphics
- WolframLang: Transformation Matrix
- WolframLang: GraphicsComplex
- WolframLang: Mesh Region
- WolframLang: Graphics Misc
- WolframLang: Animation