PyTrace (core)

Originally inspired by Ray Tracing in One Weekend (Peter Shirley).

This library cannot be executed as-is, but it can provide tools that pytrace can then use.

What can be done here is creating a new complex object.

To do so, it is recommended to create a new file in the composite module : - Create a new file composite/<object>.rs - Implement <object> by providing a build method (more information below) - Integrate the new object with the rest of the program by adding the two lines pub mod <object>; and pub use <object>::<Object>; in composite/mod.rs (see examples)

What already existed ?

Of course, this project bears some resemblance with the original Ray tracing in one Weekend: - The name of many types and functions are the same: internal::hitable::schlick, internal::camera::Camera::get_ray, internal::vec3::Vec3, internal::ray::Ray, internal::hitable::Hit, internal::hitable::Texture::Lambertian. - Some ideas were kept: overloading std::ops::Mul for internal::rgb::RGB, initial internal::camera::Camera abstraction. - Some chunks of code have been translated to Rust almost verbatim: internal::primitives::Sphere::hit, internal::hitable::scatter.

Many other similarities were partially or completely rewritten halfway into the project.

The hit implementations for many objects were inspired by or debugged with the help of a wide variety of websites: internal::hitable::{EmptyCylinder, EmptyCone, Triangle} were implemented after comparing the implementations of intersection with a ray from at least a dozen sources, most of which had made widely different design choices and were hard to adapt.

internal::hitable::{InfinitePlane, Disc} were done by myself without help, internal::hitable::Parallelogram was adapted from internal::hitable::Triangle, and all of the other are merely wrappers.

What's new ?