diff --git a/particle.h b/particle.h index cf1a7c808166433cdeec51c9ca43018596f7c3fc..b5220fd57a527878503132804cafdc40fcf90441 100644 --- a/particle.h +++ b/particle.h @@ -178,7 +178,12 @@ namespace PARTICLE{ } } - + + void set_dir(const float& rx,const float& ry,const float& rz){ + m_rx=rx;m_ry=ry;m_rz=rz;m_has_jumped=true; + } + + bool check_dir(const float& theta,const float& phi, const float& thr){ if(m_has_jumped){ float rx_new=cos(phi)*sin(theta); diff --git a/probtrack.cc b/probtrack.cc index e69de89f06592712b8ab0248406675255a453165..20301ae33f6be22efc740e53111ad3ab021bf72e 100644 --- a/probtrack.cc +++ b/probtrack.cc @@ -1923,7 +1923,7 @@ void meshtrack(){ x=xst;y=yst;z=zst; part.change_xyz(x,y,z); - + part.set_dir((*i)->local_normal().X,(*i)->local_normal().Y,(*i)->local_normal().Z);//Set the start dir so that we track inwards from cortex for( int it = 1 ; it <= nsteps/2; it++){ if( (mask( round(part.x()), round(part.y()), round(part.z())) == 1) ){ if(opts.loopcheck.value()){ @@ -1989,7 +1989,8 @@ void meshtrack(){ tmp2=rand(); tmp2/=RAND_MAX; if(th_ph_f(3)>tmp2){ - if(!part.check_dir(th_ph_f(1),th_ph_f(2),opts.c_thr.value())){ + if(!part.check_dir(th_ph_f(1),th_ph_f(2),opts.c_thr.value()) && it!=1){ + //Don't do curvature checking on the first step as we have set the old direction to the surface normal break; }