In computer graphics, shear transformation skews an object in a particular direction, distorting its shape. The shear transformation can be expressed using matrices. This is commonly applied to 2D or 3D transformations.
The following screen recording shows my exploration of Shearing in freeCAD.
Here's the python script of this application...
1. Shear Transformation in 2D
A shear transformation in 2D modifies the coordinates of a point by adding a scaled version of one coordinate to the other.
General Formula
Where:
- : Shear factor along the x-axis.
- : Shear factor along the y-axis.
Expanded Form
Special Cases
-
Shearing along x-axis:
x ′ = x + s h x ⋅ y x' = x + sh_x \cdot y - (unchanged)
-
Shearing along y-axis:
- (unchanged)
y ′ = y + s h y ⋅ x y' = y + sh_y \cdot x
2. Shear Transformation in 3D
In 3D graphics, shear transformation skews the object along any combination of the x, y, or z axes.
General Matrix
Where:
- : Shear in x-direction based on y.
- : Shear in x-direction based on z.
- : Shear in y-direction based on x, and so on.
Expanded Form
3. Explanation
Shear as a Transformation
- Geometrical Meaning: A shear transformation skews the shape of an object such that it retains its parallelism (e.g., rectangles become parallelograms).
- Affine Transformation: Shearing is a linear affine transformation because it preserves straight lines and parallelism but not angles or lengths.
Practical Use
- In computer graphics, shear is used for:
- Simulating motion (e.g., objects sliding or skewing).
- Perspective effects.
- Artistic transformations.
Homogeneous Coordinates
In homogeneous coordinates (used for combining multiple transformations like scaling, rotation, and translation), shear transformation for 2D is represented as:
For 3D:
These homogeneous matrices allow shear to be combined with other transformations in a single matrix multiplication.
4. Example
2D Shear Along x-axis
Given:
And a point :
Result: , indicating the point was sheared horizontally.
No comments:
Post a Comment