diff --git a/quaternion.cc b/quaternion.cc index 3ed9294..2e6f5db 100644 --- a/quaternion.cc +++ b/quaternion.cc @@ -19,9 +19,9 @@ #include "quaternion.h" #include "vecmat3.h" -using namespace LA_Quaternion; using namespace LA_Vecmat3; +namespace LA_Quaternion { //do not replicate this code in each object file, therefore not in .h //and instantize the templates for the types needed @@ -357,7 +357,7 @@ axis[2]= q[3]*s; template -Quaternion LA_Quaternion::exp(const Quaternion &x) +Quaternion exp(const Quaternion &x) { Quaternion r; T vnorm = sqrt(x[1]*x[1]+x[2]*x[2]+x[3]*x[3]); @@ -374,7 +374,7 @@ return r; //NOTE: log(exp(x)) need not be always = x ... log is not unique! //NOTE2: log(x*y) != log(y*x) != log(x)+log(y) template -Quaternion LA_Quaternion::log(const Quaternion &x) +Quaternion log(const Quaternion &x) { Quaternion r; T vnorm = x[1]*x[1]+x[2]*x[2]+x[3]*x[3]; @@ -391,7 +391,7 @@ return r; template -Quaternion LA_Quaternion::pow(const Quaternion &x, const T &y) +Quaternion pow(const Quaternion &x, const T &y) { Quaternion r; T vnorm = x[1]*x[1]+x[2]*x[2]+x[3]*x[3]; @@ -411,9 +411,9 @@ return r; //force instantization #define INSTANTIZE(T) \ template class Quaternion; \ -template Quaternion LA_Quaternion::pow(const Quaternion &x, const T &y); \ -template Quaternion LA_Quaternion::log(const Quaternion &x); \ -template Quaternion LA_Quaternion::exp(const Quaternion &x); \ +template Quaternion pow(const Quaternion &x, const T &y); \ +template Quaternion log(const Quaternion &x); \ +template Quaternion exp(const Quaternion &x); \ @@ -422,4 +422,4 @@ INSTANTIZE(float) INSTANTIZE(double) #endif - +} //namespace