INFO804 Introduction à l'informatique graphique
Loading...
Searching...
No Matches
TP2
Ray.h
Go to the documentation of this file.
1
/**
2
@file Ray.h
3
@author JOL
4
*/
5
#pragma once
6
#ifndef _RAY_H_
7
#define _RAY_H_
8
9
#include "
PointVector.h
"
10
11
// @see http://devernay.free.fr/cours/opengl/materials.html
12
13
/// Namespace RayTracer
14
namespace
rt
{
15
16
/// This structure stores a ray having an origin and a direction. It
17
/// also stores its depth.
18
struct
Ray
{
19
/// origin of the ray.
20
Point3
origin
;
21
/// unit direction of the ray.
22
Vector3
direction
;
23
/// depth of the ray, i.e. the number of times it can bounce on an object.
24
int
depth
;
25
26
/// Default constructor
27
Ray
() {}
28
29
/// Constructor from origin and vector. The vector may not be unitary.
30
Ray
(
const
Point3
& o,
const
Vector3
& dir,
int
d = 1 )
31
:
origin
( o ),
direction
( dir ),
depth
( d )
32
{
33
Real
l =
direction
.norm();
34
if
( l != 1.0f )
direction
/= l;
35
}
36
};
37
38
39
40
}
// namespace rt
41
42
#endif
// #define _RAY_H_
PointVector.h
rt
Namespace RayTracer.
Definition
Color.h:11
rt::Real
float Real
the type for representing a real number.
Definition
PointVector.h:206
rt::PointVector< Real, 3 >
rt::Ray
Definition
Ray.h:18
rt::Ray::Ray
Ray(const Point3 &o, const Vector3 &dir, int d=1)
Constructor from origin and vector. The vector may not be unitary.
Definition
Ray.h:30
rt::Ray::origin
Point3 origin
origin of the ray.
Definition
Ray.h:20
rt::Ray::depth
int depth
depth of the ray, i.e. the number of times it can bounce on an object.
Definition
Ray.h:24
rt::Ray::direction
Vector3 direction
unit direction of the ray.
Definition
Ray.h:22
rt::Ray::Ray
Ray()
Default constructor.
Definition
Ray.h:27
Generated on Fri Feb 16 2024 16:17:55 for INFO804 Introduction à l'informatique graphique by
1.9.8