CG 4
CG 4
Computer Graphics uses CAD. CAD allows manipulation of machine components which
are 3 Dimensional. It also provides automobile bodies, aircraft parts study. All these
activities require realism. For realism 3D is required. In the production of a realistic 3D
scene from 2D is tough. It require three dimension, i.e., depth.
3D Geometry
Three dimension system has three axis x, y, z. The orientation of a 3D coordinate system
is of two types. Right-handed system and left-handed system. In the right -handed system
thumb of right- hand points to positive z-direction and left- hand system thumb point to
negative two directions. Following figure show right-hand orientation of the cube.
Polygon Surfaces
Sweep Representations
Sweep representations are used to construct 3D object from 2D shape that have some
kind of symmetry.
For example, a prism can be generated using a translational sweep and rotational
sweeps can be used to create curved surfaces like an ellipsoid or a torus.
In both cases, you start with a cross-section and generate more vertices by applying
the appropriate transformation.
More complex objects can be formed by using more complex transformations. Also,
we can define a path for a sweep that allows you to create more interesting shapes.
Translational sweep:
i. Define a shape as a polygon vertex table as shown in figure 33 (a).
ii. Define a sweep path as a sequence of translation vectors figure 33 (b).
iii. Translate the shape; continue building a vertex table figure 33 (c).
iv. Define a surface table figure 33 (d).
Rotational sweep:
i. Define a shape as a polygon vertex table as shown in figure 34 (a).
ii. Define a sweep path as a sequence of rotations.
iii. Rotate the shape; continue building a vertex table as shown in figure 34 (b).
iv. Define a surface table as shown in figure 34 (c).
Ray Casting is often used to implement CSG operation when objects are described
with boundary representation. We fire a ray from the plane xy (which represent the
screen). The surface limits for the composite object are determnined bu the specified set
operation . This method can also be used for physical simulation.
Quadtrees
Definition
• Based on the divided-and-conquer principle, a quadtree is a data structure that
recursively subdivides a plane into 4 quadrants.
• The decision to subdivide is based on an attribute of the current quadrant. If the
quadrant is heterogeneous with respect to this attribute, further subdivision occurs.
If it is homogeneous, or we have reached the desired level of detail, we stop
subdividing.
We will apply quadtrees to storing planar polygons. Our attribute will be
whether current quadrant is filled by the interior of a polygon:
Octrees
• Octrees are based on the same principle, but divide regions of 3D space (usually
into cubes).
• The scene is subdivided at each step with three mutually perpendicular planes,
aligned with the Cartesian coordinate planes.
• Individual partitions of 3D space are called Voxels (Volume Elements).
• Applications: raycasting, shadowcasting.
Octrees, like Quadtrees, use a node structure to store the volume elements:
In this figure, the octree has been refined twice. First, the root is refined into eight cells,
each representing an octant of the root's domain. Then, one of the root's children is
refined yet again.