Struct rtow::camera::Camera
[−]
[src]
pub struct Camera { /* fields omitted */ }
A camera represented as a single 3D point and a rectangular sensor. The sensor is identified by its lower left corner and two directional vectors (one horizontal and one vertical).
Methods
impl Camera
[src]
pub fn new(vert_fov: f64, aspect_ratio: f64) -> Camera
[src]
Creates a new camera centered in (0, 0, 0)
. The sensor is constructed based on the desired
field of view and aspect ratio.
pub fn get_ray(&self, u: f64, v: f64) -> Ray
[src]
Creates a ray which runs from the camera center towards (and through) the screen.
The values u
and v
provide the exact direction:
- Use
(0.0, 0.0)
for obtaining a ray that passes through the lower left corner of the sensor. - Use
(1.0, 1.0)
for obtaining a ray that passes through the upper right corner of the sensor. - Use anything in between for obtaining an arbitrary ray.