Académique Documents
Professionnel Documents
Culture Documents
Two-Dimensional Objects
Points
The xy-coordinate plane has two coordinate axes, the x- and y-axis. They are perpendicular to each
other. Non-perpendicular axes can be used; but, the computation cost is higher.
A point in the xy-plane is represented by two numbers, (x, y), where x and y are the
coordinates of the x- and y-axes.
Lines
A line in the xy-plane has an equation as follows:
Ax + By + C = 0
It consists of three coefficients A, B and C. C is referred to as the constant term. If B is non-zero, the
line equation can be rewritten as follows:
y=mx+b
where m = -A/B and b = -C/B. This is the well-known slope-intercept form in which m and b are the
slope and the intercept (i.e., the intersection point of the line and the y-axis). If B is zero, the line
equation becomes Ax + C = 0, which is a line parallel to the y-axis and intersects the x-axis at point
(0,-C/A).
The line equation has three coefficients; but, there are only two independent ones. That is,
given a line equation, dividing the equation by one of its non-zero coefficients will not
change the line. For example, the line equation 4x+5y+7=0 is equivalent to x+1.25y+1.75=0
and 0.8x+y+1.4=0. Dividing an equation by a non-zero constant is usually referred to as
normalization. There is one normalization that is very important to us. It is used to compute
the distance between the origin to a line.
Suppose the line equation is Ax+By+C=0, the distance between the origin and the line is
given as follows:
Thus, after normalizing the line equation by dividing it with the square root of the sum of the
squares of A and B, the absolute value of the new constant term is the distance between the
origin and the given line.
Two lines are perpendicular if and only if the product of their slopes is -1. With the line
equations above, two lines are perpendicular to each other if and only if the following holds:
AE=-BF
Three-Dimensional Objects
Points
The coordinate system in space needs three coordinate axes, the x-, y- and z-axis. Therefore, a point in
space has three components (x,y,z), where x, y and z are the coordinates of the x-, y- and z-axis.
Planes
A plane in space has an equation as follows:
Ax + By + Cz + D = 0
It consists of four coefficients A, B, C and D, where D is the constant term. Similar to the line case,
the distance between the origin and the plane is given as
The normal vector of a plane is its gradient. The gradient of an equation f(x,y,z)=0 is defined
as follows:
Vectors
Vectors have a very important advantage in geometric computing, because it is "coordinate free." The
meaning of "coordinate free" will be clear in later discussions. All vectors will be in boldface like a
and A.
A vector is similar to a point. If it is a vector in the plane (resp., space), it has two (resp.,
three) components. Thus, a vector in a n-dimensional space has n components. For our
applications, we shall distinguish two types of vectors: position vectors and direction vectors.
A position vector gives the position of a point. More precisely, a point is a vector. A direction
vector gives a direction. Hence, it is not a point. In what follows, position vectors and
direction vector are written with boldface upper case and lower case, respectively. For
example, A and a are position and direction vectors, respectively. In many cases, such
distinction is unnecessary.
As you have learned in linear algebra or in calculus, you can add and subtract vectors; but
you can only multiply or divide a vector with constants.
The length of a vector is the square root of the sum of squares of all components. A unitlength vector is a vector whose length is one. A vector can be normalized by dividing its
components with its length, converting the given vector to a unit-length one while keeping its
direction the same. For example, if a=<3, 4, 5>, then the length of a, usually written as |a|, is
SQRT(50) and the normalized a is <3/SQRT(50), 4/SQRT(50), 5/SQRT(50)>.
Inner Product
Given two vectors a and b, its inner product, written as a.b, is the sum of the products of
corresponding components. For example, if a = <1,2,3> and b = <2,-1,4>, then a.b = 1*2 + 2*(-1) +
3*4 = 12.
More precisely, the inner product of a and b is equal to the product of the length of a, the length of b,
and the cosine of the angle t between a and b. This is an important formula, because we know the
following facts about a and b once the inner product becomes available:
1. If a.b is zero, where a and b are non-zero vectors, then cos(t) must be zero and, as a result, t
must be 90 degree. Therefore, a and b are perpendicular to each other.
2. If a.b is equal to the product of lengths of a and b, the cosine of t is 1 and t is 0 degree. As a
result, a and b are parallel to each other and point to the same direction.
3. If a.b is equal to the negative product of lengths of a and b, the cosine of t is -1 and a and b
are parallel to each other but point to opposite directions.
Lines
A line is defined by a based point B and a direction vector d which gives the direction of the line.
Therefore, the vector equation of a line is
B + td
where t is a parameter. In many applications, the direction vector is of unit-length.
Planes
A plane, in its vector form, is specified by a based point B and its normal vector n. For an arbitrary
point, or position vector, X on the plane, the direction vector from the base point B to X, X-B, must be
perpendicular to the normal vector n. Therefore, we have (X-B).n must be zero. From (X-B).n=0, we
have the equation of a plane specified with a base point and its normal vector:
X.n - B.n = 0
Given the vector notation of lines and planes, it is very easy to compute the intersection point
of a line and a plane. Let the given line be A+td. Let the plane be defined with a base point B
and its normal vector n. Then, this plane has equation X.n=B.n. If the line intersects the
plane, there must be a value of t such that the corresponding point lies on the plane. That is,
there must be a t such that the point corresponding to this t would satisfy the plane equation.
Since a point on the line is A+td, plugging A+td into the plane equation yields
(A+td).n - B.n = 0
Rearranging the terms and solving for t yields
t = (B-A).n / d.n
Therefore, plugging this t into the line equation yields the intersection point.
In the above, if d.n is zero, t cannot be solved and consequently no intersection point exists.
The meaning of d.n = 0 is that d and n are perpendicular to each other. Since n is the normal
vector of a plane and d is perpendicular to n, d must be parallel to the plane. If the line is
parallel to the plane, no intersection point exists.
Cross Product
There is yet one more important concept about vector: the cross product of two vectors. Given two
vectors a and b, their cross product, written as a b, is defined as follows:
where a = < a1, a2, a3 >, b = < b1, b2, b3 >, and | | is a 2-by-2 determinant. In other words, the
cross product is
a b = < a2b3 - a3b2, -(a1b3 - a3b1), a1b2 - a2b1 >
The cross product of a and b, a b, is perpendicular to both a and b and points to the direction based
on the right-handed system in the order of a, b, a b. Therefore, b a points to the opposite direction
of a b. The length of a b is |a| |b| sin(t), where t is the acute angle between a and b. Hence, if a
and b are perpendicular to each other, the length of a b is simply |a| |b|.
Curves
Circles
The simplest non-linear curve is unquestionably the circle. A circle with center (a,b) and radius r has
an equation as follows:
(x - a)2 + (x - b)2 = r2
If the center is the origin, the above equation is simplified to
x2 + y2 = r 2
The above equations are referred to as the implicit form of the circle. The parametric form of a circle
is
x = rcos(t)
y = rsin(t)
The following is the parametric form of a circle whose center is not the origin:
x = a + rcos(t)
y = b + rsin(t)
The above parametric form uses trigonometric functions. We shall discuss a parametric form of a
circle without trigonometric functions later.
There are three types of non-degenerate conics: ellipses, hyperbolas and parabolas. Ellipses
and hyperbolas are called central conics because they have a center of symmetry, while
parabolas are non-central.
The normal form of an ellipse is the following implicit equation:
The axes of this ellipse are the x- and y-axis, a and b are the axis lengths, and the larger one
of a and b is the major axis while the smaller one is the minor axis. It is not difficult to see
that an ellipse in this form has the following parametric form:
x = acos(t)
y = bsin(t)
The definition of major axis and minor axis are identical to that of ellipses. The x-axis
intersects the curve at two points (a, 0) and (-a, 0) and, the y-axis does not intersect the curve
at all. A possible parametric form of the above hyperbola is the following:
x = asec(t)
y = btan(t)
The center of an ellipse and hyperbola, in normal form, is the coordinate origin and the curve
is symmetric about its center and its axes.
The normal form of a parabola is the following implicit equation:
In this normal form, for any point (x,y) on a parabola, the value of y must be positive and the
opening of this parabola is upward. The axis of this parabola is the y-axis. It is intersecting to
note that the normal form of a parabola is already a parametric form. Or, if you like, you can
rewrite it into the following:
x=t
y = t2 / (4p)
In the above polynomial, the coefficients of xy, x and y are 2B, 2D and 2E, respectively. This
polynomial has six coefficients; however, dividing it with a non-zero coefficient would
reduce six to five. Thus, in general, five conditions can uniquely determine a conic. In linear
algebra, you perhaps have learned the way of reducing the above polynomial to a normal
form using eigenvalues and eigenvectors.
Frequently, we only want to know the curve type of a general second degree polynomial. In
this case, as long as the second degree equation represents a conic rather than two intersecting
or parallel lines, it can easily be done as follows:
1. If B2 < A*C, the general equation represents an ellipse.
2. IF B2 = A*C, the general equation represents a parabola.
3. If B2 > A*C, the general equation represents a hyperbola.
Expression B2-A*C is called the discriminant of the general second degree polynomial. Based on the
above, if the value of the discriminant is less than, equal to or greater than zero, the conic is an ellipse,
a parabola, or a hyperbola.
It is not difficult to verify that the general second degree polynomial becomes
Now what you have learned from linear algebra can be applied to this matrix form.
Surfaces
Ellipsoid
Elliptic Paraboloid
Hyperbolic Paraboloid
These five quadric surfaces are normally referred to as rank four quadrics. There are two
types of rank three quadrics: cones and cylinders. Cylinders have three subtypes: elliptic
cylinders, hyperbolic cylinders and parabolic cylinders as shown below:
Cone
Elliptic Cylinder
Hyperbolic Cylinder
Parabolic Cylinder
It has ten coefficients; but, as mentioned in the discussion of conics, dividing the equation
with one of its non-zero coefficients reduces the number of coefficients to nine. Please also
note that except for the coefficients for x2, y2 and z2 and the constant term, all coefficients has
a multiplier of 2.
You might want to ask a question: is it possible to develop an algorithm for classifying the
quadrics just like we did for conics? More precisely, if a general second degree polynomial is
given, could we tell its type (i.e., ellipsoid, hyperboloid of one sheet, elliptic paraboloid, etc)
by simply looking at their coefficients? The answer is always a "yes"; but the computation
algorithm is quite complex. So, I would rather skip this algorithm. However, you can always
use eigenvalues and eigenvectors to solve this problem.
where (x, y, z) is the coordinates of a point. This form translates the general second
polynomial of a quadric to the following matrix form:
Note that it is exactly identical to that of a conic. Therefore, matrices help to bring conics and
quadrics into an identical form.
After knowing the matrix form of quadrics, we will be able to discuss the meaning of rank
four and rank three quadrics. Consider the symmetric matrix Q that contains the coefficients
of a general second degree polynomial. The rank of a matrix is the number of non-zero
eigenvalues. Thus, rank four quadrics are those quadrics whose matrix Q are of rank four. It
is easy to see (from their normal forms) that ellipsoids, hyperboloids and paraboloids are rank
four quadrics, and cones and cylinders are rank three quadrics. If a general second degree
polynomial factors into the product of two distinct degree one polynomials (i.e., planes), Q
will have rank two.
If the rotation axis is the z-axis and the major circle lies on the xy-plane, the equation of the
generated torus is the following:
If R is greater than r, the result is a commonly seen torus as shown in the middle of the
following figure.
IF R is equal to r, then all moving circles are tangent to the rotation axis at the coordinate
origin as shown in the right figure. If R is less than r, all moving circles intersect the rotation
axis at two distinct points and the generated torus will have a olive like shape in the interior
of the torus as shown in the left figure.
Homogeneous Coordinates
One of the many purposes of using homogeneous coordinates is to capture the concept of
infinity. In the Euclidean coordinate system, infinity is something that does not exist.
Mathematicians have discovered that many geometric concepts and computations can be
greatly simplified if the concept of infinity is used. This will become very clear when we
move to curves and surfaces design. Without the use of homogeneous coordinates system, it
would be difficult to design certain classes of very useful curves and surfaces in computer
graphics and computer-aided design.
Let us consider two real numbers, a and w, and compute the value of a/w. Let us hold the
value of a fixed and vary the value of w. As w getting smaller, the value of a/w is getting
larger. If w approaches zero, a/w approaches to infinity! Thus, to capture the concept of
infinity, we use two numbers a and w to represent a value v, v=a/w. If w is not zero, the value
is exactly a/w. Otherwise, we identify the infinite value with (a,0). Therefore, the concept of
infinity can be represented with a number pair like (a, w) or as a quotient a/w.
Let us apply this to the xy-coordinate plane. If we replace x and y with x/w and y/w, a function
f(x,y)=0 becomes f(x/w,y/w)=0. If function f(x,y) = 0 is a polynomial, multiplying it with wn
will clear all denominators, where n is the degree of the polynomial.
For example, suppose we have a line Ax + By + C = 0. Replacing x and y with x/w and y/w
yields A(x/w) + B(y/w) + C = 0. Multiplying by w changes it to
Ax + By + Cw = 0.
Let the given equation be a second degree polynomial Ax2 + 2Bxy + Cy2 + 2Dx + 2Ey + F =
0. After replacing x and y with x/w and y/w and multiplying the result with w2, we have
Ax2 + 2Bxy + Cy2 + 2Dxw + 2Eyw + Fw2 = 0
If you look at these two polynomials carefully, you will see that the degrees of all terms are
equal. In the case of a line, terms x, y and w are of degree one, while in the second degree
polynomial, all terms (i.e., x2, xy, y2, xw, yw and w2) are of degree two.
Given a polynomial of degree n, after introducing w, all terms are of degree n. Consequently,
these polynomials are called homogeneous polynomials and the coordinates (x,y,w) the
homogeneous coordinates.
Given a degree n polynomial in a homogeneous coordinate system, dividing the polynomial
with wn and replacing x/w, y/w with x and y, respectively, will convert the polynomial back to
a conventional one. For example, if the given degree 3 homogeneous polynomial is the
following:
x3 + 3xy2 - 5y2w + 10w3 = 0
the result is
x3 + 3xy2 - 5y2 + 10 = 0
This works for three-dimension as well. One can replace a point (x, y, z) with (x/w, y/w, z/w)
and multiply the result by w raised to certain power. The resulting polynomial is a
homogeneous one. Converting a degree n homogeneous polynomial in x, y, z and w back to
the conventional form is exactly identical to the two-variable case.
An Important Notes
Given a point (x,y,w) in homogeneous coordinates, what is its corresponding point in the xyplane? From what we discussed for converting a homogeneous polynomial back to its
conventional form, you might easily guess that the answer must be (x/w,y/w). This is correct.
Thus, a point (3,4,5) in homogeneous coordinates converts to point (3/5,4/5)=(0.6,0.8) in the
This transformation treats a two-dimensional homogeneous point as a point in threedimensional space and projects (from the coordinate origin) this three-dimensional point to
the plane w=1. Therefore, as a homogeneous point moves on a curve defined by
homogeneous polynomial f(x,y,w)=0, its corresponding point moves in three-dimensional
space, which, in turn, is projected to the plane w=1. Of course, (x/w,y/w) moves on a curve in
plane w=1.
The above figure also shows clearly that while the conversion from the conventional
Euclidean coordinates to homogeneous coordinates is unique, the opposite direction is not
because all points on the line joining the origin and (x,y,w) will be projected to (x/w,y/w,1).
This is also an important concept to be used in later lectures.
Geometric Transformations
When talking about geometric transformations, we have to be very careful about the object
being transformed. We have two alternatives, either the geometric objects are transformed or
the coordinate system is transformed. These two are very closely related; but, the formulae
that carry out the job are different. We only cover transforming geometric objects here.
We shall start with the traditional Euclidean transformations that do not change lengths and
angle measures, followed by affine transformation. Finally, we shall talk about projective
transformations.
Euclidean Transformations
The Euclidean transformations are the most commonly used transformations. An Euclidean
transformation is either a translation, a rotation, or a reflection. We shall discuss translations and
rotations only.
Then, the relationship between (x, y) and (x', y') can be put into a matrix form like the following:
Therefore, if a line has an equation Ax + By + C = 0, after plugging the formulae for x and y,
the line has a new equation Ax' + By' + (-Ah - Bk + C) = 0.
If a point (x, y) is rotated an angle a about the coordinate origin to become a new point (x', y'),
the relationships can be described as follows:
Thus, rotating a line Ax + By + C = 0 about the origin a degree brings it to a new equation:
Translations and rotations can be combined into a single equation like the following:
The above means that rotates the point (x,y) an angle a about the coordinate origin and
translates the rotated result in the direction of (h,k). However, if translation (h,k) is applied
first followed by a rotation of angle a (about the coordinate origin), we will have the
following:
This is the new equation of the given conic after the specified transformation. Note that the
new 3-by-3 symmetric matrix that represents the conic in a new position is the following:
Now you see the power of matrices in describing the concept of transformation.
With this set of equations, letting a be 90 degree rotates (1,0,0) to (0,1,0) and (0,1,0) to (1,0,0). Therefore, the x-axis rotates to the y-axis and the y-axis rotates to the negative
direction of the original x-axis. This is the effect of rotating about the z-axis 90 degree.
Based on the same idea, rotating about the x-axis an angle a is the following:
Let us verify the above again with a being 90 degree. This rotates (0,1,0) to (0,0,1) and
(0,0,1) to (0,-1,0). Thus, the y-axis rotates to the z-axis and the z-axis rotates to the negative
direction of the original y-axis.
But, rotating about the y-axis is different! It is because the way of measuring angles. In a
right-handed system, if your right hand holds a coordinate axis with your thumb pointing in
the positive direction, your other four fingers give the positive direction of angle measuring.
More precisely, the positive direction for measuring angles is from the z-axis to x-axis.
However, traditionally the angle measure is from the x-axis to the z-axis. As a result, rotating
an angle a about the y-axis in the sense of a right-handed system is equivalent to rotating an
angle -a measuring from the x-axis to the z-axis. Therefore, the rotation equations are
Let us verify the above with rotating about the y-axis 90 degree. This rotates (1,0,0) to (0,0,1) and (0,0,1) to (1,0,0). Therefore, the x-axis rotates to the negative direction of the z-axis
and the z-axis rotates to the original x-axis.
A rotation matrix and a translation matrix can be combined into a single matrix as follows,
where the r's in the upper-left 3-by-3 matrix form a rotation and p, q and r form a translation
vector. This matrix represents rotations followed by a translation.
You can apply this transformation to a plane and a quadric surface just as what we did for
lines and conics earlier.
Affine Transformations
Euclidean transformations preserve length and angle measure. Moreover, the shape of a geometric
object will not change. That is, lines transform to lines, planes transform to planes, circles transform
to circles, and ellipsoids transform to ellipsoids. Only the position and orientation of the object will
change. Affine transformations are generalizations of Euclidean transformations. Under affine
transformations, lines transforms to lines; but, circles become ellipses. Length and angle are not
preserved. In this section, we shall discuss scaling, shear and general affine transformations.
Scaling
Scaling transformations stretch or shrink a given object and, as a result, change lengths and angles.
So, scaling is not an Euclidean transformation. The meaning of scaling is making the new scale of a
coordinate direction p times larger. In other words, the x coordinate is "enlarged" p times. This
requirement satisfies x' = p x and therefore x = x'/p.
Scaling can be applied to all axes, each with a different scaling factor. For example, if the x-,
y- and z-axis are scaled with scaling factors p, q and r, respectively, the transformation matrix
is:
Shear
The effect of a shear transformation looks like ``pushing'' a geometric object in a direction parallel to
a coordinate plane (3D) or a coordinate axis (2D). In the following, the red cylinder is the result of
applying a shear transformation to the yellow cylinder:
How far a direction is pushed is determined by a shearing factor. On the xy-plane, one can
push in the x-direction, positive or negative, and keep the y-direction unchanged. Or, one can
push in the y-direction and keep the x-direction fixed. The following is a shear transformation
in the x-direction with shearing factor a:
The shear transformation in the y-direction with shearing factor b is the following:
In space, one can push in two coordinate axis directions and keep the third one fixed. The
following is the shear transformation in both x- and y-directions with shearing factors a and b,
respectively, keeping the z-coordinate the same:
Let us take a look at the effect of this shear transformation. Expanding the matrix equation
gives the following:
x' = x + az
y' = y + bz
z' = z
Thus, a point (x, y, z) in space is transformed to (x + az, y + bz, z). Therefore, the z-coordinate does
not change, while (x, y) is ``pushed'' in the direction of (a, b, 0) with a factor z.
Comparing with all previous discussed matrices, rotations and translations included, you will
see that all of them fit into this form and hence are affine transformations. Affine
transformations do not alter the degree of a polynomial, parallel lines/planes are transformed
to parallel lines/planes, and intersecting lines/plane are transformed to intersecting lines and
planes. However, affine transformations do not preserve lengths and angle measures and as a
result they will change the shape of a geometric object. The following shows the result of a
affine transformation applied to a torus. A torus is described by a degree four polynomial.
The red surface is still of degree four; but, its shape is changed by an affine transformation.
Note that the matrix form of an affine transformation is a 4-by-4 matrix with the fourth row 0,
0, 0 and 1. Moreover, if the inverse of an affine transformation exists, this affine
transformation is referred to as non-singular; otherwise, it is singular. We do not use singular
affine transformations in this course.
Projective Transformations
Projective transformations are the most general "linear" transformations and require the use of
homogeneous coordinates. Given a point in space in homogeneous coordinate (x,y,z,w) and its image
under a projective transform (x',y',z',w'), a projective transform has the following form:
In the above, the 4-by-4 matrices must be non-singular (i.e., invertible). Therefore, projective
transformations are more general than affine transformations because the fourth row does not
have to contain 0, 0, 0 and 1.
Projective transformation can bring finite points to infinity and points at infinity to finite
range. Let us take a look at an example. Consider the following projective transformation:
Obviously, this transformation sends (x,y,w)=(1,0,1) to (x',y',w') = (1,-1,0). That is, this
projective transformation sends (1,0) on the xy-plane to the point at infinity in direction <1,1>. From the right-hand side of the matrix equation x=Px' we have
x = 2x' + y'
y = x' + y'
w = 2x' + y' + w'
Let us consider a circle x^2 + y^2 = 1. Plugging the above equations into the circle equation changes it
to the following:
x2 + 2xy + y2 - 4xw - 2yw - w2 = 0
Dividing the above by w^2 to convert it back to conventional form yields
x2 + 2xy + y2 - 4x - 2y - 1 = 0
This is a parabola! (Why?) Therefore, a circle that has no point at infinity is transformed to a parabola
that does have point at infinity.
While projective transformations, like affine transformations, do not change the degree of a
polynomial, two parallel (i.e., intersecting) lines/planes can be transformed to two
intersecting (i.e., parallel) lines/planes. Please verify this fact yourself.
Although we do not use these facts and the concept of projective transformations
immediately, it will be very helpful in later lectures.
Therefore, the net effect of transforming a point x of the initial object to the corresponding
point x' after the above four transformations is computed as x' = Hx = DCBAx.
Problems
1. Given a line B+td and a plane with base point A and normal vector n, what is the
condition for the line is perpendicular to the plane? What is the condition for the line
to be parallel to the plane?
References
Most of this week's material are from Bowyer and Wookwark's little book. The example
showing the bad effect of the associative law is from Colonna's paper. Finally, you can
find more about floating pointing computation problems is Acton's book.