Exploring Analyic Geometry with Mathematica®

Home Contents Commands Packages Explorations Reference
Tour Lines Circles Conics Analysis Tangents

Transformations

Translations
Rotations
Scaling
Reflections
Explorations

A transformation is a mathematical operation that changes a function of variables, say f(x,y), into a new function f'(x',y') where

"trans_1.gif"

These equations are called the equations of the transformation. Transformations can often be constructed so that f' is much simpler than f. In this chapter we will study four transformations that have useful geometric interpretations: translation, rotation, scaling and reflection.

Initialize

To initialize Descarta2D, select the input cell bracket and press SHIFT-Enter.

This initialization assumes that the Descarta2D software has been copied into one of the standard directories for AddOns which are on the Mathematica search path, $Path.

<<Descarta2D`

Translations [Top]

A translation is a transformation that maps coordinates (x,y) into

(x+u,y+v).

When a translation is applied to a locus of points, the resulting locus has the same shape and orientation as the original one, but its position with respect to the coordinate axes is offset by distances u in the x-direction and v in the y-direction. The equations of the transformation are

x'=x+u   and   y'=y+v.

Example: Determine the coordinates of the point that results from translating (3,2) by u=-1 and v=-3.

Solution: The function Translate2D[{x,y},{u,v}] translates a coordinate list (x,y) by the specified offset (u,v), returning a new coordinate list. The function Translate2D[point,{u,v}] performs the same translation and returns a translated point.

{Translate2D[{3,2},{-1,-3}],
Translate2D[Point2D[{3,2}],{-1,-3}]}

"trans_2.gif"

A translation can also be applied to an equation. For example, if

f(x,y)=Ax+By+C

is a linear equation in two variables, we can translate this by making the substitutions x=x'-u and y=y'-v. Mathematica provides powerful functions for performing these transformations.

Clear[x,y,u,v,a,b,c];
a*x+b*y+c /. {x->x-u,y->y-v} //Expand

"trans_3.gif"

In standard mathematical notation the translated equation is

Ax+By-Au-Bv+C.

Mathematica Hint: The Mathematica function Replace, represented by the /. operator, applies a set of replacement rules to an expression.

In a similar manner a quadratic equation can be translated. Again Mathematica provides a convenient means for performing the algebraic operations.

Clear[x,y,u,v,a,b,c,d,e,f];
a*x^2+b*x*y+c*y^2+d*x+e*y+f /.
   {x->x-u,y->y-v} //Expand

"trans_4.gif"

Collecting terms and writing in standard mathematical notation yields the translated quadratic equation

"trans_5.gif"

where

A' = A
B' = B
C' = C
D' = D-2Au-Bv
E' = E-2Cv-Bu
F' = "trans_6.gif"

Using these basic formulas for translations it is easy to translate other objects. The location of curves, such as circles, ellipses and conic arcs, are defined by points and can be translated by translating the points themselves. For example, Ellipse2D[{h,k},a,b,θ] is translated to Ellipse2D[{h+u,k+v},a,b,θ].

Example: Translate the ellipse

"trans_7.gif"

by the offsets u=2 and v=-2. Plot both the original ellipse and the translated ellipse.

Solution: The function Translate2D[object,{u,v}] translates an object u in the x-direction and v in the y-direction. The object may be a coordinate list, a geometric object or a list of Descarta2D objects.

e2=Translate2D[e1=Ellipse2D[{1,-3},4,3,0],{2,-2}]

"trans_8.gif"

Sketch2D[{e1,e2}]

"trans_9.gif"

Rotations [Top]

"trans_10.gif"

Rotation transformation.

A rotation by an angle θ about the origin is a transformation that maps coordinates (x,y) into (xcosθ-ysinθ,ycosθ+xsinθ). The mapping is easily confirmed using trigonometry as shown in Figure [trans:fig02].

cosα = x/r
sinα = y/r
x' = OA'
. = rcos(α+θ)
. = r(cosαcosθ-sinαsinθ)
. = r((x/r)cosθ-(y/r)sinθ)
. = xcosθ-ysinθ.

Similarly, it can be shown that y'=ycosθ+xsinθ.

In order to rotate about a point (h,k), we first translate the coordinates to the origin, perform the rotation using the equations above, then apply the inverse translation to restore the object to its original position with the rotation applied. The general equations of a rotation so derived are

x' = h+(x-h)cosθ-(y-k)sinθ
y' = k+(x-h)sinθ+(y-k)cosθ.

In order to rotate a linear equation Ax+By+C=0 we need to solve these equations for x and y so that we can substitute these values into the equation. Solving for x and y in terms of x' and y' (and making use of the identity "trans_11.gif") yields the equations

x = h+(x'-h)cosθ+(y'-k)sinθ
y = k-(x'-h)sinθ+(y'-k)cosθ.

Substituting into Ax+By+C yields the equation

A'x+B'x+C'=0

where

A' = Acosθ-Bsinθ
B' = Bcosθ+Asinθ
C' = Ah+Bk+C-(Ah+Bk)cosθ-(Ak-Bh)sinθ.

Rotating the quadratic equation "trans_12.gif" is accomplished in the same manner, by replacing x and y with the proper rotated coordinates. The resulting expressions for the coefficients of the rotated quadratic equation,

"trans_13.gif"

are somewhat long, but can be written symbolically as

A' = "trans_14.gif"
B' = "trans_15.gif"
C' = "trans_16.gif"
D' = "trans_17.gif"
. . 2(Bh-(A-C)k)cosθsinθ+
. . (2Ah+Bk+D)cosθ-(Bh+2Ck+E)sinθ
E' = "trans_18.gif"
. . 2((A-C)h+Bk)cosθsinθ+
. . (Bh+2Ck+E)cosθ+(2Ah+Bk+D)sinθ
F' = "trans_19.gif"
. . "trans_20.gif"
. . "trans_21.gif"
. . "trans_22.gif"
. . "trans_23.gif"
. . "trans_24.gif"

By applying the formulas for rotating coordinates, linear equations and quadratic equations, we can now specify how to rotate all of the Descarta2D objects. Points and lines can be rotated by directly applying the formulas for coordinates and linear equations, respectively. Curves that are located by points can be rotated by rotating the defining points; additionally, curves that have orientation angles, such as arcs, parabolas, ellipses and hyperbolas, are rotated by adding the rotation angle, θ, to the angle of the curve.

Example: Rotate the ellipse

"trans_25.gif"

π/2 radians about its center point and about the origin. Plot all three ellipses.

Solution: The Descarta2D function Rotate2D[object,θ,{"trans_26.gif","trans_27.gif"}] rotates an object by angle θ about point "trans_28.gif". The function Rotate2D[object,θ] rotates an object by angle θ about the origin. The object may be a coordinate list, a geometric object or a list of Descarta2D objects.

e1=Ellipse2D[{3,0},2,1,Pi/2];
{e2=Rotate2D[e1,Pi/2,{3,0}],e3=Rotate2D[e1,Pi/2]}

"trans_29.gif"

"trans_30.gif"

Sketch2D[{e1,e2,e3}]

"trans_31.gif"

Scaling [Top]

A scaling transformation maps coordinates (x,y) to (x',y') using the transformation equations

x'=h+s(x-h)   and   y'=k+s(y-k).

The scale factor, s>0, indicates the ratio of corresponding lengths of the scaled object with respect to the original object. The point (h,k) is called the center of scaling. A point at the center of scaling does not change coordinates during a scaling transformation.

Solving the scaling transformation equations for (x,y) in terms of (x',y') yields

"trans_32.gif"

Substituting the coordinates (x,y) into the linear polynomial Ax+By+C yields the scaled linear polynomial

Ax+By+Ah(s-1)+Bk(s-1)+sC.

Similarly, applying a scaling transformation to the quadratic polynomial

"trans_33.gif"

yields

"trans_34.gif"

where

A' = "trans_35.gif"
B' = "trans_36.gif"
C' = "trans_37.gif"
D' = (D+(1-s)(2Ah+Bk))/s
E' = (E+(1-s)(Bh+2Ck))/s
F' = "trans_38.gif"

The scaling transformation may be applied to Descarta2D geometric objects by applying the coordinate scaling transformation to the positioning arguments and simultaneously multiplying the length arguments by the scale factor.

Example: Scale the circle "trans_39.gif" by a factor of 3/2 about its center point and the origin. Plot the three circles.

Solution: The function Scale2D[object,s,{h,k}] scales the object using scale factor s about the center of scaling (h,k). Scale2D[object,s] scales the object about the origin. The object may be a coordinate list, a geometric object or a list of Descarta2D objects.

c1=Circle2D[{2,1},1];
{c2=Scale2D[c1,3/2,{2,1}],c3=Scale2D[c1,3/2]}

"trans_40.gif"

Sketch2D[{c1,c2,c3}]

"trans_41.gif"

Reflections [Top]

A reflection transformation maps the coordinates (x,y) to coordinates that are the "mirror" reflection of the coordinates with respect to a line that represents the position of the mirror. Consider the point "trans_42.gif" and the reflection line "trans_43.gif". The following Descarta2D commands can be used to determine the coordinates of the reflection of point "trans_44.gif" in line "trans_45.gif".

Clear[x1,y1,A2,B2,C2];
p1=Point2D[{x1,y1}];
l2=Line2D[A2,B2,C2];
p2=Point2D[p1,Point2D[p1,l2],
           2*Distance2D[p1,l2]] //Simplify

"trans_46.gif"

In standard mathematical notation the coordinates "trans_47.gif" of the reflected point are given by the transformation equations

"trans_48.gif" = "trans_49.gif"
"trans_50.gif" = "trans_51.gif"

Solving the transformation equations for "trans_52.gif" in terms of "trans_53.gif" yields

"trans_54.gif" = "trans_55.gif"
"trans_56.gif" = "trans_57.gif"

Mathematica Hint: While it is feasible to solve these equations manually using algebra, it is much less effort to let Mathematica do the work using the Solve function. The command would be of the form

Solve[{x2==XCoordinate2D[p2],
       y2==YCoordinate2D[p2]},{x1,y1}] //Simplify

"trans_58.gif"

Substituting the coordinates "trans_59.gif" into a linear equation "trans_60.gif" yields the reflected linear equation

"trans_61.gif"

where

"trans_62.gif" = "trans_63.gif"
"trans_64.gif" = "trans_65.gif"
"trans_66.gif" = "trans_67.gif"

Substituting the coordinates "trans_68.gif" into a quadratic polynomial

"trans_69.gif"

yields a quadratic Q' reflected in the line "trans_70.gif" of the form

"trans_71.gif"

where

A' = "trans_72.gif"
B' = "trans_73.gif"
C' = "trans_74.gif"
D' = "trans_75.gif"
E' = "trans_76.gif"
F' = "trans_77.gif"

and

"trans_78.gif" "trans_79.gif" "trans_80.gif"

"trans_81.gif" . "trans_82.gif"
"trans_83.gif" . "trans_84.gif"

Reflection of an Angle

"trans_85.gif"

A reflected angle.

What angle does a reflected line make with the +x-axis? Let L be a line that makes an angle θ with the +x-axis, "trans_86.gif" be a reflection line that makes an angle α with the +x-axis, and L' the reflection of L in "trans_87.gif" as shown in Figure [trans:fig05]. We wish to determine the angle θ' that L' makes with the +x-axis. Using the fact that supplementary angles sum to π and that the interior angles of a triangle sum to π, the angle θ'=2α-θ. The relationship also holds true when α=θ, in which case L and L' do not intersect. By applying the methods for reflecting coordinates, equations and angles we are able to reflects all of the geometric objects in the Descarta2D system.

Example: Reflect the arc centered at (3,2) with radius 1 and start and end angles of π and 3π/2 in the line x+3y+2=0.

Solution: The Descarta2D function Reflect2D[object,line] reflects the object with respect to the line. The object may be a coordinate list, a geometric object, or a list of objects.

a2=Reflect2D[a1=Arc2D[Point2D[{3,2}],2,{Pi,3Pi/2}],
             l1=Line2D[1,3,2]]

"trans_88.gif"

Sketch2D[{a1,l1,a2}]

"trans_89.gif"

Explorations [Top]

Reflection in a Point. [reflctpt.html]

A point P'(x',y') is said to be the reflection of a point P(x,y) in the point C(H,K) if C is the midpoint of the segment PP'. Using this definition show that

• The transformation equations for a reflection in a point are

x'=2H-x    x=2H-x'
y'=2K-y    y=2K-y'.

• The reflection of the line ax+by+c=0 in the point (H,K) is

ax+by-(2aH+2bK+c)=0.

• The reflection of the quadratic "trans_90.gif" in the point (H,K) is

. "trans_91.gif" .
. "trans_92.gif" .

Also, verify that the reflection in a point transformation is equivalent to a rotation of π radians about the reflection point (H,K).

Inversion. [inverse.html]

A point P'(x',y') is said to be the inverse of a point P(x,y) in the circle

"trans_93.gif"

if points O(h,k), P and P' are collinear and "trans_94.gif". Using this definition show that

• The coordinates of P'(x',y') are

"trans_95.gif"

• If the circle of inversion is "trans_96.gif", the coordinates of P' are

"trans_97.gif"

• If the circle of inversion is "trans_98.gif", the inverse of the line "trans_99.gif", assuming L does not pass through the origin, is the circle

"trans_100.gif"

• If the circle of inversion is "trans_101.gif", the inverse of the line "trans_102.gif", assuming L passes through the origin ("trans_103.gif"), is L itself.

• If the circle of inversion is "trans_104.gif", the inverse of the circle "trans_105.gif" is

"trans_106.gif"

• If the circle of inversion is "trans_107.gif", the inversion of "trans_108.gif", which passes through the origin, is the line "trans_109.gif". L is parallel to the tangent line to C through the origin. The equation of the tangent line is "trans_110.gif".

Inversion is clearly a non-rigid transformation.


Copyright © 1999-2007 Donald L. Vossler, Descarta2D Publishing
www.Descarta2D.com