HW2: 3D Point Clouds

Due Tuesday 12/15 @ 10:30am.

Where & What to Hand In

Note that it's important to always use exactly the specified filename when handing in work for a CS class. (Canvas may automatically append a number to your filename; that's okay.)

Your Tasks

Download the starter code, point_clouds.py. This Python script has a number of TODO comments in it; your task will be to do what they say, one by one, and remove each TODO as you complete it. (You'll also need gfx_helper_script.py and gfx_helper_plotting.py — download fresh copies of 'em!)

  1. Change the body of cubeVerts() to match its docstring. Change the call in main() so that these points appear in octant 1 (+++).
  2. Change the body of ellVerts() to match its docstring. Add a call in main() so that the points appear in octant 2 (-++).
  3. Change the body of prismVerts() to match its docstring. Add a call in main() so that the points for a pentagonal prism appear in octant 3 (--+).
  4. Add another call to prismVerts() in main() so that the points for a cylinder (which, for us, is just a prism with a bunch of faces) appear in octant 4 (+-+).
  5. Change the body of sphereVerts() to match its docstring. Add a call in main() so that the points appear in octant 5 (++-).
  6. Change the body of torusVerts() to match its docstring. Add a call in main() so that the points appear in octant 6 (-+-).

I will test your functions with many different values of K, including 0. (I won't use negative, fractional, or non-numeric values; don't worry. I'll also only use values of K ≥ 3 for the prism.) Make sure you verify that your functions work correctly in all cases.

The first four things should produce a figure that looks like this — note that in the second picture I'm looking straight down the Z-axis:

And here's a picture of the sphere and torus on their own — note the axis labels:

Rubric

This assignment is worth 15 points.

CriterionPoints
Program runs from command line as python pount_clouds.py.1
Shows cube, L, prism, and cylinder in correct locations.2
Shows sphere and torus in correct locations.2
cubeVerts() and ellVerts() return correct values.2
prismVerts() returns correct values for several arguments.3
sphereVerts() returns correct values for several arguments.3
torusVerts() returns correct values for several arguments.2
Total15