Commit ac2781358f367d42bb5783bf248230d54472c1b4
1 parent
ac5ae422
new stuff here
Showing
3 changed files
with
15 additions
and
11 deletions
Show diff stats
stim/biomodels/network.h
stim/visualization/cylinder.h
@@ -54,13 +54,15 @@ public: | @@ -54,13 +54,15 @@ public: | ||
54 | { | 54 | { |
55 | R = s; | 55 | R = s; |
56 | init(); | 56 | init(); |
57 | - { | 57 | + } |
58 | 58 | ||
59 | +/* | ||
59 | cylinder(stim::centerline<T> p, std::vector<T> s) | 60 | cylinder(stim::centerline<T> p, std::vector<T> s) |
60 | { | 61 | { |
61 | - d = s; | 62 | + d = p; |
62 | init(); | 63 | init(); |
63 | - { | 64 | + } |
65 | +*/ | ||
64 | 66 | ||
65 | //cylinder(centerline<T>c, T r) : centerline(c) { | 67 | //cylinder(centerline<T>c, T r) : centerline(c) { |
66 | // init(); | 68 | // init(); |
stim/visualization/gl_network.h
@@ -156,9 +156,11 @@ public: | @@ -156,9 +156,11 @@ public: | ||
156 | } | 156 | } |
157 | 157 | ||
158 | ///render the network cylinder as a series of tubes(when only one network loaded) | 158 | ///render the network cylinder as a series of tubes(when only one network loaded) |
159 | - void glCylinder0() { | 159 | + void glCylinder0(T scale = 1.0f, bool undo = false) { |
160 | 160 | ||
161 | float r1, r2; | 161 | float r1, r2; |
162 | + if (undo == true) | ||
163 | + glDeleteLists(dlist, 1); // delete display list | ||
162 | if (!glIsList(dlist)) { // if dlist isn't a display list, create it | 164 | if (!glIsList(dlist)) { // if dlist isn't a display list, create it |
163 | dlist = glGenLists(1); // generate a display list | 165 | dlist = glGenLists(1); // generate a display list |
164 | glNewList(dlist, GL_COMPILE); // start a new display list | 166 | glNewList(dlist, GL_COMPILE); // start a new display list |
@@ -167,10 +169,10 @@ public: | @@ -167,10 +169,10 @@ public: | ||
167 | stim::circle<T> C1 = E[e].circ(p - 1); | 169 | stim::circle<T> C1 = E[e].circ(p - 1); |
168 | stim::circle<T> C2 = E[e].circ(p); | 170 | stim::circle<T> C2 = E[e].circ(p); |
169 | r1 = E[e].r(p - 1); | 171 | r1 = E[e].r(p - 1); |
170 | - r2 = E[e].r(p); | ||
171 | - C1.set_R(r1); // re-scale the circle to the same | ||
172 | - C2.set_R(r2); | ||
173 | - std::vector< stim::vec3<T> > Cp1 = C1.glpoints(20);// get 20 points on the circle plane | 172 | + r2 = E[e].r(p); |
173 | + C1.set_R(scale * r1); // re-scale the circle to the same | ||
174 | + C2.set_R(scale * r2); | ||
175 | + std::vector< stim::vec3<T> > Cp1 = C1.glpoints(20); // get 20 points on the circle plane | ||
174 | std::vector< stim::vec3<T> > Cp2 = C2.glpoints(20); | 176 | std::vector< stim::vec3<T> > Cp2 = C2.glpoints(20); |
175 | glBegin(GL_QUAD_STRIP); | 177 | glBegin(GL_QUAD_STRIP); |
176 | for (unsigned i = 0; i < Cp1.size(); i++) { | 178 | for (unsigned i = 0; i < Cp1.size(); i++) { |
@@ -183,11 +185,11 @@ public: | @@ -183,11 +185,11 @@ public: | ||
183 | for (unsigned n = 0; n < V.size(); n++) { | 185 | for (unsigned n = 0; n < V.size(); n++) { |
184 | for (unsigned i = 0; i < E.size(); i++) { | 186 | for (unsigned i = 0; i < E.size(); i++) { |
185 | if (E[i].v[0] == n) { | 187 | if (E[i].v[0] == n) { |
186 | - r1 = E[i].r(0); | 188 | + r1 = E[i].r(0) * scale; |
187 | break; | 189 | break; |
188 | } | 190 | } |
189 | else if (E[i].v[1] == n) { | 191 | else if (E[i].v[1] == n) { |
190 | - r1 = E[i].r(E[i].size() - 1); | 192 | + r1 = E[i].r(E[i].size() - 1) * scale; |
191 | break; | 193 | break; |
192 | } | 194 | } |
193 | } | 195 | } |