Unit 4 Three Dimensional Graph

5th Semester

3D object representation

Graphical scenes can contain many different kinds of objects like trees, flowers, rocks, waters…etc. To produce realistic display of scenes, we need to use representations that accurately model object characteristics.

  • Simple Euclidean objects like polyhedrons and ellipsoids can be represented by polygon and quadric surfaces.
  • Spline surface are useful for designing aircraft wings, gears and other engineering objects.
  • Procedural methods and particle systems allow us to give accurate representation of clouds, clumps of grass, and other natural objects.
  • Octree encodings are used to represent internal features of objects such as medical CT images.

Representation schemes for solid objects are often divided into two broad categories:

  • Boundary Representations (B-reps)
  • Space-partitioning Representations

Boundary Representations (B-reps)

Boundary representations (B-reps) describe a three-dimensional object as a set of surfaces that separate the object interior from the environment. Example: Polygon surfaces, spline patches. Some of the boundary representation methods for 3D surface are discussed in the following section:

  1. Polygon Surfaces




It is most common representation for 3D graphics object. In this representation, a 3D object is represented by a set of surfaces that enclose the object interior. Many graphics systems use this method. Object descriptions are stored as sets of surface polygons. This simplifies and speeds up the surface rendering (creating high quality realistic images or pictures) and display of object since all surfaces can be described with linear equations. For this reason, polygon descriptions are often referred to as “standard graphics objects”.

Fig: A 3D object represented by polygons
Generally, polygon surfaces are specified using;

  • Polygon Table
  • Plane Equations
  • Polygon Meshes

Polygon Tables
Polygons tables can be used to specify polygon surfaces. Polygon table representation of polygon surfaces contains two parts:
Geometric tables

  • It contains vertex co-ordinates and parameter to identify the spatial orientation of polygon surface.
  • Geometric data consists of three tables: a vertex table, an edge table, and a surface table.
  • Vertex table: It stores co-ordinate values for each vertex of the object.
  • Edge Table: The edge table contains pointers back into the vertex table to identify the vertices for each polygon edge.
  • A polygon Surface table: A polygon surface table contains pointers back into the edge table to identify the edges for each polygon surfaces.

Example:





Fig: Geometric data table representation for two adjacent polygon surfaces, formed with 6 edges and 5 vertices
 
Attribute tables
It gives attribute information for an object (degree of transparency, surface reflectivity etc.)
Polygon Meshes
A polygon mesh is collection of edges, vertices and faces connected such that each edge is shared by at most two polygons. An edge connects two vertices and a polygon is a closed sequence of edges. An edge can be shared by two polygons and a vertex is shared by at least two edges. The faces usually consist of triangles (triangle strip), quadrilaterals (quadrilateral mesh), or convex polygons.
One type of polygon mesh is the triangle strip. This produces n-2 connected triangles, where n is the number of vertices, as shown in figure below;

Fig: A triangle strip formed by triangles
Another type of polygon mesh is the quadrilateral mesh, which produces a mesh of (n-1) by (m-1) quadrilaterals, given the co-ordinates for an n m array of vertices, as shown in figure below. It shows 20 vertices forming a mesh of 12 quadrilaterals.

Fig: A quadrilateral mesh formed by quadrilaterals
Plane Equations




Plane equation method is another method for representing the polygon surface for 3D -object. The information about the spatial orientation of object is described by its individual surface which is obtained by the vertex co-ordinate values and the equation of each plane gives the description of each surface. The equation for a plane surface can be expressed in the form

Projections

In general, the process of transformation of a n-dimensional points to m-dimensional points (m<n) is called projection. In computer graphics, projection is the process of conversion of 3D objects to a 2D screen coordinates or device coordinates. Thus, projection means a shadow of an object.
Basic Terminologies related to projection

  • Center of projection (COP): It is a point from where projection is taken. It can either be light source or eye position.
  • Projection plane or view plane (VP): The plane on which the projection of the object is formed.
  • Projectors: Lines emerging from COP and hitting the projection plane after passing through a point in the object to be projected.


Fig: Parallel Projection
Fig: Perspective Projection
Categories of Projection
Basically, there are two categories of projections

  • Parallel projection
  • Perspective projection

 
Parallel Projection
In parallel projection, the coordinate positions are transformed to the view plane along parallel lines i.e., all projectors are parallel to each other. The center of projection is at infinity, shown in fig above. A parallel projection preserves the relative proportions of the object but it does not give us realistic representation. It is used in engineering and architectural drawings.




The most common types of parallel projections are:

  • Orthographic Projection: A type of parallel projection in which the centre of projection lies at infinity and the projectors are perpendicular to the view plane is known as orthographic parallel projection. That is the angle between projectors and the view plane is equal to 90º                                                                          

 
 

  • Oblique Projection: A type of parallel projection in which the centre of projection lies at infinity and the projectors are not perpendicular to the view plane is known as orthographic parallel projection. That is the angle between projectors and the view plane is not equal to 90º. It preserves 3D nature of an object. An object with curves and circular features can be conveniently shown in oblique projection.


 
Perspectives Projections
In perspective projection, object positions are transformed to the view plane along lines that converge to a point called as a center of projection. In this type of projection, the object is very far from the viewer and appears to be smaller. Projectors are not parallel to each other. The center of projection is at a finite distance.  It Produces realistic views but does not preserve relative proportions. It is used in realistic displaying because it resembles to that our photographic systems (camera) and human eye.
Derivation of projections
Parallel Projection
Let P(x, y, z) is any point on the 3D object, and P'(x’, y’) be the projected point on the view plane. Determination of projected point is straightforward. Here x and y coordinates remain unchanged and the z-value is discarded.
x’ = x
y’ = y
z coordinate is discarded.
The orthographic transformation is given by:





 

Perspective Projection

Let us assume that the center of projection is at (xc, yc, zc) and the point on object is P(x1, y1, z1) then the parametric equation of line containing these points is;
x2 = xc+(x1-xc)u ….(1)
y2 = yc+(y1-yc)u ….(2)
z2 = zc+(z1-zc)u, ….(3)
Where u is a parameter
But the projected point on xy plane i.e (x2, y2, z2) will be the point where the line intersects the xy plane.


Three Dimensional (3D) Transformations
Just as 2D-transfromtion can be represented by 3×3 matrices using homogeneous co-ordinate can be represented by 4×4 matrices, provided we use homogenous co-ordinate representation of points in 3D space as well.
Translation
Translation in 3D is similar to translation in the 2D except that there is one more direction parallel to the z-axis. If, tx, ty, and tz are used to represent the translation vectors. Then the translation of the position P(x, y, z) into the point P’ (x’, y’, z’) is done by

 
In matrix notation using homogeneous coordinate this is performed by the matrix multiplication as below;

Rotation

To generate a rotation transformation for an object, we must designate an axis of rotation (about which the object is to be rotated) and the amount of angular rotation.

  1. Rotation About z-axis:

Z-component does not change.
x’ = xcosθ – ysinθ
y’ = xsinθ + ycosθ
z’ = z
Matrix representation for rotation around z-axis,

  1. Rotation about x-axis

X-component does not change.
y’ = ycosθ – zsinθ
z’ = ysinθ +z cosθ
x’ = x
Matrix representation for rotation around x-axis,

  1. Rotation about y-axis:

Y-component does not change
z’ = zcosθ – xsinθ
x’ = zsinθ + x cosθ
y’ = y
Matrix representation for rotation around y-axis,

  1. General 3D rotation

a. Rotation about an axis parallel to any of the coordinate-axis:
When an object is to be rotated about an axis that is parallel to one of the co-ordinate axis, we need to perform series of transformation.

  • Translate the object such that the rotation axis coincides with the parallel co-ordinate axis.
  • Perform the specified rotation about the axis.
  • Translate the object so that the rotation axis is moved to its original position.

 b. Rotation about an axis not parallel to any of the co-axis:

  • Translate the object such that rotation axis passes through co-ordinate origin.
  • Rotate the axis such that axis of rotation coincides with one of the co-ordinate axis.
  • Perform the specific rotation about that axis.
  • Apply inverse rotation to bring the rotation axis back to its original orientation.
  • Apply inverse translation to bring the rotation axis back to its original position.

Example: Consider a point (x, y, z). We want to rotate this point by an angle θ which is in space and laying on an arbitrary axis. We follow following steps:
Step 1: Translate the arbitrary axis so that it passes through the origin

 

 
 

Scaling

The process of compressing and expanding of any object is called scaling. Simply the process of changing dimension of any object is called scaling.
If scaling factor is less than 1 then it is called reduction and if scaling factor is greater than 1 then it is called magnification.

  1. Scaling about origin:


 
 

  1. Scaling about an arbitrary point (Xf, Yf, Zf) / Fixed point scaling
  • Translate the fixed point to the origin
  • Scale the object relative to the coordinate origin
  • Translate the fixed point back to its original position






 
 
   

Reflection

In 3D reflection the reflection takes place about a plane whereas 2D reflection it used take place about an axis. In 3D reflection following three cases will arise-

  • Reflection with respect to xy plane
  • Reflection with respect to yz plane
  • Reflection with respect to xz plane

Reflection with respect to xy plane
The points after reflection can be calculated as follows,
P’(x’, y’, z’)=M. P(x, y, z)
Where, x’=x, y’=y and z’=-z
In this reflection only the z coordinate value of the object’s position vector change i.e. z is reversed in sign. In matrix form the given equation can be written as,

Reflection with respect to yz plane
The points after reflection can be calculated as follows,
P’(x’, y’, z’)=M. P(x, y, z)
Where, x’=-x, y’=y and z’=z
In this reflection only the x coordinate value of the object’s position vector change i.e. x is reversed in sign. In matrix form the given equation can be written as,

Reflection with respect to xz plane
The points after reflection can be calculated as follows,
P’(x’, y’, z’)=M. P(x, y, z)
Where, x’=x, y’=-y and z’=z
In this reflection only the y coordinate value of the object’s position vector change i.e. y is reversed in sign. In matrix form the given equation can be written as,




3D Shearing

Shearing transformations can be used to modify object shapes. Sharing along any one of the axis which is perpendicular to the other two axes can be done.
Sharing along x-axis that is perpendicular to y and z axis:
This transformation alters y- and z-coordinate values by an amount that is proportional to the x value, while leaving the x coordinates unchanged, i.e.
x’ = x
y ‘= y + shy. x
z’ = z+shz. x
In matrix form the given equation can be written as,

Sharing along y-axis that is perpendicular to x and z axis:
This transformation alters x- and z-coordinate values by an amount that is proportional to the y value, while leaving the y coordinates unchanged, i.e.
x’ = x+Shx. y
y ‘= y
z’ = z+Shz. y
In matrix form the given equation can be written as,
 
Sharing along z-axis that is perpendicular to x and y axis:
This transformation alters x- and y-coordinate values by an amount that is proportional to the z value, while leaving the z coordinates unchanged, i.e.
x’ = x+Shx. z
y ‘= y+Shy. z
z’ = z
In matrix form the given equation can be written as,