LAB 10 - Jesse and Shingo CS40/ENGR26
LAB DESCRIPTION
For the final assignment, we have been given the liberty to choose our own topic. Note that the final assignment is optional and may be viewed as a set of extensions. This lab focuses on primitives, the backbone of an interesting 3D scene.
PRIMITIVES
- Bezier Spline
Splines are smooth curves generated based on a given set of points. This extension uses deCastalau splines. 4 vertices in world coordinates outline the spline. Once a resolution is set, midpoints between the vertices are recursively used to draw new lines. Given a threshold of only a few pixels, the resulting picture is a smooth looking curve with endpoints at the first and last vertices specified. Our new spline library provides the added functionality of drawing dashed splines.
Spline demonstration
 |
- Spheres, Asteroids, and octahedrons
Method #1 as shown below was the first attempt at creating a sphere. It subdivides the sphere into rectangular faces using angles theta and phi. (see code: sphere_test.c). The program was eventually discarded in favor of a method resulting in triangular faces (method #2 below). The second version thus uses the method of recursively subdividing the faces of an octagon. Asteroids can easily be made by adding a random offset to the radius when points are pushed to the edge of the sphere after subdivision.
Sphere method #1 using rectangular faces
 |
|
Sphere method #2 using triangular faces
 |
|
Sphere with 6 levels of recursion
 |