AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
shear (Number shx, Number shy) typedict.Matrix
 
Changes this matrix so that x-coordinates of points are shifted horizontally by an amount that depends on their distance from the y-axis, and y-coordinates of points are shifted vertically by an amount that depends on their distance from the x-axis, and returns this matrix to the caller. The mathematical description of shear says it transforms the point
(x, y)
into
(x + shx*y, y + shy*x)
which means the new and old matrices map
(1, 1)
and
(1 + shx, 1 + shy)
into the same point.
 
 Example:   The program,
import yoix.*.*;

JFrame f = {
    paint(Rectangle rect) {
        graphics {            // "named block"
            gsave();
            translate(144, 144);
            shear(0, .5);
            arc(0, 0, 72, 0, 180);
            setrgbcolor(0, 0, 1);
            fill();
            moveto(0, 0);
            lineto(72*3, 0);
            moveto(0, 0);
            lineto(0, 72*3);
            setrgbcolor(1, 0, 0);
            stroke();
            grestore();
        }
    }
};

f.visible = TRUE;
defines a paint function in a frame that applies a sharing transformation, fills a half circle centered at the origin with blue, and then draws short line segments in red that represent the positive x and y axes.
 
 Return:   Matrix
 
 See Also:   concat, concatmatrix, currentmatrix, dividematrix, dtransform, Graphics, identmatrix, idtransform, initmatrix, invertmatrix, itransform, maptopixel, rotate, scale, setmatrix, transform, translate

 

Yoix is a registered trademark of AT&T Inc.