Transforms for Mirroring
Last updated
Last updated
The Processing Scale( float scaleX, float scaleY) can be used to create mirroring of shape forms. Processing reference: Scale
Increases or decreases the size of a shape by expanding and contracting vertices. Objects always scale from their relative origin to the coordinate system. Scale values are specified as decimal percentages.
For example, the function call scale( 2.0, 1.0 ) increases the dimension of a shape by 200% along the x-dimension, with no change along the y dimension.
The image above shows a set of stacked squares, relative to the canvas origin, shown as a red circle at (0,0). When scale(1.0,1.0) is applied, no change to the shape occurs. When scale( -1.0, 1.0) is applied, mirroring across the y-axis occurs, since scaling is only changed in the x dimension. Here, this image is shown mirrored in a quadrant called Region2.
When using any transform functions, it's important to isolate those transforms so they don't impact any subsequent code. Using pairs of pushMatrix(), popMatrix() functions calls can restrict the scale( ) transform's impact to shapes drawn between the pushMatrix(), popMatrix() pair.
The image below shows that we can create a complex asymmetric design using mirroring and recursion.