]> git.tdb.fi Git - libs/math.git/blobdiff - source/linal/vector3.h
Beginnings of a geometry library
[libs/math.git] / source / linal / vector3.h
index 90a5ff5fc468a77ea439b7b5d3e52667ac75ef98..4a623cafef1443cd194c38efd30351c0ac055c40 100644 (file)
@@ -14,17 +14,12 @@ class Vector3: public Vector<T, 3>
 {
 public:
        Vector3() { }
-       Vector3(const T *);
+       Vector3(const T *d): Vector<T, 3>(d) { }
        Vector3(T, T, T);
        template<typename U>
-       Vector3(const Vector<U, 3> &);
+       Vector3(const Vector<U, 3> &v): Vector<T, 3>(v) { }
 };
 
-template<typename T>
-inline Vector3<T>::Vector3(const T *d):
-       Vector<T, 3>(d)
-{ }
-
 template<typename T>
 inline Vector3<T>::Vector3(T x, T y, T z)
 {
@@ -34,24 +29,18 @@ inline Vector3<T>::Vector3(T x, T y, T z)
 }
 
 template<typename T>
-template<typename U>
-inline Vector3<T>::Vector3(const Vector<U, 3> &v):
-       Vector<T, 3>(v)
-{ }
-
-template<typename T>
-inline T dot(const Vector3<T> &v1, const Vector3<T> &v2)
+inline T dot(const Vector<T, 3> &v1, const Vector<T, 3> &v2)
 {
        return inner_product(v1, v2);
 }
 
 template<typename T>
-inline Vector3<T> cross(const Vector3<T> &v1, const Vector3<T> &v2)
+inline Vector<T, 3> cross(const Vector<T, 3> &v1, const Vector<T, 3> &v2)
 {
-       return Vector3<T>(v1[1]*v2[2]-v1[2]*v2[1], v1[2]*v2[0]-v1[0]*v2[2], v1[0]*v2[1]-v1[1]*v2[0]);
+       return Vector<T, 3>(v1[1]*v2[2]-v1[2]*v2[1], v1[2]*v2[0]-v1[0]*v2[2], v1[0]*v2[1]-v1[1]*v2[0]);
 }
 
 } // namespace LinAl
-} // namespace LinAl
+} // namespace Msp
 
 #endif