www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

2.1 Three Dimensional primitives:

In a two dimensional plane, the objects that were considered are simple polygons. In three dimensions, they are no longer restricted to lie in the same plane. Hence curves become curves in space, and objects with interiors can become surface in space. We face two problems when we expand our graphics system to incorporate all these possibilities. 1) The mathematical definitions of these objects can become complex. 2) We are interested in only these objects that lead to efficient implementations in graphics system. The following are three features characterize 3D objects that fit well with existing hardware and software: 1) The objects are described by their surfaces and can be thought of as being hollow. 2) The objects can be specified through a set of vertices in three dimensions. 3) The objects either are composed of or can be approximated by flat, convex polygons. The first condition implies that we need only 2D primitives to model 3D objects because surface is a two rather than a 3D entity. The second condition says that, if an object is defined by vertices, we can use pipeline architecture. The third condition is an extension of 2D polygons.. 2.2 Co ordinate systems and Frames.

So far, we have studied vectors and points as abstract objects, without representing them in any reference system. In 3D vector space a vector w is represented uniquely in terms of any linearly independent vectors v1, v2 and v3 as

w = α1v1 + α2v2 + α3v3 ------> (1)

Where α1, α2, α3 are scalars components of w w.r.t the basics v1, v2, v3. these relationships are shown in figure 2.1 v2

v1 v3 figure 2.1

www.BookSpar.com 1 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

We can write the representation of w w.r.t this basis as the column matrix.

1    a    2 

 3  Where a is a representation in a particular basis. We can re write equation (1) as

v1  w  aT v   aT v  2 

v3 

v1    Where v  v  2 

v3 

The basis vectors v1, v2 and v3 defining a coordinate system. However, for dealing with problems using points, vectors and scalars need more general method. The Figure 2.2 explains one of the problems.

(a) (b)

Figure 2.2 (a) vector emerging from common point (b) Vector moved

www.BookSpar.com 2 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

The three vectors fo rm a coordinate system shown in Figure 2.2(a) we could use these vectors as a basis to represent any vector in 3D, however in Figure 2.2(b), vectors have same direction and magnitude, but lack a position attribute. Hence Figure 2.2(b) is equivalent to Figure 2.2(a).

Because an affine space contains points, once we fix a particular reference point called origin, in such a space we can represent all points unambiguously. Figure 4.22(a) makes sense in the affine space where both points & vectors have representations. This representation requires both the reference point and the basis vectors. The origin and the basis vectors determine a frame.

Within a given frame, every vector can be written uniquely as

T w = α1v1 + α2v2 + α3v3 = a v. and every point can be written uniquely as

P = Po + β1v1 + β2v2 + β3v3

T = Po + b v. Thus, the representation of a particular vector in a frame requires three scalars, the representation of a point requires three scalars and the knowledge of where the origin is located. 2.2.1 Representations and N-Tuples

Suppose that vectors e1, e2 & e3 form a basis, The representation of any vector v is given by the component α1, α2 and α3 of a vector a, where

v = α1e1 + α2e2 + α3e3.

This basis vectors must themselves have representations that we can denote e1, e2 & e3 by

T e1 = (1,0,0)

T e2 = (0,1,0)

T e3 = (0,0,1)

Rather than thinking in terms of abstract vector, we can work with 3 tuples and we can write the representation of any vector v as a column matrix ‘a’ or the 3 tuple (α1,α2.α3) where a = α1e1 + α2e2 +

3 α3e3. The basis 3 tuples e1, e2, and e3 are vectors in the familiar Euclidian space R

2.2.2 Change of coordinate systems.

www.BookSpar.com 3 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

The representation of the vector changes when basis vector changes. Let’s consider changing representations for vectors first, suppose that {v1, v2, v3} and {u1, u2, u3} are two bases. Each basis vectors in the second set can be represented in terms of the first set (and vice versa). Hence, there exists nine scalar components {γij}, such that

u1 = γ11 v1+ γ12 v2+ γ13 v3

u2 = γ21 v1+ γ22 v2+ γ23 v3

u3 = γ31 v1+ γ32 v2+ γ33 v3

 11  12  13    The 3*3 matrix M     is defined by these scalars  21 22 23 

 31  32  33 

and

u1  v1      u  M v or u =M v .  2   2 

u3  v3 

The M contains information to go from a representation of a vector in one basis to its representation in the second basis. The inverse of M gives the matrix representation of the change from {u1, u2, u3} to {v1, v2, v3}.

Consider a vector w that has the representation {α1, α2, α3} w.r.t (v1, v2, v3} i.e.

w = α1v1+ α2v2+ α3v3

T we can write it as w = a v.

1  v1      a   and v  v  2   2 

 3  v3 

assume that ‘b’ is the representation of w w.r.t {u1, u2,u3} i.e.

w =β1 u1+ β2 u2+ β3 u3 or

u1  w  bT u   bT u  2 

u3 

www.BookSpar.com 4 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

1    Where b    2 

 3  Then using our representation of second basis in terms of the first basis, we find tat

u1  v1  w  bT u   bT M v   2   2 

u3  v3 

v1  T    a v  2 

v3 

T Thus a = M b

The matrix T = (MT)-1 Takes us from a to b through simple matrix equation b = T a. So, rather than working with original vectors, we can work instead with their representations, which are 3 tuples or elements of R3.There changes in basis leave the origin unchanged. We can use them to represent rotation & scaling, but point cannot be represented in this way, it requires homogeneous coordination system.

2.2.3 Example change of representation.

Suppose that we have a vector w whose representation in some basis is

1 a  2   3

We can denote the three basis vectors as v1, v2 and v3, Hence, w = v1 + v2 + v3

Now, suppose that we want to make a new basis from three vectors v1, v2 and v3 where

u1 = v1 u2 = v1 + v2 u3 = v1 + v2 + v3

www.BookSpar.com 5 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

1 0 0 1 1 0   1 1 1  The matrix M is  

The matrix that converts a representation in v1, v2 & v3 to one in which the basis vectors are u1, u2 and u3 is

T = (MT)-1 1 1 1 1  1 1 0  0 1 1  0 1 1      = 0 0 1  = 0 0 1  In the new system, the representation of w is b = T a 1 a  1    3 

That is w = - u1 - u2 + 3u3

2.2.4 Homogeneous Coordinates

Suppose that we start with the frame defined by the point Po and vectors v1, v2 & v3, a point ‘P’ located at (x, y, z) with the column matrix

x P  y   z

where x, y and z are the components of the basis vectors for this point, so P = Po + x v1+ y v2 + z v3, if we represent the point in this way, then its representation is of the same form as the vector

w = x v1+ y v2 + z v3

Homogeneous Coordinates avoid this difficulty by using four dimensional representation for both points and vectors in 3D. In the frame specified by (v1, v2, v3, Po). any point P can be written uniquely as

www.BookSpar.com 6 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

P = α1v1+ α2v2+ α3v3+ Po. If we define the multiplication of a point by the scalars 0 and 1 as 0 . P = 0 1 . P = P Then we can express this relation formally, using a matrix product as

 v1  v   2  P  1  2  3 1 v3     p0 

Homogeneous Coordinate representation of the point P in the frame determined by v1, v2, v3 and Po. Equivalently, we can say that P is represented by the column matrix

1    P   2 

 3     1  in the same frame any vector w can be written as

w  1v1   2 v2   3v3

 v1  v  T  2   1  2  3 0 v3     p0  Thus w can be represented by the column matrix

1    w   2 

 3     0  Consider, for example, a change of frames - a problem that caused difficulties when we used 3D representations If (v1, v2, v3, Po) and (u1, u2, u3, Qo) are two frames then we can express the basis vectors and reference point of the second frame in terms of the first as

u1 = γ11 v1+ γ12 v2+ γ13 v3

www.BookSpar.com 7 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

u2= γ21 v1+ γ22 v2+ γ23 v3 u3= γ31 v1+ γ32 v2+ γ33 v3 u4= γ41 v1+ γ42 v2+ γ43 v3+ Po the above equations can be written as

u1   v1  u  v   2   M  2  where M is the 4 * 4 matrix

u3  v3      Q0   p0 

 11  12  13 0    0 M   21 22 23 

 31  32  33 0      1  41 42 43  M is called matrix representation of the change of frames.

We can also use M to compute the changes in representation. Suppose a and b the homogeneous coordinate representation either of two points or two vectors in the two frames then

u1   v1   v1  u  v  v  bT  2   bT M  2   a T  2 

u3  v3  v3        Q0   p0   p0 

a = MT b

11 12 13 14       where M   21 22 23 24   31  32  33  34     0 0 0 1 

All affine transformations can be represented as matrix multiplications in homogeneous coordinates.

2.2.5 Example change in frames

www.BookSpar.com 8 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

Consider again the example discussed previously in section 2.2.3. If we again start with the basis vectors v1, v2 and v3 and convert to a basis determined by the same u1, u2 & u3, then the three equations are

u1 = v1

u2 = v1+v2

u3 = v1+v2+v3

The reference point does not change, so we add the equation Qo = Po 1 0 0 0 1 1 0 0 M    1 1 1 0   0 0 0 1

Thus, the matrix in which we are interested are transpose of above & their inverse. Suppose that in addition to changing the basis vectors we also want to move the reference point to the point that has the representation (1, 2, 3, 1) in the original system. The displacement vector v = v1+ 2v2 + 3v3 moves Po to Qo. The fourth component identifies this entity as a point. So

T Qo = Po + v1+ 2v2 + 3v3 and the matrix M becomes

1 1 0 1 1 1 1 1 0 1 1 1    0 1 1 2   0 0 1 3 0 0 1 3   T -1 0 0 0 1   its inverse is T = (M ) 0 0 0 1

Note that a takes the point (1, 2, 3) in the original frame, whose representation is

1 0     2 | 0 P    to P    3 0     1 1

www.BookSpar.com 9 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

The origin in new system However, the vector (1, 2, 3) which is represented as 1 1 2 1 a    in the original system is transformed to b    3  3      0  0 

www.BookSpar.com 10