Commit 25580fe76f0522b80a5d7d445c146fa8eccb927c
1 parent
556c4e15
minor bug fix in the genDirectionVectors function
Showing
1 changed file
with
10 additions
and
11 deletions
Show diff stats
stim/gl/gl_spider.h
... | ... | @@ -64,9 +64,9 @@ class gl_spider : public virtual gl_texture<T> |
64 | 64 | genTemplate(dirVectors, 0); |
65 | 65 | int best = getCost(); |
66 | 66 | stim::vec<float, 4> next; |
67 | - next[0] = dirVectors[best][0]*512.0*0.6; | |
68 | - next[1] = dirVectors[best][1]*512.0*0.6; | |
69 | - next[2] = dirVectors[best][2]*512.0*0.6; | |
67 | + next[0] = dirVectors[best][0]*S[1]*R[1]; | |
68 | + next[1] = dirVectors[best][1]*S[2]*R[2]; | |
69 | + next[2] = dirVectors[best][2]*S[3]*R[3]; | |
70 | 70 | next[3] = 1; |
71 | 71 | next = (currentTransform*next).norm(); |
72 | 72 | setPosition( position[0]+next[0]*magnitude[0]/4, |
... | ... | @@ -115,23 +115,22 @@ class gl_spider : public virtual gl_texture<T> |
115 | 115 | ///Method for populating the vector arrays with sampled vectors. |
116 | 116 | ///uses the default direction vector <0,0,1> |
117 | 117 | void |
118 | - genDirectionVectors(float solidAngle = M_PI/2) | |
118 | + genDirectionVectors(float solidAngle = M_PI) | |
119 | 119 | { |
120 | - | |
121 | 120 | vec<float> d_s = direction.cart2sph().norm(); |
122 | 121 | vec<float> temp; |
123 | 122 | int dim = (sqrt(numSamples)-1)/2; |
124 | - float p0 = M_PI/3; | |
125 | - float dt = solidAngle/(2.0 * (dim + 1)); | |
126 | - float dp = p0/(2.0*(dim + 1)); | |
123 | + float p0 = -M_PI; | |
124 | + float dt = solidAngle/(2.0 * ((float)dim + 1.0)); | |
125 | + float dp = p0/(2.0*((float)dim + 1.0)); | |
127 | 126 | |
128 | 127 | for(int i = -dim; i <= dim; i++){ |
129 | 128 | for(int j = -dim; j <= dim; j++){ |
130 | 129 | //Create linear index |
131 | 130 | |
132 | 131 | temp[0] = d_s[0]; //rotate vector |
133 | - temp[1] = d_s[1]+dt*i; | |
134 | - temp[2] = d_s[2]+dp*j; | |
132 | + temp[1] = d_s[1]+dp*(float) i; | |
133 | + temp[2] = d_s[2]+dt*(float) j; | |
135 | 134 | |
136 | 135 | temp = (temp.sph2cart()).norm(); //back to cart |
137 | 136 | dirVectors.push_back(temp); |
... | ... | @@ -541,7 +540,7 @@ class gl_spider : public virtual gl_texture<T> |
541 | 540 | genDirectionVectors(); |
542 | 541 | genPositionVectors(); |
543 | 542 | genMagnitudeVectors(); |
544 | - gl_texture<T>::setDims(0.6, 0.6, 2.0); | |
543 | + gl_texture<T>::setDims(0.6, 0.6, 1.0); | |
545 | 544 | setSize(512, 512, 426); |
546 | 545 | genTemplate(dirVectors, 0); |
547 | 546 | } | ... | ... |