LAB 7 - Jesse and Shingo CS40/ENGR26



HOME Lab1 Lab2 Lab3 Lab4 Lab5 Lab6 Lab7 Lab8 Lab9 Lab10 CODE
Jesse's Portfolio Shingo's Portfolio



LAB DESCRIPTION



The object of this lab was to create 3D transformations. Below is a list of the 3D transformations implemented and their effect on a cube in 3D space.

required image

MODULE TRANSFORMATION FUNCTIONS

  1. Translation

  2. Translates all points in a 3D object by (tx,ty,tz) effectively translating the 3D model. Below is a unit cube (1x1x1). It has been translated by (1,1,1) along the x,y,z axes respectively. The original is included for comparison.

    original & transformed cube
  3. Scale

  4. Scale takes 3 scaling factors (sx,sy,sz). It scales relative to the origin. Below the cube has been scaled by x=2, y=3, z=2.

    original & transformed cube
  5. RotateX and RotateY

  6. Rotates object by angle specified about the X-axis or Y-axis respectively. Note that counter-clockwise is positive looking from infinity on the X-axis or Y-axis respectively. Below, the cube on the right has been rotated 45 deg around the x-axis. Note that the origin of the cube is the lower front corner so the box rotates around the axis from that point, not the center of the cube. The top box is rotated 45 deg around the y axis. Note that the resulting cubes have also been translated by 2 in x or y respectively for clarity.

    original & transformed cube
  7. RotateXYZ

  8. Orients an object to the orthonormal axes (u,v,w). Here the axes have been defined as:
    u: 1.0, 0.3, 0.0
    v: -0.3, 0.8, 0.3
    w: u x v (cross product of u and v)
    Note that the cube has also been translated (1.2,1.2,1.2) for clarity.

    original & transformed cube