point_clouds.py
, submitted on Canvas.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.)
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!)
cubeVerts()
to match its docstring. Change the call in main()
so that these points appear in octant 1 (+++).ellVerts()
to match its docstring. Add a call in main()
so that the points appear in octant 2 (-++).prismVerts()
to match its docstring. Add a call in main()
so that the points for a pentagonal prism appear in octant 3 (--+).main()
so that the points for a cylinder (which, for us, is just a prism with a bunch of faces) appear in octant 4 (+-+).sphereVerts()
to match its docstring. Add a call in main()
so that the points appear in octant 5 (++-).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:
This assignment is worth 15 points.
Criterion | Points |
---|---|
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 |
Total | 15 |