Starting from:
$30

$24

Lab 2: Ray tracing a Sphere Solution

Introduction




The purpose of this lab is to build the foundation for the ray tracer you will

need to write for the assignment by guiding you through the process of designing

and implementing a bare-bones ray tracer that can render a single sphere and

save it to file. We will first discuss what capabilities are already available

within Atlas, and then we will discuss the general structure of the ray tracer.

Once we have all of this ready, we will implement the ray tracer itself.




Available Functionality




Atlas bundles a math library called GLM which will handle the implementation

details of anything related to matrix and vector algebra. Atlas itself provides

aliases for most common types (all found under the `atlas::math` namespace) such

as:




* Vectors: `Vector`, `Vector2`, `Vector4`,

* Points: `Point`, `Point2`, `Point4`, and

* Normals: `Normal`, `Normal2`, `Normal4`.




Note that in all cases, the first type is an element of 3D space.




Through GLM, we also have access to all the common math operators. We can add,

subtract, and multiply any of the above types using the standard operators as if

they were fundamental types like integers or floats. In order to use

vector-specific functions such as the dot and cross product, we use:




* Dot product: `glm::dot`

* Cross product: `glm::cross`

* Normalize: `glm::normalize`

* Length: `glm::length`




You can find out the complete list of functions that GLM provides by reading the

corresponding documentation

[here](https://github.com/g-truc/glm/blob/master/manual.md).

More products