CMPS 160 -- Prog 3
Early if time stamp is before midnight Nov 5, 2016.
On time if time stamp is before midnight Nov 6, 2016.
Late submissions will not be accepted/graded.
Objectives:
Apply transformations (translate, rotate, scale) to multiple objects
using direct manipulation.
Description:
Create a simple scene modeler where the user can load multiple objects (SORs)
and apply transformations to them.
Such a program can be used to set up a scene.
For the bonus feature below, you can also use this to create new models.
Bonus:
Using a combination of SORs, create a more complex object.
For example, you can create a model of the SS Enterprise using a combination
SORs like flattened spheres and cyclinders.
Another possibility is making your own variation of the banana slug.
Many other possibilities exists. Be creative.
Details:
Read all the requirements before implementing any of them.
-
Object vs world coordinates.
Each object is defined in its own coordinate system.
This is referred to as the object coordinate.
Objects are placed in the world coordinate system via a series
of transformations.
When an object is first read in (or created),
you need to keep track of its extents in the object coordinate system.
The extent refers to the range of x,y,z values when the object
is centered at the origin.
The object center is simply the average of all the object vertices.
Any transformations on an object is relative to this configuration.
Set your world coordinate system so that the origin
is at the center of a 1001 x 1001 x 1001 space.
-
Picking.
Picking is done by left clicking on an object.
You can pick on any SOR that's currently visible.
You indicate that an object has been picked by changing its color to
gray (Ka = 0.5 0.5 0.5, rest of the materials are unchanged).
You deselect an object by left clicking on the background.
Doing so will revert the color of the previously picked object
back to its original color.
Only one object can be picked at any time.
If you click on another object while you currently have a picked object,
the picked object will be updated to the latest one.
-
Scaling.
Scaling is applied to the picked object.
If there's no picked object, then the following is a no-op.
Scaling is achieved by turning the scroll wheel (find a mouse with a scroll
wheel if you're using your laptop to do development).
Scrolling up will increase the object, while scrolling down will decrease the object.
Scaling is done uniformly on x,y,z dimensions.
Scaling is specified with respect to the object coordinate system.
Any single scaling operation can be up to 0.5 to 2 times its previous size.
Scaling is cumulative.
-
Translation.
Translation is applied to the picked object.
If there's no picked object, then the following is a no-op.
Translation is specified with respect to the world coordinate system.
2D movements on the image plane is specified by
using the left button in conjunction with mouse movement.
The displacement between a left mouse down event and the left mouse up event indicates
the amount of movement to be applied to the picked object.
To specify a movement in the world z direction,
the vertical displacement between the middle mouse down event and the middle mouse up
event is used.
-
Rotation.
Rotation is applied to the picked object.
If there's no picked object, then the following is a no-op.
Rotation is specified with respect to the object coordinate system.
The user indicates rotation by using the right button in conjunction with
the mouse movement.
A right mouse down with horizontal motion (displacement in x is much larger
than displacement in y) until a mouse up event
indicates a rotation about the z-axis of the object
(not of the screen).
A right mouse down with a vertical motion until a mouse up event
indicates a rotation about the x-axis of the object.
We don't need a rotation about the object's y-axis since that's the axis for
creating the SOR and hence the object appear the same.
A potential source of confusion is the use of different coordinate systems.
Transformations are carried out with respect to a coordinate system.
Pay attention to the required coordinate system for the different transformations above.
-
Cumulative transformations?
Successive transformations on an object is always relative to the object's
most recent configuration.
For example, if I translate an SOR then I scale it,
the scaling will change the size of the SOR in-place
and not relative to the origin.
That is, the scaled SOR will still be at the translated position,
but scaled to the new size.
Likewise, if I apply a rotation to the SOR as my next transformation,
the rotation is applied relative to the SOR's axes at its current location in
the world coordinate system.
A typical way of handling this is to store the cumulative transformations
to an SOR in a matrix.
Apply the inverse of this matrix before applying the latest transformation.
And update the cumulative matrix with the latest transformation.
Each object will have its own cumulative transformation matrix.
Resource:
Read the examples in chapters 2 and 3 of the Matsuda-Lea book.
Grading:
-
Rubric:
You start off with 100 points. You earn additional credit by turning in your assignment
early and/or implement additional features. You lose credit for missing functionality,
incorrect results, poorly documented or formatted code, or not following instructions.
Below is a partial list:
up to 10 points off for poor features.html file
up to 10 points off for inadequate comments or hard-to-read code
up to 10 points off for not following instructions
up to 10 points off for special handling
functionality points depending on importance
Make sure you:
a. submit the right files you want us to grade,
b. have tested your code on the browsers in the lab.
c. follow the general instructions described in overview.html
-
Who graded your assignment:
victor: aagrawa6 -
andy: drooney -
aashwin: mespirit -
Submission:
See
course overview
for instructions on what to submit and what not to submit.
Put materials in a folder named prog3 and zip it up.
Submission must be done using the "submit" command from unix.ic.ucsc.edu
- submit cmps160-ap.f16 prog3 prog3.zip
Last modified
Tuesday, 22-Jan-2019 09:42:16 PST.