Home » MATH 340 University of Maryland Wk 6 Homogeneous Coordinates Project

MATH 340 University of Maryland Wk 6 Homogeneous Coordinates Project

Math 340Mini Project 2: Homogeneous Coordinates
Overview
As we are seeing, linear algebra comes up in a lot of applications. One of the prime applications for
vectors and matrix transformations is the area of computer graphics and the related fields of
computer vision, robotics, and image processing. If fact, one of the best reviews of linear algebra
may be found in the appendix of the Computer Graphics textbook [4]. Basic operations in
computer graphics include translations, rotations, and scaling. In this project, we’ll investigate how
these may be combined into a single matrix (multiplication) operation through the use of
homogeneous coordinates.
Background
In computer graphics [4] (as well as in robotics [5]) object positions can be defined using vectors.
Thus, changes in position (translations and rotations) can then be defined as matrix operations on
these vectors. Likewise, scaling (resizing) the object can be also defined via matrix operations.
These operations are represented as,
𝑃! = 𝑃 + 𝑇 (Translation) (1)
𝑃! = 𝑅𝑃 (Rotation)
𝑃! = 𝑆𝑃 (Scaling)
(2)
(3)
We see that the latter two of these operations are multiplications, while the first (translation) is a
sum. Thus it is difficult to combine the three operations into a single matrix transformation.
However, this combination may be achieved if the vectors are rewritten in homogeneous
coordinates.
In homogeneous coordinates, we add a third coordinate to a point (vector). Instead of being
represented by a pair of numbers (𝑥, 𝑦)1, each point (vector) is represented as a triple (𝑥, 𝑦, 𝑤).
Thus a point in 2D will be represented by the set of points {(𝑥, 𝑦, 𝑤)|𝑤 ≠ 0} and we say point
points are equal (equivalent) if and only if one is a multiple of the other. For example, (2,3,6) and
(4,6,12) represent the point in 2D. That is, each point has many different homogeneous coordinate
representations. Also, at least one coordinate must be nonzero (that is, (0,0,0) is not allowed.) If
” $
” $
the w coordinate is nonzero, we can divide through by it giving (# , # , 1). That is, (# , # , 1)

$
represents the same point as (𝑥, 𝑦, 𝑤) and the numbers # and # are called the Cartesian
coordinates of the homogeneous point. Hence we generally represent the point (𝑥, 𝑦) in Cartesian
1
In this project, we’ll deal with two dimensional vectors for ease of visualization, but similar
techniques apply to three dimensional vectors (for example, see [2].)
coordinates as the triple (𝑥, 𝑦, 1) in homogeneous coordinates. The points with 𝑤 = 0 are called
points at infinity and will not be discussed here.
The advantage of homogeneous coordinates is that they allow us to combine the three operations
above into a single matrix transformation. For example, the translation of (𝑥, 𝑦) by the vector
(ℎ, 𝑘) (that is, (𝑥, 𝑦) is translated to (𝑥, 𝑦) + (ℎ, 𝑘) = (𝑥 + ℎ, 𝑦 + 𝑘)) may be represented as,
1 0 ℎ 𝑥
𝑥+ℎ
E0 1 𝑘F G𝑦H = E𝑦 + 𝑘F (1′)
0 0 1 1
1
A counterclockwise rotation through an angle 𝜃 is given by multiplication by the matrix
cos 𝜃
E sin 𝜃
0
− sin 𝜃
cos 𝜃
0
0
0F
1
(2′)
And a scaling by s in the x direction and t in the y direction, is given by,
𝑠 0 0
E0 𝑡 0F
0 0 1
(3′)
Hence, combinations of these three operations are simply products of matrices of these forms.
Note that if the matrix is of the form,
𝑟%,%
E𝑟’,%
0
𝑟%,’
𝑟’,’
0
𝑡”
𝑡$ F
1
where the upper 2 × 2 submatrix is orthogonal and thus preserves angles and lengths (scaling is
one in all directions). Such transformations are called rigid-body transformations and are useful in
robotics and other applications with no deformations (see [5] for more details).
Example
For example, the 3 × 3 matrix that corresponds to a scaling of one-half (0.5), a rotation of 90
degrees, and a translation of −1 in the x direction and by 2 in the y direction, is given by,
0 −0.5 −1
E0.5
0
2F
0
0
1
Here is the transformation applied to a (blue) rectangle in Matlab and the resulting (red) rectangle.
Exercises and Explorations
1. [15] Verify that the operations (1), (2), and (3) are given by the matrix operations as described
by (1’), (2’), and (3’).
2. [5] Prove the two successive 2D rotations are additive (and thus commutative), that is, show
𝑅(𝜃% ) ∙ 𝑅(𝜃’ ) = 𝑅(𝜃% + 𝜃’ )
[Hint: Recall the trig identities for sum of angles.]
3. [5] Matrix multiplication is generally not commutative, thus rotation in 3D are generally not
commutative. Give an example of two rotations in opposite order that shows they are not
commutative. [You do not need to give the matrices – you may simply describe the operations.
For example, rotate the unit vector in the x direction, 45 degrees clockwise around the y axis,
etc.] Give a drawing or plot of your results.
4. [10] Determine the 3 × 3 matrix that corresponds to a scaling of doubling in each direction, a
rotation of 45 degrees, and a translation of 2 in the x direction and by −2 in the y direction.
Plot your results using a rectangle or similar figure as shown in the example. You may use
software or an online application to do this.
5. [15] (Explore) Investigate and demonstrate the use of software or an online application to
demonstrate the properties of homogeneous transformations. Make your results as general as
possible. For example, allow user input of rotation angle, scaling factor, and translation vector
and demonstrate the result on a figure of your choice2. Demonstrate what happens if you
change the order of these operations.
2
Another option for this part is to investigate the “rvctools” Matlab Toolbox from the QUT site [5].
Unfortunately, due to differences in the string parsing functions, this toolbox doesn’t seem to work
in Octave, but your mileage may vary.
Conclusion
Sometime complicating a problem makes it simpler. In this case, adding a coordinate to our standard
Cartesian coordinates to make them into homogeneous coordinates allows us to combine several
operations (scaling, rotation, and translation) into a single matrix transformation.
References
1. Wikipedia: “Homogeneous Coordinates”, https://en.wikipedia.org/wiki/Homogeneous_coordinates.
2. Linear Algebra and Its Applications, David C. Lay, Steven R. Lay, and Judi McDonald, Fifth Edition,
Pearson, 2016.
3. Elementary Linear Algebra, Ron Larson, Cengage Learning, 2017.
4. Computer Graphics, Foley, vanDam, Feiner, and Hughes. Third Edition, Addison Wesley, 1993.
5. QUT Robot Academy (Online Resource), https://robotacademy.net.au/
Appendix
Matlab code used in the example:
% Define and draw a square
x=[0 2 2 0 0];
y=[0 0 1 1 0];
plot(x,y,’-o’);
axis([-6 6 -6 6]);
% Change to homogeneous coordinates
z=ones(1,5);
H=[x;y;z];
% Define the matrix for the transformation
T=[0 -0.5 -1;0.5 0 2;0 0 1]
% Multiply to do the scaling, rotation, and translation
R=T*H;
% Recover the Cartesian coordinates for plotting
x1 = R(1,:);
y1 = R(2,:);
hold on;
plot(x1,y1,’-o’);

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Order your essay today and save 30% with the discount code ESSAYHELP