From d0bf00a9ace745576e88282cc549ec6b99affff0 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 15 Apr 2015 18:00:37 +1000 Subject: [PATCH] ray: style --- ray.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ray.cpp b/ray.cpp index 6db135e8..dcc3cb71 100644 --- a/ray.cpp +++ b/ray.cpp @@ -18,11 +18,13 @@ #include "debug.hpp" +using util::ray; + /////////////////////////////////////////////////////////////////////////////// template -util::ray::ray (util::point _origin, - util::vector _direction): +ray::ray (util::point _origin, + util::vector _direction): origin (_origin), direction (_direction) { @@ -37,7 +39,7 @@ util::ray::ray (util::point _origin, /// returns 0 if corayar template T -util::ray::intersect (plane q) const +ray::intersect (plane q) const { return dot (q.p - origin, q.n) / dot (direction, q.n); } @@ -50,7 +52,7 @@ util::ray::intersect (plane q) const /// returns NaN if behind template T -util::ray::intersect (AABB r) const +ray::intersect (AABB r) const { auto t1 = (r.p0 - origin) / direction; auto t2 = (r.p1 - origin) / direction; @@ -80,7 +82,7 @@ util::ray::intersect (AABB r) const /// returns NaN if behind template T -util::ray::intersect (sphere s) const +ray::intersect (sphere s) const { T b = dot (direction, origin - s.centre); T c = dot (origin - s.centre, origin - s.centre) - s.radius * s.radius; @@ -103,7 +105,7 @@ util::ray::intersect (sphere s) const /// returns the closest parameter along the ray to a given point template T -util::ray::closest (point q) const +ray::closest (point q) const { // project the origin-point difference onto the direction return dot (origin - q, direction); @@ -113,7 +115,7 @@ util::ray::closest (point q) const //----------------------------------------------------------------------------- template util::point -util::ray::at (T t) const +ray::at (T t) const { return origin + direction * t; }