16 ray(
unsigned int n = 3) {
24 ray(
const vec<T>& origin,
const vec<T>& direction) : origin(origin), direction(direction) {
25 assert(origin.
dim() == directin.dim());
30 return origin + t * direction;
35typedef ray<float> rayn;
37typedef ray<double> drayn;
void fill(const T &v)
fill elements of vector with scalar v
void resize(unsigned dim)
resize the vector
unsigned dim() const
number of elements
Struct template for varying n-dimensional rays with arbitrary data type defined by origin and directi...
ray(const vec< T > &origin, const vec< T > &direction)
Construct a ray with given origin and direction. The given orign and direction must have the same dim...
vec< T > position(T t) const
Return the position of the ray at the given distance (ray parameter t) from its origin.
ray(unsigned int n=3)
Construct an invalid ray with origin at zero and undefined direction.