Creative Scene Assignment

Build an interesting scene or figure using polyhedra, spheres, cylinders, disks, and so forth. Place several objects or parts in your scene, using the TRS (translate, rotate and scale) transformations that we learned in class. Also, use a variety of colors, including some that you crafted by hand, rather than using the built-in TW colors. Define an appropriate bounding box for your scene or figure using twBoundingBox, since twVertexArray will no longer be flexible enough.

I'm not specifying any minimum number of objects or anything like that, but I encourage you to have fun with it and make something you're proud of.

It can be

Library Contribution

As part of your scene, build an object that is created by a single function call. Your function can have several arguments or none, as you think best. Your function should be documented so that others can use it. All the constants and variables that your function uses should be within the function. For example:

def sandersoClown(hatColor, suitColor):
    buttonColor = ( 1, 0, 0 );  # buttons are always red
    ...

Note how the function name includes my Linux username as well as the name of the object. This is reasonably explanatory and distinguishes my clown from someone else's clown, should someone decide to make a different clown.

I will gather all these objects and create a library that we can all use in building scenes. Please look at the objects that previous classes created: they're in ~cs307/pub/pytw/. Ask yourself whether they are good, useful, reusable objects. Aim to do better!

Because of the way we can combine testing code with a library file in Python, you'll only need to submit one file. See the ~cs307/pub/pytw/jaylmerTemple.py file for how this is done.

Finally, add your file to the library by just copying it and making it world readable. The fact that this is under your control means you can also update it without my intervention. Here's how:

cp sandersoClown.py ~cs307/pub/pytw/
chmod a+r ~cs307/pub/pytw/sandersoClown.py

Documentation

Your Python file should document each of your functions, along with giving the declaration. The best way to document a Python function is to have the first element of the code be a string. Using triple quotes allows the string to be several lines long. Thus, the example above should really have been:

def sandersoClown(hatColor, suitColor):
    '''Draws a clown, with the given color for the hat and the suit.

The clown is 2x4x2, with the origin at the center of the bottom of the
box, between the feet.  The clown is facing towards the viewer (the +Z
axis).  Thus, the x-coordinates go from -1 to +1, the y from 0 to +4 and
the z from +1 to +1.'''
    buttonColor = ( 1, 0, 0 );  # buttons are always red
    ...

Please look over the documentation that previous students wrote for their objects. Do you think you understand how to use their functions? If not, what more do you need to know? Is there confusing or irrelevant information?

In writing your own documentation, try to keep in mind how difficult it can be to read someone else's documentation and know how to use their function. See if you can do better!

Remember how vague glutTeapot() was? Some things you should be sure to document are:

If you have trouble figuring out how to use someone's figure from the documentation, but you'd still like to use it, just read the code. It's all there in various files in tw/f*

Implementation Notes

Note that your library function may have helper functions (a good idea, when warranted).

License

I would like to be able to use your contributions in future offerings of this class. Furthermore, I am working on building TW into an Open Source package (the suite of software including TW, the demos, and so forth) that other people, including professors, will find useful for learning and teaching OpenGL. I would like to include the f05, f06 and other object libraries as part of that collection. The TW package will be released under the GNU General Public License (GPL).

Towards that end, I'd like you to license your work for use by others.

This is your choice; I won't insist that you share your work with others.

There are many licenses you could choose from. The GPL is the most common, but others are the Mozilla Public License, the Apache Public License, and others. Alternatively, you can place your work in the public domain.

Please think about this, and if you are willing to contribute your work for the betterment of humankind, place a notice like the following at the top of your source file.

An OpenGL model of a bicycle. Copyright (C) 2007 by YOUR NAME HERE This program is released under the LICENCE INFO HERE.

If you choose the GPL, they have instructions for the GPL at the site linked above. If you do all that, you'll already have done a better job than I have.

If you are unwilling to make this contribution, please put a copyright notice at the top of your file:

An OpenGL model of a bicycle. Copyright (C) 2006 by YOUR NAME HERE, all rights reserved.

Maya Objects

We can't include Maya objects until I've ported some more code to Python. If this feature is important to you, let me know, and I'll see if I can get to it.

If you choose to, you may create one or more objects in Maya. You can then create your scene by arranging those objects (and other objects), using the glm library functions we looked at (recall tw/bin/show-object-natural.cc) and the TRS transformations.

As always

Be sure to read the standard caveats and warnings for all assignments.

Math

Please do the problems in the following PDF file: math4.pdf

Written by Scott D. Anderson
scott.anderson@acm.org
Creative Commons License
This work is licensed under a Creative Commons License.

Valid HTML 4.01!