Node: Affine Transformations for Points, Next: Applying Transformations to Points, Previous: Modifying Points, Up: Point Reference
Transform rotate (const real x, [const real y = 0, [const real z = 0]]) | Function |
Transform rotate (const Point& p0, const Point& p1, [const real angle = 180]) | Function |
Transform rotate (const Path& p, [const real angle = 180]) | Function |
Each of these functions calls the corresponding version of
Transform::rotate() , and returns its
return value, namely, a Transform representing the rotation
only.
In the first version, taking three Point p0(1, 0, 2); p0.rotate(90); p0.show("p0:") -| p0: (1, 2, 0) Point p1(-1, 1, 1); p1.rotate(-90, 90, 90); p1.show("pt1:"); -| p1: (1, -1, -1)
Please note that rotations are not commutative operations. Nor are they
commutative with other transformations.
So, if you want to rotate a Point pt0(1, 1, 1); pt0.rotate(0, 45); pt0.rotate(45); pt0.show("pt0:"); -| pt0: (0, 1.70711, 0.292893) In the version taking two Point P(2, 0, 0); Point A; Point B(2, 2, 2); P.rotate(A, B, 180);
|
Transform scale (real x, [real y = 1, [real z = 1]]) | Function |
Calls transform.scale( x, y, z) and returns its
return value, namely, a Transform representing the scaling operation
only.
Scaling causes the x-coordinate of the Point p0(1, 0, 3); p0.scale(4); p0.show("p0:"); -| p0: (4, 0, 3) Point p1(-2, -1, -2); p1.scale(-2, -3, -4); p1.show("p1:"); -| p1: (4, 3, 8)
|
Transform shear (real xy, [real xz = 0, [real yx = 0, [real yz = 0, [real zx = 0, [real zy = 0]]]]]) | Function |
Calls transform.shear() with the same arguments
and returns its
return value, namely, a Transform representing the shearing operation
only.
Shearing modifies each coordinate of a x_1 == x_0 + \alpha y + \beta z y_1 == y_0 + \gamma x + \delta z z_1 == z_0 + \epsilon x + \zeta y [next figure]
demonstrates the effect of shearing the four
Point P0; Point P1(3); Point P2(3, 3); Point P3(0, 3); Rectangle r(p0, p1, p2, p3); r.draw(); r.shear(1.5); r.draw(black, "evenly");
|
Transform shift (real x, [real y = 0, [real z = 0]]) | Function |
Transform shift (const Point& p) | Function |
Each of these functions calls the corresponding version of
Transform::shift() on transform , and returns its return
value, namely, a Transform representing the shifting operation
only.
The p0(1, 2, 3); p0.shift(2, 3, 5); p0.show("p0:"); -| p0: (3, 5, 8) |
Transform shift_times (real x, [real y = 1, [real z = 1]]) | Function |
Transform shift_times (const Point& p) | Function |
Each of these functions calls the corresponding version of
Transform::shift_times() on transform and
returns its return value, namely the new value of transform .
Point P; P.drawdot(); P.shift(1, 1, 1); P.drawdot(); P.shift_times(2, 2, 2); P.drawdot(); P.shift_times(2, 2, 2); P.drawdot(); P.shift_times(2, 2, 2); P.drawdot();
|