5. The Primitives - Our builiding blocks
The primitives form our building blocks using which we compose and make our
scenes. Every primitive forms an object along with its surface
and transformation. The various primitives which can be used are
described below.
|
|
Sphere |
Cylinder |
|
|
Cone |
Ellipsoid |
|
|
Quadric - Infinite hyperboloid of one sheet |
Triangle |
|
|
Paralellogram |
Infinite Plane |
|
|
Paralellopiped |
Torus |
- Sphere -
A sphere can be specified using the following parameters -
- Sphere center
- Sphere radius
- Right Cylinder -
A cylinder can be specified using the following parameters -
- Cylinder base center
- Cylinder radius
- Cylinder height
- Cylinder axis direction
- Right Cone -
A cone can be specified using the following parameters -
- Cone base center
- Cone radius
- Cone height (from base to apex)
- Cone length (for a frustum)
- Cone axis direction
- Ellipsoid -
An ellipsoid can be specified using the following parameters -
- Ellipsoid center
- Radius l
- Radius m
- Radius n
- Major axis direction (Radius l is along this direction)
- General Quadric -
A general quadric can be specified using the following parameters -
- The ten quadric coefficients - a,b,c,d,e,f,g,h,i,j
Texture mapping and bump mapping are not implemented for a general quadric
- Triangle -
A triangle can be specified using the following parameters -
- Triangle vertex A
- Triangle vertex B
- Triangle vertex C
- Triangle_has_vertex_normals flag
- Triangle normals corresponding to A,B & C
- Triangle_has_texture flag
- Triangle texture coordinates corresponding to A,B & C
The vertices should be in anti-clockwise order.
- Paralellogram (subsumes squares &
rectangles ... pretty smart eh !! ) -
A paralellogram can be specified using the following parameters -
- Paralellogram vertex A
- Paralellogram vertex B
- Paralellogram vertex C
- Paralellogram vertex D
The vertices should be in anti-clockwise order.
- Infinite Plane -
A plane can be specified using the following parameters -
- Plane normal
- Distance of plane from origin
- Paralellopiped -
A paralellopiped can be specified using the following parameters -
- Paralellopiped vertex A
- Paralellopiped vertex B
- Paralellopiped vertex C
- Paralellopiped vertex D
|
|
Figure 4 |
Figure 5 |
- Torus -
A Torus can be specified using the following parameters -
- Torus Center
- Torus major radius
- Torus minor radius
- Torus axis direction
- Transforms .. moving the blocks -
Every primitive can be translated and rotated. Rotations can be done in any
order and are applied before the translations. These follow a primitive
definition. These are specified using the following parameters -
- has_transform flag
- Number of rotations
- Rotation axis (0:X,1:Y,2:Z) Rotation angle (in degrees)
....
- Translation X Y Z
A sample transformation specification is shown below. It rotates the primitive
about the Y axis (axis 1) by 90 degrees, and translates it along Z by 20.
  } //Primitive definition ends
  1
  1
  1 90
  0 0 20
} //Object definition ends
The transformations get concatanated in a matrix and are applied to primitive,
while ensuring that the local coordinate system of the primitive transforms
accordingly.
|
Figure 6 |
[ Back ]
Page last updated on 04 October, 2005.
|
AT cse.iitd.ac.in
|
© Parag Chaudhuri , 2009
|
|