fixed copying of library links in install target
[gph-math] / src / ray.h
index 2574036..95f6438 100644 (file)
--- a/src/ray.h
+++ b/src/ray.h
@@ -1,3 +1,12 @@
+/*
+gph-math - math library for graphics programs
+Copyright (C) 2016 John Tsiombikas <nuclear@member.fsf.org>
+
+This program is free software. Feel free to use, modify, and/or redistribute
+it under the terms of the MIT/X11 license. See LICENSE for details.
+If you intend to redistribute parts of the code without the LICENSE file
+replace this paragraph with the full contents of the LICENSE file.
+*/
 #ifndef GMATH_RAY_H_
 #define GMATH_RAY_H_
 
@@ -11,7 +20,7 @@ public:
        Vector3 origin, dir;
 
        Ray() : dir(0, 0, 1) {}
-       Ray(const Vector3 &o, const Vector3 &d) : o(origin), d(dir) {}
+       Ray(const Vector3 &o, const Vector3 &d) : origin(o), dir(d) {}
 };
 
 inline Ray operator *(const Ray &r, const Matrix4x4 &m)
@@ -20,7 +29,7 @@ inline Ray operator *(const Ray &r, const Matrix4x4 &m)
        up[0][3] = up[1][3] = up[2][3] = up[3][0] = up[3][1] = up[3][2] = 0.0;
        up[3][3] = 1.0;
 
-       return Ray(origin * m, dir * up);
+       return Ray(r.origin * m, r.dir * up);
 }
 
 inline Ray operator *(const Matrix4x4 &m, const Ray &r)
@@ -29,7 +38,7 @@ inline Ray operator *(const Matrix4x4 &m, const Ray &r)
        up[0][3] = up[1][3] = up[2][3] = up[3][0] = up[3][1] = up[3][2] = 0.0;
        up[3][3] = 1.0;
 
-       return Ray(m * origin, m * dir);
+       return Ray(m * r.origin, m * r.dir);
 }
 
 
@@ -49,6 +58,6 @@ inline Ray refract(const Ray &ray, const Vector3 &n, float from_ior, float to_io
 }
 
 
-}
+}      // namespace gph
 
 #endif // GMATH_RAY_H_