From a36c385045865d354d3a9876fa97057fc194c2ae Mon Sep 17 00:00:00 2001 From: pgovyadi Date: Mon, 29 Aug 2016 16:16:10 -0500 Subject: [PATCH] fixed the bug that cause the segfault --- stim/gl/gl_spider.h | 16 ++++++---------- stim/visualization/cylinder.h | 7 +------ 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/stim/gl/gl_spider.h b/stim/gl/gl_spider.h index b7524b8..53242a4 100644 --- a/stim/gl/gl_spider.h +++ b/stim/gl/gl_spider.h @@ -240,6 +240,7 @@ class gl_spider // : public virtual gl_texture if(cL.size() < 4){} ///if the size of the fiber is less then 4 we do nothing. else{ setMatrix(1); ///finds the current transformation matrix + DrawLongCylinder(n, l_template, l_square); ///Draw the cylinder. stim::cylinder cyl(cL, cM); std::vector< stim::vec > result = find_branch(cylinder_texID, GL_TEXTURE_2D, n*l_square, (cL.size()-1)*l_template); ///find all the centers in cuda @@ -734,7 +735,6 @@ class gl_spider // : public virtual gl_texture gl_spider (int samples = 1089, int samplespos = 441,int samplesmag = 144) { -// std::cout << "I ran this constructor" << std::endl; p = stim::vec3(0.0, 0.0, 0.0); d = stim::vec3(0.0, 0.0, 1.0); m = 1.0; @@ -1015,7 +1015,6 @@ class gl_spider // : public virtual gl_texture void setSeedMag(float mag) { -// std::cout << "sMag: " << mag << std::endl; seedsmags.push(mag); } @@ -1028,7 +1027,6 @@ class gl_spider // : public virtual gl_texture void setSeed(float x, float y, float z) { -// std::cout << "sPos: " << x << " " << y << " " << z << std::endl; seeds.push(stim::vec(x, y, z)); } @@ -1039,7 +1037,6 @@ class gl_spider // : public virtual gl_texture void setSeedVec(float x, float y, float z) { -// std::cout << "sDir: " << x << " " << y << " " << z << std::endl; seedsvecs.push(stim::vec(x, y, z)); } @@ -1375,7 +1372,6 @@ class gl_spider // : public virtual gl_texture // cL.push_back(curSeed); // cM.push_back(curSeedMag); // cD.push_back(curSeedMag); - std::cout << p << m << std::endl; traceLine(p, m, min_cost); } } @@ -1564,7 +1560,7 @@ class gl_spider // : public virtual gl_texture { //starting (seed) position and magnitude. stim::vec3 spos = getPosition(); - stim::vec smag = getMagnitude(); + float smag = getMagnitude(); stim::vec3 sdir = getDirection(); Bind(); @@ -1590,7 +1586,7 @@ class gl_spider // : public virtual gl_texture running = false; branchDetection2(); addToNetwork(cL, cM); - std::cout << "the cost of " << cost << " > " << min_cost << std::endl; + std::cerr << "the cost of " << cost << " > " << min_cost << std::endl; break; } else { //Have we found the edge of the map? @@ -1602,7 +1598,7 @@ class gl_spider // : public virtual gl_texture running = false; branchDetection2(); addToNetwork(cL, cM); - std::cout << "I hit and edge" << std::endl; + std::cerr << "I hit and edge" << std::endl; break; } //If this is the first step in the trace, @@ -1618,7 +1614,7 @@ class gl_spider // : public virtual gl_texture running = false; branchDetection2(); addToNetwork(cL, cM); - std::cout << "The templates are too big" << std::endl; + std::cerr << "The templates are too big" << std::endl; break; } else @@ -1626,7 +1622,7 @@ class gl_spider // : public virtual gl_texture h = selectObject(p, getDirection(), m); //Have we hit something previously traced? if(h != -1){ - std::cout << "I hit the fiber " << h << std::endl; + std::cerr << "I hit the fiber " << h << std::endl; running = false; branchDetection2(); addToNetwork(cL, cM); diff --git a/stim/visualization/cylinder.h b/stim/visualization/cylinder.h index 24bc778..3d5bc64 100644 --- a/stim/visualization/cylinder.h +++ b/stim/visualization/cylinder.h @@ -221,13 +221,8 @@ class cylinder : centerline(inP) { std::vector > temp; - stim::vec zero; + stim::vec zero(0.0,0.0); temp.resize(inM.size(), zero); - for(int i = 0; i < inM.size(); i++) - { - std::cerr << inP[i] << " " << inM[i] << std::endl; - temp[i][0] = inM[i]; - } init(inP, temp); } -- libgit2 0.21.4