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
  1. Sphere -
    A sphere can be specified using the following parameters -
    1. Sphere center
    2. Sphere radius

  2. Right Cylinder -
    A cylinder can be specified using the following parameters -
    1. Cylinder base center
    2. Cylinder radius
    3. Cylinder height
    4. Cylinder axis direction

  3. Right Cone -
    A cone can be specified using the following parameters -
    1. Cone base center
    2. Cone radius
    3. Cone height (from base to apex)
    4. Cone length (for a frustum)
    5. Cone axis direction

  4. Ellipsoid -
    An ellipsoid can be specified using the following parameters -
    1. Ellipsoid center
    2. Radius l
    3. Radius m
    4. Radius n
    5. Major axis direction (Radius l is along this direction)

  5. General Quadric -
    A general quadric can be specified using the following parameters -
    1. 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

  6. Triangle -
    A triangle can be specified using the following parameters -
    1. Triangle vertex A
    2. Triangle vertex B
    3. Triangle vertex C
    4. Triangle_has_vertex_normals flag
    5. Triangle normals corresponding to A,B & C
    6. Triangle_has_texture flag
    7. Triangle texture coordinates corresponding to A,B & C
    The vertices should be in anti-clockwise order.

  7. Paralellogram (subsumes squares & rectangles ... pretty smart eh !! ) -
    A paralellogram can be specified using the following parameters -
    1. Paralellogram vertex A
    2. Paralellogram vertex B
    3. Paralellogram vertex C
    4. Paralellogram vertex D
    The vertices should be in anti-clockwise order.

  8. Infinite Plane -
    A plane can be specified using the following parameters -
    1. Plane normal
    2. Distance of plane from origin

  9. Paralellopiped -
    A paralellopiped can be specified using the following parameters -
    1. Paralellopiped vertex A
    2. Paralellopiped vertex B
    3. Paralellopiped vertex C
    4. Paralellopiped vertex D
    Figure 4 Figure 5

  10. Torus -
    A Torus can be specified using the following parameters -
    1. Torus Center
    2. Torus major radius
    3. Torus minor radius
    4. Torus axis direction

  11. 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 -
    1. has_transform flag
    2. Number of rotations
    3. Rotation axis (0:X,1:Y,2:Z) Rotation angle (in degrees)
      ....
    4. 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. pialpharhoalphagammaAT cse.iitd.ac.in © Parag Chaudhuri , 2009
DCSE, IIT Delhi Valid HTML 4.0! Valid CSS! yahoo