Shearing

Shearing is a type of transformation wherein the points on the XY plane, the YZ plane, the XZ plane, and on other planes are fixed, and the other points are moved in parallel to the axis. This is expressed by the following transformational matrix. (In other words, shearing is a transformation in which the points on any coordinate matrix are fixed in relation to eachother and to the axes of the matrix, but the angle between the axes themselves is shifted from 90 degrees. The result is something like what happens to a figure drawn on a square rubber sheet which is then stretched along the diagonal.)

        fig210.gif

As an example, take a three-dimensional "N" shape, matching the farthest point on its bottom left edge with the coordinate system's point of origin and defining the nearest point on the upper right edge as point P. The coordinates of P, i.e. (1.0, 2.0, 2.0) will represent the size of the character "N". The X, Y, and Z axes will be shown in the respective colors of red, green, and blue.

fig080.gif
        | characterN pointP xyzAxes compoundObject |
        characterN := JunOpenGL3dObject characterN.
        characterN paint: ColorValue magenta.
        characterN := characterN translatedBy: characterN boundingBox corner.
        pointP := JunOpenGL3dObject cube.
        pointP := pointP scaledBy: 0.1.
        pointP := pointP translatedBy: characterN boundingBox corner.
        xyzAxes := JunOpenGL3dObject axes.
        xyzAxes := xyzAxes scaledBy: 3.5.
        compoundObject := JunOpenGL3dCompoundObject new.
        compoundObject add: characterN.
        compoundObject add: xyzAxes.
        compoundObject add: pointP.
        compoundObject show.
        Transcript cr; show: pointP boundingBox center printString

Let us pull the "N" towards the Y axis to give it a slight tilt. Use the message fromArray: to generate the transformational matrix from the array. The order of elements in the specified array corresponds to the transformational matrix elements a, b, c, p, d, e, f, q, g, h, i, r, l, m, n, and s. The coordinates of P become (1.0, 3.0, 2.0).

fig220.gif
        | characterN pointP aTransformation xyzAxes compoundObject |
        characterN := JunOpenGL3dObject characterN.
        characterN paint: ColorValue magenta.
        characterN := characterN translatedBy: characterN boundingBox corner.
        pointP := JunOpenGL3dObject cube.
        pointP := pointP scaledBy: 0.1.
        pointP := pointP translatedBy: characterN boundingBox corner.
        aTransformation := Jun3dTransformation fromArray: #(1 0 0 0 0 1 0 0 0 0.5 1 0 0 0 0 1).
        characterN := characterN transform: aTransformation.
        pointP := pointP transform: aTransformation.
        xyzAxes := JunOpenGL3dObject axes.
        xyzAxes := xyzAxes scaledBy: 3.5.
        compoundObject := JunOpenGL3dCompoundObject new.
        compoundObject add: characterN.
        compoundObject add: xyzAxes.
        compoundObject add: pointP.
        compoundObject show.
        Transcript cr; show: pointP boundingBox center printString

See also:


06 November 1997 / Author: AOKI Atsushi