10template <
typename T, cgv::type::u
int32_type N>
26 return origin + t * direction;
55 fvec<T, 4> world_coord(window_coord.
x(), window_coord.
y(), T(1), T(1));
56 world_coord = inverse(view_projection_matrix) * world_coord;
57 world_coord /= world_coord.
w();
59 origin = eye_position;
60 direction = normalize(
fvec<T, 3>(world_coord) - eye_position);
65 return origin + t * direction;
matrix of fixed size dimensions
A vector with zero based index.
T & y()
return second component
T & x()
return first component
T & w()
return fourth component
this header is dependency free
cgv::math::fray< float, 3 > ray3
3d ray using 32 bit single precision floating point type
cgv::math::fray< float, 3 > ray4
4d ray using 32 bit single precision floating point type
cgv::math::fray< double, 3 > dray4
4d ray using 32 bit double precision floating point type
cgv::math::fray< unsigned, 3 > uray3
3d ray using 32 bit unsigned integer type
cgv::math::fray< int, 2 > iray2
2d ray using 32 bit signed integer type
cgv::math::fray< double, 3 > dray3
3d ray using 32 bit double precision floating point type
cgv::math::fray< double, 2 > dray2
2d ray using 32 bit double precision floating point type
cgv::math::fray< int, 3 > iray3
3d ray using 32 bit signed integer type
cgv::math::fray< float, 2 > ray2
2d ray using 32 bit single precision floating point type
cgv::math::fray< int, 3 > iray4
4d ray using 32 bit signed integer type
cgv::math::fray< unsigned, 3 > uray4
4d ray using 32 bit unsigned integer type
cgv::math::fray< unsigned, 2 > uray2
2d ray using 32 bit unsigned integer type
fray(const fvec< T, 2 > &screen_coord, const fvec< unsigned, 2 > &viewport_size, const fvec< T, 3 > &eye_position, const fmat< T, 4, 4 > &view_projection_matrix)
Construct a ray from a given screen coordinate and view parameters.
fray(const fvec< T, 3 > &origin, const fvec< T, 3 > &direction)
Construct a ray with given origin and direction.
fray()
Construct an invalid ray with origin at zero and undefined direction.
fvec< T, 3 > position(T t) const
Return the position of the ray at the given distance (ray parameter t) from its origin.
Struct template for fixed n-dimensional rays with arbitrary data type defined by origin and direction...
fray()
Construct an invalid ray with origin at zero and undefined direction.
fray(const fvec< T, N > &origin, const fvec< T, N > &direction)
Construct a ray with given origin and direction.
fvec< T, N > position(float t) const
Return the position of the ray at the given distance (ray parameter t) from its origin.