diff --git a/tools/pymol_asphere/src/cartesian.cpp b/tools/pymol_asphere/src/cartesian.cpp index d412d2ee43..2328e97151 100755 --- a/tools/pymol_asphere/src/cartesian.cpp +++ b/tools/pymol_asphere/src/cartesian.cpp @@ -169,12 +169,6 @@ TwoD TwoD::normal() { return TwoD(y,x*numtyp(-1)); } -template -numtyp TwoD::dist(const TwoD &two) const { - TwoD diff=*this-two; - return numtyp(sqrt(double(diff.dot(diff)))); -} - template numtyp TwoD::dist2(const TwoD &two) const { TwoD diff=*this-two; @@ -293,26 +287,6 @@ template ThreeD::ThreeD() { } -template -numtyp & ThreeD::operator[](unsigned i) { - switch(i) { - case X: return x; - case Y: return y; - case Z: return z; - } - return x; -} - -template -numtyp ThreeD::operator[](unsigned i) const { - switch(i) { - case X: return x; - case Y: return y; - case Z: return z; - } - return x; -} - template void ThreeD::operator = (const ThreeD &two) { #ifdef NANCHECK @@ -396,11 +370,6 @@ numtyp ThreeD::dot(const ThreeD &two) const { return (x*two.x+y*two.y+z*two.z); } -template -void ThreeD::operator *= (const numtyp &two) { - x*=two; y*=two; z*=two; -} - // Move coordinates into array template void ThreeD::to_array(numtyp *array) { @@ -499,27 +468,12 @@ numtyp ThreeD::norm2() const { return x*x+y*y+z*z; } -template -numtyp ThreeD::dist(const ThreeD &two) { - return (*this-two).norm(); -} - template numtyp ThreeD::dist2(const ThreeD &two) { ThreeD diff=*this-two; return diff.dot(diff); } -// For normalizing a vector -template -void ThreeD::normalize() { - numtyp temp=norm(); - #ifdef NANCHECK - assert(temp!=0); - #endif - *this/=temp; -} - // Return unit vector template ThreeD ThreeD::unit() { diff --git a/tools/pymol_asphere/src/cartesian.h b/tools/pymol_asphere/src/cartesian.h index 416a229975..a486b5163e 100755 --- a/tools/pymol_asphere/src/cartesian.h +++ b/tools/pymol_asphere/src/cartesian.h @@ -204,8 +204,23 @@ class ThreeD { friend ThreeD operator* <>(const numtyp, const ThreeD &two); friend ThreeD operator/ <>(const numtyp, const ThreeD &two); - numtyp &operator[](unsigned i); - numtyp operator[](unsigned i) const; + inline numtyp &operator[](unsigned i) { + switch(i) { + case X: return x; + case Y: return y; + case Z: return z; + } + return x; + } + + inline numtyp operator[](unsigned i) const { + switch(i) { + case X: return x; + case Y: return y; + case Z: return z; + } + return x; + } bool operator == (const ThreeD &two) const; bool operator != (const ThreeD &two) const; @@ -222,7 +237,10 @@ class ThreeD { void operator += (const ThreeD &two); void operator -= (const numtyp &two); void operator -= (const ThreeD &two); - void operator *= (const numtyp &two); + inline void operator *= (const numtyp &two) { + x*=two; y*=two; z*=two; + } + void operator /= (const numtyp &two); /// Move coordinates into array @@ -253,11 +271,20 @@ class ThreeD { /// Magnitude of vector numtyp hypot() const; /// Distance between two points - numtyp dist(const ThreeD &two); + inline numtyp dist(const ThreeD &two) { + return (*this-two).norm(); + } /// Distance squared between two points numtyp dist2(const ThreeD &two); /// Converts \b *this to the unit vector - void normalize(); + inline void normalize() { + numtyp temp=norm(); + #ifdef NANCHECK + assert(temp!=0); + #endif + *this/=temp; + } + /// Return the unit vector of \b *this ThreeD unit(); diff --git a/tools/pymol_asphere/src/glsurface.cpp b/tools/pymol_asphere/src/glsurface.cpp index e61498607e..ffeb11ecf8 100755 --- a/tools/pymol_asphere/src/glsurface.cpp +++ b/tools/pymol_asphere/src/glsurface.cpp @@ -333,7 +333,8 @@ void GLSurface::write_vspheres(ofstream &out, const string &objname, writepymolheader(out); for (i=0; i