Application Center - Maplesoft

Classroom Tips and Techniques: Spatial Transformations of a Triangle

You can switch back to the summary page by clicking here.

Classroom Tips and Techniques: Spatial Transformations of a Triangle

Robert J. Lopez
Emeritus Professor of Mathematics and Maple Fellow
Maplesoft

Introduction

This article is a response to a question about computing the exact translation and rotation(s) that bring two congruent  triangles in into coincidence.  Apparently, the question arises from an application where a rigid body is moved from an initial to a final position, with the object's motion tracked by the location of three of its points.

Never having made use of Maple's geom3d package, I thought there might be some commands in it that would be of use in implementing spatial rotations.  In fact, I was able to implement all the required calculations in this package, as we will show below.  However, we did assume that the initial separation of the congruent triangles was "small" enough to eliminate the need for a "flip."  Having cut out two paper triangles to manipulate, I noticed that if one is "opened" like the page of a book, then moved away from the other, returning the triangles to coincidence would require a reversal of the "flip" generated by the initial rotation induced by the "page-opening."  Detecting the need for this "flip" would have made the analysis much harder than warranted by the context from which the question came.  Readers are welcomed to tackle this more general problem.

Initializations

Preliminaries

First, we are going to generate three points in as vertices of a triangle, then give this triangle a small displacement to obtain the second congruent triangle.  Ultimately, we will deduce the translation and rotation(s) needed to return this second triangle to coincidence with the first.

Hence, we start with three points defined in the geom3d package via

Unfortunately, this package does not permit subscripted names, so each such name has been converted to the status of an "Atomic Identifier" via the Context Menu.

Next, we define the triangle as the triangle in whose vertices are

Along a directed line segment we will drag and twist to a new location, and call the resulting triangle . The two points and are formed via

Translation requires a directed line segment such as

and an axis of rotation such as

where taking the line along the segment means the rotation will be a simple "twist" during the translation.  The combination of translation and rotation then generates triangle via

where the angle of rotation is just a tenth of a radian.  Figure 1 shows triangle in red and triangle in blue and we imagine that is the initial state of the underlying object and is the terminal state.

Figure 1   Triangles (red) and (blue)

The underlying problem requires that we start with the coordinates of the vertices of triangles and .  Hence, we obtain

for the vertices of and

for the vertices of .  Perhaps it helps to write these latter in floating-point form, namely, as

Alternatively, if we respectively let and represent sine and cosine of via

then we can list the coordinates of the vertices of as

In either event, we need to express the coordinates of the vertices of as points in the geom3d package, a task we accomplish with

so that we now have as the vertices of triangle .  With this, we are now ready to present two different strategies for bringing triangle to coincidence with triangle .  Table 1 summarizes the notation used in the generation of triangles and .  Symbols displayed in blue in the leftmost column are "Atomic Identifiers."

 Symbol Symbol Type Symbol Definition points geom3d names of the vertices of triangle triangle geom3d name of triangle whose vertices are points geom3d names of two points defining the directed line segment and the line directed line segment geom3d name of directed line segment from to line geom3d name of line through and   Triangle is displaced along this line to form triangle triangle geom3d name of second triangle obtained by dragging and twisting along line Maple graphs graphs of and , respectively Maple lists lists of coordinates of vertices for triangles and , respectively points geom3d names for the vertices of triangle Table 1   Summary of symbols used in generating triangles and

Description of Two Alignment Methods

Both Method 1 and Method 2 bring triangle into coincidence with triangle by first translating so that vertex is coincident with vertex . This translation of triangle is called triangle

In Method 1 we then rotate so the edge joining vertices and is brought into coincidence with the corresponding edge in , namely, the edge joining vertices and . This newest triangle is called triangle . The vertex in is brought to in by rotating about the edge common to both and . The resulting triangle is called .  Of course, is now coincident with

In Method 2 we rotate triangle to make it coplanar with triangle .  In this orientation, what was triangle is called triangle . Finally, triangle is brought into coincidence with triangle by a rotation about an axis perpendicular to the common plane and through the common vertex.

Implementation of Method 1

Table 2 summarizes the three major (conceptual) steps of Method 1.  These are listed in the leftmost column.  The middle column summarizes the mathematical steps that must be implemented in order to execute the conceptual step.  Finally, the rightmost column lists the commands in the geom3d package that are used to implement the mathematical steps in the middle column.

 Conceptual Steps Mathematical Tasks for Each Step geom3d Commands Translate vertex to coincide with vertex 1. Find directed line segment connecting a pair of corresponding vertices. 2. Translate along this segment. 1. dsegment 2. translation Rotate so edge aligns with edge 3. Extract coordinates of vertices of translated triangle. These will be lists. 4. Convert these lists to geom3d points 5. Form lines between vertices of edges to be rotated into alignment. Get plane containing these edges, and get normal to this plane. 6. Compute angle between these edges. 7. Axis of the rotation is the normal to the plane of the two edges to be rotated into alignment. Express as geom3d line. 3. vertices 4. point 5. line plane/NormalVector 6. FindAngle 7. line rotation Rotate about the aligned edge to get coincidence 8. Extract coordinates of vertices of the once-rotated triangle. These will be lists. 9. Convert the "third" vertex to a geom3d point. 10. Form planes containing fixed and last triangle. 11. get angle between these planes. 12. Rotate about coincident edge. This edge needs to be a geom3d line. 8. vertices 9. point 10. plane 11. FindAngle 12.line rotation Table 2   Summary of the steps of Method 1 for aligning two congruent triangles in

Table 3 is a dictionary for the notation used in implementing Method 1. The leftmost column displays the symbols used. Again, those in blue are used as Atomic Identifiers.  The middle column indicates the nature of the symbol, and the rightmost column gives the definition of the symbol.

 Symbol Symbol Type Symbol Definition directed line segment geom3d name of directed line segment from vertex to vertex .  Triangle is translated parallel to this line, making vertices and coincide triangle geom3d name for triangle after vertex is translated to coincide with vertex Maple graph Graph of triangle Maple list List of coordinates of vertices of triangle points geom3d names of vertices of triangle lines geom3d names for lines connecting with and respectively.  These are corresponding edges of triangles and . plane geom3d name of plane containing lines and Maple list Direction numbers for normal to plane Maple name Angle between lines and   Triangle is to be rotated through this angle to bring edges of triangles and into coincidence. line geom3d name of line about which triangle is rotated, forming triangle triangle geom3d name for triangle after it is rotated so edges and  coincide. Maple graph Graph of triangle Maple list List of coordinates of vertices of triangle point geom3d name of vertex "C" in triangle planes geom3d names of planes containing triangles and , respectively triangle geom3d name for triangle after it is rotated to coincide with triangle Maple graph Graph of triangle Table 3   The notation used for implementing Method 1

Step 1 - Translate: One Pair of Corresponding Vertices Coincide

The directed line segment from to is formed in the geom3d package via

Under translation of to , triangle becomes triangle . This translation is implemented via

Verification that the translation was in the right direction is given by Figure 2, a graph of triangles and

Figure 2   Triangles (red) and (blue)

Step 2 - Rotate:      One Pair of Corresponding Edges Coincide

To get the angle between corresponding edges of and we need the vertices of triangle , which we find and display with

These lists of coordinates must be converted to geom3d points:

The edges from to and to must be expressed as lines in the geom3d package.  We do this with

The normal to the plane containing these two edges is found by first defining this plane, then using the NormalVector command from the geom3d package.

The angle between these edges is determined by the FindAngle command in the geom3d package.

In order to rotate about an axis whose direction is the normal vector N, we define the line as the geom3d line having direction N

Triangle is now rotated about line through the angle via the rotation command in the geom3d package. This forms triangle

Note the minus sign in front of the angle.  The need for this sign was discovered empirically during the construction of Figure 3, a graph of triangles (in red) and (in blue).

Figure 3   Triangles (red) and (blue)

Step 3 - Rotate:      Third Vertex Coincides

The final step in Method 1 brings the third vertices in both triangles into coincidence.  From triangle we first extract the coordinates of vertex , the vertex that was originally labeled as .  Then, this vertex is expressed as a geom3d point.

The rotation of triangle to coincidence with is through an angle determined by the planes containing these two triangles.  These planes are defined by

so that the angle between the planes is

The rotation of triangle into coincidence with is accomplished by rotating through angle along the common edge.  The axis of rotation is the line defined earlier, and the result of the rotation is triangle

Figure 4 displays triangles in red, and in blue. Since these two triangles are coincident, their colors merge, with blue dominating.

Figure 4   Triangles (red) and (blue)

An analytical check of the coincidence of the two triangles in Figure 4 consists in calling on the geom3d package to display the vertices of the two triangles.

Implementation of Method 2

Table 4 summarizes the three major (conceptual) steps of Method 2.  These are listed in the leftmost column.  The middle column summarizes the mathematical steps that must be implemented in order to execute the conceptual step.  Finally, the rightmost column lists the commands in the geom3d package that are used to implement the mathematical steps in the middle column.

 Conceptual Steps Mathematical Tasks for Each Step geom3d commands Translate vertex to coincide with vertex 1. Find directed line segment connecting a pair of corresponding vertices. 2. Translate along this segment. 1. dsegment 2. translation Rotate triangle to be coplanar with triangle 3. Obtain the angle between the planes containing the two triangles. 4. Rotate about the line of intersection of the two planes. 3. vertices/point/plane FindAngle 4. intersection/rotation Rotate (pivot) around to get congruence. Axis of rotation is normal to and through .  Rotate through the angle determined by a pair of corresponding edges. 5. Convert a pair of corresponding edges to lines. 6. Find the angle between these lines. 7. Get normal to common plane of the triangles. 8. Form line normal to this plane and through coincident vertex. 9. Rotate plane to coincidence. 5. vertices/point/line 6. FindAngle 7. NormalVector 8. line 9. rotation Table 4   Summary of the steps of Method 2 for aligning two congruent triangles in

Table 5 is a dictionary for the notation used in implementing Method 2. The leftmost column displays the symbols used. Once again, those in blue are used as Atomic Identifiers.  The middle column indicates the nature of the symbol, and the rightmost column gives the definition of the symbol.

 Symbol Symbol Type Symbol Definition planes geom3d names of planes containing triangles and Maple name Angle between the planes containing triangles and Maple list Coordinates of vertices of triangle triangle geom3d name of triangle after it becomes coplanar with Maple graph graph of triangle point geom3d name of vertex "B" in triangle line geom3d name of line through the "A" and "B" vertices of triangle Maple name Angle between corresponding edges of triangles and vector geom3d name of vector normal to plane , the plane containing triangle triangle geom3d name of triangle after it is rotated into coincidence with Maple graph Graph of triangle Table 5   Additional notation appearing in Method 2

Step 1 - Translate: One Pair of Corresponding Vertices Coincide

Step 1 of Method 2 is exactly the same as in Method 1.  Translate triangle so vertex coincides with vertex

We reproduce those steps here for the convenience of the reader.

The directed line segment from to

The translation of triangle so coincides with forms triangle

Verification that the translation was in the right direction is given by graphing triangles and as per Step 1 in Method 1.  This results in Figure 5, which is identical to Figure 2.

Figure 5   Triangles (red) and (blue)

Step 2 - Rotate:      Make Triangles Coplanar

Just as in Step 2 of Method 1, the translation of triangle is called with vertices .  To implement these calculations in the geom3d package, we must first extract the vertices as Maple lists, then convert them to points in the scope of the package.  These steps are identical to those performed in Step 2 of Method 1, and are reproduced here for the convenience of the reader.

We next want to determine the planes containing triangles and and from this, calculate the angle through which the plane of has to be rotated to make it coplanar with triangle . Use of the plane construct in the geom3d package means we can avoid having to find the normals to the planes in order to determine the angle between the planes.

The plane containing was determined in Step 3 of Method 1, but we reproduce that step here, along with the determination of the planes containing triangles and .  Of course, these latter two planes are parallel, so determining both is redundant, but we can thereby demonstrate that the translation bringing vertices and into coincidence does not disturb the orientation of the plane of

The angle between the planes of triangles and , namely

is the same as the angle between the planes of triangles and , as we see from

Triangles and will be made coplanar by rotating the plane containing about the line of intersection of the planes containing these two triangles.  The axis of rotation passes through the common vertex , and the rotation is through the angle .  As a result, triangle become

The need for the minus sign in front of was determined empirically during the construction of Figure 6, a graph of triangles (in red) and (in blue).

Figure 6   Triangles (in red) and (in blue)

Step 3 - Rotate:      Pivot Triangles into Congruence

Triangle is brought into coincidence with triangle by a rotation of about an axis that is through vertex and normal to the plane containing .  The angle of rotation is the angle between any pair of corresponding sides.  Hence, we must obtain a pair of edges as geom3d lines, and for this, we need the vertices of triangle as geom3d points.  Actually, all we need is the vertex and the lines through and , and and .  Recall that the first such line was obtained in Step 2 of Method 1, but we repeat that calculation here for the convenience of the reader.

The angle through these two edges is

The vector normal to the plane containing both triangles and is obtained with

Pivot triangle to coincide with triangle , rotating about the line through normal to the plane containing triangles and .  Let be the triangle that results from pivoting

Figure 7 shows triangles (in red) and (in blue).  In essence, this is the same as Figure 5.

Figure 7   Triangles (red) and (blue)

As before, we can also verify that the two triangles have been brought into coincidence by simply asking for the vertices of triangles and

Legal Notice: ? Maplesoft, a division of Waterloo Maple Inc. 2010. Maplesoft and Maple are trademarks of Waterloo Maple Inc. This application may contain errors and Maplesoft is not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact Maplesoft for permission if you wish to use this application in for-profit activities.