On-Line Geometric Modeling Notes

Frames


In computer graphics we manipulate objects. These may include light sources, cameras, and objects in our scenes. Each of these is likely to be defined in its own coordinate system and then placed within the scene we are modeling. We must be able to relate these coordinate systems, both to a global coordinate system and to each other. We place coordinate systems into an affine space through the use of frames.

We first discuss the definition of a frame and give several examples of frames including the well known Cartesian Frame. A matrix representation of points and vectors under a given frame is developed and utilized to discuss the conversion of coordinates between frames The method of conversion is developed first through a specific two dimensional example which shows that the problem can be solved by developing a tex2html_wrap_inline393 conversion matrix. The general n-dimensional case is then discussed. We conclude with a discussion of how to generate this conversion matrix.

For a postscript version of these notes look here.


Definition of a Frame

  Let tex2html_wrap_inline395 be an affine space of dimension n. Let tex2html_wrap_inline399 be a point in this space and let tex2html_wrap_inline401 be any basis for tex2html_wrap_inline403. We call the collection tex2html_wrap_inline405 a frame for tex2html_wrap_inline407. Frames form coordinate systems in our affine space. That is, if we consider a point tex2html_wrap_inline409, tex2html_wrap_inline411 can be written as tex2html_wrap_inline413, where tex2html_wrap_inline415 is the origin of the frame and tex2html_wrap_inline417 is a vector. Since the tex2html_wrap_inline419 forms a basis for tex2html_wrap_inline421, we have that the vector tex2html_wrap_inline423 can be written uniquely as
displaymath49
and so the point tex2html_wrap_inline425 can be written uniquely as
displaymath51
The set of values tex2html_wrap_inline427 are the coordinates of tex2html_wrap_inline429 relative to the frame tex2html_wrap_inline431.


Examples of Frames

  Two-dimensional examples of frames are fairly straightforward to produce. We will denote the frames as tex2html_wrap_inline433.

Matrix representation of Points and Vectors

 

Points and vectors can be uniquely identified by the coordinates relative to a specific frame. Given a frame tex2html_wrap_inline475 in an affine space tex2html_wrap_inline477, we can write a point tex2html_wrap_inline479 uniquely as
displaymath71
This can also be written as
displaymath73
Similarly, since the vectors of our affine space form a vector space, we can write a vector tex2html_wrap_inline481 uniquely as
displaymath81
and this can be written as
displaymath83

Thus, points are represented as row vectors whose last component is 1 and vectors are represented as row vectors whose last component is 0 (zero).

Converting Between Frames

 

A useful technique is, when given two different frames, to take a point that has a certain set of coordinates in one frame and find its coordinates in the second frame. Most readers will do this routinely, relating points back to the Cartesian frame. But what if the second frame is not the Cartesian frame?


  It is useful to study a two dimensional example of this process before proceeding in general.

Consider the two frames tex2html_wrap_inline487 and tex2html_wrap_inline489 where
alignat96
These frames are shown in the figure below

tex2html_wrap607

Suppose we have the point tex2html_wrap_inline491, with coordinates ( 3, 2 ) in the frame tex2html_wrap_inline495. What are the coordinates of the point in the frame tex2html_wrap_inline497?

This is straightforward to calculate using the matrix notation for the points.
equation102
and therefore the new coordinate is (3,0) under the frame tex2html_wrap_inline501.

Now carefully note what we did in this calculation. First we wrote the point in the matrix notation for the frame tex2html_wrap_inline503. Then we wrote the vectors of the first frame in terms of the vectors of the second frame - and we can do this since the vectors of the second frame (any frame actually) form a basis for the space of vectors. Then we wrote the origin tex2html_wrap_inline505 in terms of the origin and vectors of the second frame. This column vector, expressing the first frame in terms of the second, was converted to the product of a tex2html_wrap_inline507 matrix and the column vector representing the second frame. We then multiplied the tex2html_wrap_inline509 matrix times the initial coordinate to obtain the result.

This can be done with any coordinate from the first frame, as the tex2html_wrap_inline511 matrix generated will be the same in every case. That is, given a coordinate (u,v) from the first frame, we can convert it to a coordinate for the second frame by simply calculating
displaymath130


  To convert coordinates from one frame to another in n-dimensional space proceeds in the same way as the example above.

Suppose a point tex2html_wrap_inline517 has coordinates tex2html_wrap_inline519 relative to some frame tex2html_wrap_inline521. What would be the coordinates of tex2html_wrap_inline523 relative to another frame tex2html_wrap_inline525?

Well since tex2html_wrap_inline527 is a basis, we can write each of the vectors tex2html_wrap_inline529 uniquely in terms of the tex2html_wrap_inline531. In addition, since tex2html_wrap_inline533 is a vector, we can also write tex2html_wrap_inline535 uniquely in terms of the tex2html_wrap_inline537 and tex2html_wrap_inline539. Thus we can calculate coefficients tex2html_wrap_inline541 defined by
equation142
for i = 1, 2, ..., n and
equation149
So now we can write
equation156
and since the vectors tex2html_wrap_inline545 are linearly independent we have that the coordinates tex2html_wrap_inline547 of the point in the second frame is
displaymath198

Thus the change of coordinates is accomplished via a matrix multiplication. We note that the rows of the matrix consist of the coordinates of the elements of the old frame tex2html_wrap_inline549 relative to the new frame tex2html_wrap_inline551.

We also note that if we consider the frames in three dimensional space (i.e. n=3), the matrix is tex2html_wrap_inline555.


  So how do we calculate the matrix
displaymath219
which is required for the conversion of the coordinates of a point in one frame to those of another? We use Cramer's Rule.

Since most of the calculations we are required to do are in 3 dimensions, we will present the techniques for calculating the matrix in this special case - where the frames will now be denoted as tex2html_wrap_inline557 and tex2html_wrap_inline559 and the matrix will be
displaymath237
So how do we find the values tex2html_wrap_inline561?

Given any frame tex2html_wrap_inline563, and a vector tex2html_wrap_inline565, I know that tex2html_wrap_inline567 for some u, v and w. Utilizing Cramer's Rule, I can calculate these coordinates directly by the following process: If we define
equation256
then we can calculate
equation260

Utilizing this process, we can let tex2html_wrap_inline575, and we can let tex2html_wrap_inline577 and calculate tex2html_wrap_inline579, tex2html_wrap_inline581 and tex2html_wrap_inline583 ; we can let tex2html_wrap_inline585 and calculate tex2html_wrap_inline587, tex2html_wrap_inline589 and tex2html_wrap_inline591 ; we can let tex2html_wrap_inline593 and calculate tex2html_wrap_inline595, tex2html_wrap_inline597 and finally we can let tex2html_wrap_inline599 and calculate tex2html_wrap_inline601, tex2html_wrap_inline603 and tex2html_wrap_inline605.

So using Cramer's rule, the calculations are straightforward and consist of taking a few cross products and dot products.

See the section on Cramer's Rule for more information when the frames are orthonormal.


This document maintained by Ken Joy

Comments to the Author

All contents copyright (c) 1996, 1997
Computer Science Department,
University of California, Davis
All rights reserved.



Ken Joy
Thu Jul 24 11:57:35 PDT 1997