public class Shear extends Transformation
| Constructor and Description |
|---|
Shear(String name,
double h)
Create a shear transformation given a name and the shear factor
h. |
| Modifier and Type | Method and Description |
|---|---|
Point2D |
apply(Point2D p)
Apply the shear to a point to produce a new point leaving the
original point unchanged.
|
String |
toString()
Get a string representation of the shear.
|
void |
transform(Point2D p)
Transform a point changing its coordinates.
|
getNamepublic Shear(String name, double h)
h.name - the name of the transformationh - the shear factorpublic void transform(Point2D p)
h the x and y
coordinates of the point are transformed as follows:
x = x + h * y
y = y (i.e., the y coordinate is unchanged)
transform in class TransformationTransformation.transform(cse1030.drawing.Point2D)p - the point to transformpublic Point2D apply(Point2D p)
apply in class Transformationtransform(cse1030.drawing.Point2D),
Transformation.apply(cse1030.drawing.Point2D)p - the point to apply the transformation toppublic String toString()
" : shear of factor "
followed by the shear factor. For example, a shear of factor 1.876435632 named
T1 has the following string representation:
"T1 : shear of factor 1.876435632"
toString in class TransformationTransformation.toString()