pub fn new(
        lookfrom: Point3,
        lookat: Point3,
        vup: Vec3,
        vertical_fov: f64,
        aspect_ratio: f64,
        aperture: f64,
        focus_dist: f64,
    ) -> Camera {
        let theta = vertical_fov.to_radians();
        let h = (theta / 2.0).tan();
        let viewport_height = 2.0 * h;
        let viewport_width = aspect_ratio * viewport_height;

        let w = (lookfrom - lookat).normalized();
        let u = Vec3::cross(&vup, &w).normalized();
        let v = Vec3::cross(&w, &u);

        let origin = lookfrom;
        let horizontal = focus_dist * viewport_width * u;
        let vertical = focus_dist * viewport_height * v;
        let lower_left_corner = origin - horizontal / 2.0 - vertical / 2.0 - focus_dist * w;

        let lens_radius = aperture / 2.0;

        Camera {
            origin,
            lower_left_corner,
            horizontal,
            vertical,
            u,
            v,
            w,
            lens_radius,
        }
    }
/// Constructs a new camera with given parameters
Constructs a new camera with given parameters
Constructs a new camera with given parameters
pub fn new(
        lookfrom: Point3,
        lookat: Point3,
        vup: Vec3,
        vertical_fov: f64,
        aspect_ratio: f64,
        aperture: f64,
        focus_dist: f64,
    ) -> Camera {
        let theta = vertical_fov.to_radians();
        let h = (theta / 2.0).tan();
        let viewport_height = 2.0 * h;
        let viewport_width = aspect_ratio * viewport_height;
        let w = (lookfrom - lookat).normalized();
        let u = Vec3::cross(&vup, &w).normalized();
        let v = Vec3::cross(&w, &u);
        let origin = lookfrom;
        let horizontal = focus_dist * viewport_width * u;
        let vertical = focus_dist * viewport_height * v;
        let lower_left_corner = origin - horizontal / 2.0 - vertical / 2.0 - focus_dist * w;
        let lens_radius = aperture / 2.0;
        Camera {
            origin,
            lower_left_corner,
            horizontal,
            vertical,
            u,
            v,
            w,
            lens_radius,
        }
    }
pub fn new ( lookfrom : Point3 , lookat : Point3 , vup : Vec3 , vertical_fov : f64 , aspect_ratio : f64 , aperture : f64 , focus_dist : f64 , ) -> Camera { let theta = vertical_fov . to_radians ( ) ; let h = ( theta / 2.0 ) . tan ( ) ; let viewport_height = 2.0 * h ; let viewport_width = aspect_ratio * viewport_height ; let w = ( lookfrom - lookat ) . normalized ( ) ; let u = Vec3 :: cross ( & vup , & w ) . normalized ( ) ; let v = Vec3 :: cross ( & w , & u ) ; let origin = lookfrom ; let horizontal = focus_dist * viewport_width * u ; let vertical = focus_dist * viewport_height * v ; let lower_left_corner = origin - horizontal / 2.0 - vertical / 2.0 - focus_dist * w ; let lens_radius = aperture / 2.0 ; Camera { origin , lower_left_corner , horizontal , vertical , u , v , w , lens_radius , } }
Constructs a new camera with given parameters
Constructs a new camera with given parameters
lookfrom
Point3
lookat
Point3
vup
Vec3
vertical_fov
f64
aspect_ratio
f64
aperture
f64
focus_dist
f64