# CPE471 Final Project - Centroidize

## General Description

The original purpose of my project was to render a 3D representation of two bounding curves that are further bounded by a "depth" function. Following this step, the user would attempt to guess the axis of rotation of the object from a top down view. The user would then receive a score based on the proximity to the actual, calculated centroid / axis (not paying attention to the z-value of the player's click). This calculation required the implementation of at least single integral and possibly double integrals.

Unfortunately, what I do have is completely different. Although it was not for a lack of trying -- roughly forty (40) hours spent on the project in the past week, the various computational problems bested me. My current project represents the 2D shape bounded by "y = x" and "y = (x-2)^2" which is then shaded by the depth function "z = x + y." See below.

## Knowledge Deepened

Although my project may not have achieved what I set out to, I enjoyed the process even during the struggle. Most of my time was spent drawing up, writing pseudocode for, and testing algorithms for calculating various aspects of the shapes, but in regards to graphics material, I certainly gained a deeper understanding of the following:

- Generating a buffer of triangle strips to pass to the GPU. The calculation for this definitely took me hours to wrap my head around.
- Calculating the triangles normals. This required a lot of thought and applied our focuses on vector math and cross products.
- Using external libraries to accomplish large-scale tasks
- Exploring the capabilities (and lack-thereof) of C++ and OpenGL without external libraries.
- Utilizing matrix operations and transformations. The user can rotate the rendered shape. See image below and "Controls" section for operation details.

## Controls

W and S keys control vertical rotation.

A and D keys control horizontal rotation.

[SPACE] resets the rotation values to 0 thus resetting the original view.

## External Library

For this assignment, I used "exprtk," a library used for parsing strings into expressions. Additionally, the library contains a function for integrating expressions. Unfortunately however, exprtk provided almost no useful documentation for a source file of approximately 30,000lines which made it difficult to use. That being said, I was still able to implement a generic function to fill a buffer object array given three expression strings.

### Thank you for a great quarter, Dr. Wood!