ray: add convenience point-point constructor
This commit is contained in:
parent
b1263e8f14
commit
1be5be38ea
13
ray.cpp
13
ray.cpp
@ -32,6 +32,19 @@ ray<S,T>::ray (util::point<S,T> _origin,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
template <size_t S, typename T>
|
||||||
|
ray<S,T>
|
||||||
|
ray<S,T>::make (util::point<S,T> origin,
|
||||||
|
util::point<S,T> target)
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
origin,
|
||||||
|
(target - origin).normalised ()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/// returns the distance along the ray in a ray-plane intersection
|
/// returns the distance along the ray in a ray-plane intersection
|
||||||
///
|
///
|
||||||
|
4
ray.hpp
4
ray.hpp
@ -32,6 +32,10 @@ namespace util {
|
|||||||
ray (point<S,T> origin,
|
ray (point<S,T> origin,
|
||||||
vector<S,T> direction);
|
vector<S,T> direction);
|
||||||
|
|
||||||
|
static
|
||||||
|
ray<S,T> make (point<S,T> origin,
|
||||||
|
point<S,T> target);
|
||||||
|
|
||||||
// intersection tests
|
// intersection tests
|
||||||
T intersect (plane<S,T>) const;
|
T intersect (plane<S,T>) const;
|
||||||
T intersect (AABB<S,T>) const;
|
T intersect (AABB<S,T>) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user