yocto/yocto_gl.cpp
inline ray3f eval_camera(const camera* cam, const vec2f& uv, const vec2f& luv) {
      auto h = 2 * tan(cam->yfov / 2);
      auto w = h * cam->aspect;
      auto o = vec3f{luv.x * cam->aperture, luv.y * cam->aperture, 0};
      auto q = vec3f{w * cam->focus * (uv.x - 0.5f),
                     h * cam->focus * (uv.y - 0.5f), -cam->focus};
      return ray3f(transform_point(cam->frame, o),
                   transform_direction(cam->frame, normalize(q - o)));
    }
// Generates a ray ray_o, ray_d from a camera cam for image plane coordinate
// uv and the lens coordinates luv.
Generates a ray ray_o, ray_d from a camera cam for image plane coordinate
uv and the lens coordinates luv.
Generates a ray ray_o ray_d from a camera cam for image plane coordinate uv and the lens coordinates luv .
inline ray3f eval_camera(const camera* cam, const vec2f& uv, const vec2f& luv) {
      auto h = 2 * tan(cam->yfov / 2);
      auto w = h * cam->aspect;
      auto o = vec3f{luv.x * cam->aperture, luv.y * cam->aperture, 0};
      auto q = vec3f{w * cam->focus * (uv.x - 0.5f),
                     h * cam->focus * (uv.y - 0.5f), -cam->focus};
      return ray3f(transform_point(cam->frame, o),
                   transform_direction(cam->frame, normalize(q - o)));
    }
inline ray3f eval_camera ( const camera * cam , const vec2f & uv , const vec2f & luv ) { auto h = 2 * tan ( cam -> yfov / 2 ) ; auto w = h * cam -> aspect ; auto o = vec3f { luv . x * cam -> aperture , luv . y * cam -> aperture , 0 } ; auto q = vec3f { w * cam -> focus * ( uv . x - 0.5f ) , h * cam -> focus * ( uv . y - 0.5f ) , - cam -> focus } ; return ray3f ( transform_point ( cam -> frame , o ) , transform_direction ( cam -> frame , normalize ( q - o ) ) ) ; }
Generates a ray ray_o, ray_d from a camera cam for image plane coordinate
uv and the lens coordinates luv.
Generates a ray ray_o ray_d from a camera cam for image plane coordinate uv and the lens coordinates luv .