A Ray class in basics!
This commit is contained in:
parent
b41cdb7186
commit
9aa557293a
4 changed files with 62 additions and 0 deletions
|
@ -7,6 +7,7 @@ Import('env')
|
|||
|
||||
files = [
|
||||
'matrix.cc',
|
||||
'ray.cc',
|
||||
'vector.cc',
|
||||
]
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#define __BASICS_BASICS_HH__
|
||||
|
||||
#include "basics/matrix.hh"
|
||||
#include "basics/ray.hh"
|
||||
#include "basics/types.hh"
|
||||
#include "basics/vector.hh"
|
||||
|
||||
|
|
35
src/basics/ray.cc
Normal file
35
src/basics/ray.cc
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* ray.cc
|
||||
* vim: set tw=80:
|
||||
* Eryn Wells <eryn@erynwells.me>
|
||||
*/
|
||||
|
||||
#include "basics/ray.hh"
|
||||
|
||||
|
||||
namespace charles {
|
||||
namespace basics {
|
||||
|
||||
/*
|
||||
* charles::basics::Ray::Ray --
|
||||
*/
|
||||
Ray::Ray(Vector4 o,
|
||||
Vector4 d)
|
||||
: origin(o),
|
||||
direction(d)
|
||||
{ }
|
||||
|
||||
|
||||
/*
|
||||
* charles::basics::Ray::Parameterize --
|
||||
*/
|
||||
Vector4
|
||||
Ray::Parameterize(const Double& t)
|
||||
const
|
||||
{
|
||||
return origin + direction * t;
|
||||
}
|
||||
|
||||
|
||||
} /* namespace basics */
|
||||
} /* namespace charles */
|
||||
|
25
src/basics/ray.hh
Normal file
25
src/basics/ray.hh
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* ray.hh
|
||||
* vim: set tw=80:
|
||||
* Eryn Wells <eryn@erynwells.me>
|
||||
*/
|
||||
|
||||
#include "basics/types.hh"
|
||||
#include "basics/vector.hh"
|
||||
|
||||
|
||||
namespace charles {
|
||||
namespace basics {
|
||||
|
||||
struct Ray
|
||||
{
|
||||
Ray(Vector4 o = Vector4(), Vector4 d = Vector4());
|
||||
|
||||
Vector4 Parameterize(const Double& t) const;
|
||||
|
||||
Vector4 origin;
|
||||
Vector4 direction;
|
||||
};
|
||||
|
||||
} /* namespace basics */
|
||||
} /* namespace charles */
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue