1. 4FIPS
  2. PHOTOS
  3. VIDEOS
  4. APPS
  5. CODE
  6. FORUMS
  7. ABOUT
/*
(c) 2013 +++ Filip Stoklas, aka FipS, http://www.4FipS.com +++
THIS CODE IS FREE - LICENSED UNDER THE MIT LICENSE
ARTICLE URL: http://forums.4fips.com/viewtopic.php?f=3&t=1068
*/

#include "vector3.h"

template <typename T>
inline Vector3<T>::Vector3():
x(T(0)), y(T(0)), z(T(0))
{
}

template <typename T>
inline Vector3<T>::Vector3(T x, T y, T z):
x(x), y(y), z(z)
{
}

template <typename T>
inline T dot(const Vector3<T> &a, const Vector3<T> &b)
{
    return a.x*b.x + a.y*b.y + a.z*b.z;
}

//--- Vector3<float> ---

#define T float
template struct Vector3<T>; // explicit type instantiation
template T dot(const Vector3<T> &a, const Vector3<T> &b); // explicit function instantiation
#undef T

//--- Vector3<double> ---

#define T double
template struct Vector3<T>; // explicit type instantiation
template T dot(const Vector3<T> &a, const Vector3<T> &b); // explicit function instantiation
#undef T