diff --git a/stim/gl/gl_spider.h b/stim/gl/gl_spider.h index 80325d7..2b1a884 100644 --- a/stim/gl/gl_spider.h +++ b/stim/gl/gl_spider.h @@ -73,8 +73,8 @@ class gl_spider dV[best][1]*S[1]*R[1], dV[best][2]*S[2]*R[2], 1); - //next = (cT*next).norm(); next = (cT*next).norm(); + //next = (cT*next); setPosition( p[0]+next[0]*m[0]/stepsize, p[1]+next[1]*m[0]/stepsize, p[2]+next[2]*m[0]/stepsize); @@ -522,11 +522,11 @@ class gl_spider gl_spider (int samples = 1089) { - p.push(0.0,0.0,0.0); - d.push(0.0,0.0,1.0); - m.push(1.0, 1.0); - S.push(1.0,1.0,1.0); - R.push(1.0,1.0,1.0); + p = vec(0.0, 0.0, 0.0); + d = vec(0.0, 0.0, 1.0); + m = vec(1.0, 1.0); + S = vec(1.0, 1.0, 1.0); + R = vec(1.0, 1.0, 1.0); //setPosition(0.0,0.0,0.0); //setDirection(0.0,0.0,1.0); //setMagnitude(1.0); @@ -538,11 +538,11 @@ class gl_spider (float pos_x, float pos_y, float pos_z, float dir_x, float dir_y, float dir_z, float mag_x, int numSamples = 1089) { - p.push(pos_x, pos_y, pos_z); - d.push(dir_x, dir_y, dir_z); - m.push(mag_x, mag_x); - S.push(1.0,1.0,1.0); - R.push(1.0,1.0,1.0); + p = vec(pos_x, pos_y, pos_z); + d = vec(dir_x, dir_y, dir_z); + m = vec(mag_x, mag_x); + S = vec(1.0,1.0,1.0); + R = vec(1.0,1.0,1.0); //setPosition(pos_x, pos_y, pos_z); //setDirection(dir_x, dir_y, dir_z); //setMagnitude(mag_x); @@ -734,8 +734,8 @@ class gl_spider { Bind(); findOptimalDirection(); - findOptimalPosition(); - findOptimalScale(); + //findOptimalPosition(); + //findOptimalScale(); // branchDetection(); Unbind(); } diff --git a/stim/math/mathvec.h b/stim/math/mathvec.h index d8523dc..9e1de54 100644 --- a/stim/math/mathvec.h +++ b/stim/math/mathvec.h @@ -19,36 +19,36 @@ struct vec : public std::vector using std::vector::at; using std::vector::resize; using std::vector::push_back; - vec(){ + CUDA_CALLABLE vec(){ } // //efficiency constructors, makes construction easier for 1D-4D vectors - vec(T rhs) - { - resize(1, rhs); +// CUDA_CALLABLE vec(T rhs) +// { +// resize(1, rhs); // cerr << " Created a vector " << endl; // //for(int i=0; i //copy constructor - vec( const vec& other){ + CUDA_CALLABLE vec( const vec& other){ unsigned int N = other.size(); for(int i=0; i push(T x) + CUDA_CALLABLE vec push(T x) { push_back(x); return *this; } - vec push(T x, T y) + CUDA_CALLABLE vec push(T x, T y) { push_back(x); push_back(y); return *this; } - vec push(T x, T y, T z) + CUDA_CALLABLE vec push(T x, T y, T z) { push_back(x); push_back(y); push_back(z); return *this; } - vec push(T x, T y, T z, T w) + CUDA_CALLABLE vec push(T x, T y, T z, T w) { push_back(x); push_back(y); @@ -93,7 +93,7 @@ struct vec : public std::vector return *this; } template< typename U > - operator vec(){ + CUDA_CALLABLE operator vec(){ unsigned int N = size(); vec result; for(int i=0; i //template //friend vec::operator vec(); - T len() const + CUDA_CALLABLE T len() const { unsigned int N = size(); @@ -119,7 +119,7 @@ struct vec : public std::vector } - vec cart2sph() const + CUDA_CALLABLE vec cart2sph() const { //convert the vector from cartesian to spherical coordinates //x, y, z -> r, theta, phi (where theta = 0 to 2*pi) @@ -136,7 +136,7 @@ struct vec : public std::vector return sph; } - vec sph2cart() const + CUDA_CALLABLE vec sph2cart() const { //convert the vector from cartesian to spherical coordinates //r, theta, phi -> x, y, z (where theta = 0 to 2*pi) @@ -149,7 +149,7 @@ struct vec : public std::vector return cart; } - vec norm() const + CUDA_CALLABLE vec norm() const { unsigned int N = size(); @@ -168,7 +168,7 @@ struct vec : public std::vector return result; } - vec cross(const vec rhs) const + CUDA_CALLABLE vec cross(const vec rhs) const { vec result; @@ -180,7 +180,7 @@ struct vec : public std::vector return result; } - T dot(vec rhs) const + CUDA_CALLABLE T dot(vec rhs) const { T result = (T)0; unsigned int N = size(); @@ -192,7 +192,7 @@ struct vec : public std::vector } //arithmetic - vec operator+(vec rhs) const + CUDA_CALLABLE vec operator+(vec rhs) const { vec result; @@ -202,7 +202,7 @@ struct vec : public std::vector return result; } - vec operator+(T rhs) const + CUDA_CALLABLE vec operator+(T rhs) const { vec result; unsigned int N = size(); @@ -211,7 +211,7 @@ struct vec : public std::vector return result; } - vec operator-(vec rhs) const + CUDA_CALLABLE vec operator-(vec rhs) const { vec result; @@ -221,7 +221,7 @@ struct vec : public std::vector return result; } - vec operator*(T rhs) const + CUDA_CALLABLE vec operator*(T rhs) const { vec result; @@ -231,7 +231,7 @@ struct vec : public std::vector return result; } - vec operator/(T rhs) const + CUDA_CALLABLE vec operator/(T rhs) const { vec result; @@ -241,20 +241,20 @@ struct vec : public std::vector return result; } - vec operator*=(T rhs){ + CUDA_CALLABLE vec operator*=(T rhs){ unsigned int N = size(); for(int i=0; i operator+=(vec rhs){ + CUDA_CALLABLE vec operator+=(vec rhs){ unsigned int N = size(); for(int i=0; i & operator=(T rhs){ + CUDA_CALLABLE vec & operator=(T rhs){ unsigned int N = size(); for(int i=0; i } template - vec & operator=(vec rhs){ + CUDA_CALLABLE vec & operator=(vec rhs){ unsigned int N = rhs.size(); resize(N); @@ -272,7 +272,7 @@ struct vec : public std::vector return *this; } //unary minus - vec operator-() const{ + CUDA_CALLABLE vec operator-() const{ vec r; //negate the vector @@ -317,7 +317,7 @@ std::ostream& operator<<(std::ostream& os, stim::vec v) template -stim::vec operator*(T lhs, stim::vec rhs) +CUDA_CALLABLE stim::vec operator*(T lhs, stim::vec rhs) { stim::vec r; -- libgit2 0.21.4