operator: additional fix to FindPath
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>pull/7/merge
parent
6db63bdd19
commit
37246be398
|
@ -355,6 +355,14 @@ int Operator::SnapLine2Mesh(const double* start, const double* stop, unsigned in
|
||||||
SnapToMesh(start, uiStart, dualMesh, fullMesh, bStartIn);
|
SnapToMesh(start, uiStart, dualMesh, fullMesh, bStartIn);
|
||||||
SnapToMesh(stop, uiStop, dualMesh, fullMesh, bStopIn);
|
SnapToMesh(stop, uiStop, dualMesh, fullMesh, bStopIn);
|
||||||
|
|
||||||
|
for (int n=0;n<3;++n)
|
||||||
|
{
|
||||||
|
if ((start[n]<GetDiscLine(n,0)) && (stop[n]<GetDiscLine(n,0)))
|
||||||
|
return -1; //lower bound violation
|
||||||
|
if ((start[n]>GetDiscLine(n,GetNumberOfLines(n,true)-1)) && (stop[n]>GetDiscLine(n,GetNumberOfLines(n,true)-1)))
|
||||||
|
return -1; //upper bound violation
|
||||||
|
}
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (!(bStartIn[0] && bStartIn[1] && bStartIn[2]))
|
if (!(bStartIn[0] && bStartIn[1] && bStartIn[2]))
|
||||||
ret = ret + 1;
|
ret = ret + 1;
|
||||||
|
@ -376,7 +384,10 @@ struct Operator::Grid_Path Operator::FindPath(double start[], double stop[])
|
||||||
struct Grid_Path path;
|
struct Grid_Path path;
|
||||||
unsigned int uiStart[3],uiStop[3],currPos[3];
|
unsigned int uiStart[3],uiStop[3],currPos[3];
|
||||||
|
|
||||||
SnapLine2Mesh(start, stop, uiStart, uiStop, false, true);
|
int ret = SnapLine2Mesh(start, stop, uiStart, uiStop, false, true);
|
||||||
|
if (ret<0)
|
||||||
|
return path;
|
||||||
|
|
||||||
currPos[0]=uiStart[0];
|
currPos[0]=uiStart[0];
|
||||||
currPos[1]=uiStart[1];
|
currPos[1]=uiStart[1];
|
||||||
currPos[2]=uiStart[2];
|
currPos[2]=uiStart[2];
|
||||||
|
|
|
@ -278,37 +278,59 @@ struct Operator::Grid_Path Operator_Cylinder::FindPath(double start[], double st
|
||||||
{
|
{
|
||||||
double l_start[3];
|
double l_start[3];
|
||||||
double l_stop[3];
|
double l_stop[3];
|
||||||
if (stop[1]<start[1])
|
|
||||||
|
for (int n=0;n<3;++n)
|
||||||
|
{
|
||||||
|
l_start[n] = start[n];
|
||||||
|
l_stop[n] = stop[n];
|
||||||
|
}
|
||||||
|
|
||||||
|
while (fabs(l_stop[1]-l_start[1])>PI)
|
||||||
|
{
|
||||||
|
if (l_stop[1]>l_start[1])
|
||||||
|
l_stop[1]-=2*PI;
|
||||||
|
else
|
||||||
|
l_stop[1]+=2*PI;
|
||||||
|
}
|
||||||
|
|
||||||
|
double help=0;
|
||||||
|
if (l_start[1]>l_stop[1])
|
||||||
{
|
{
|
||||||
for (int n=0;n<3;++n)
|
for (int n=0;n<3;++n)
|
||||||
{
|
{
|
||||||
l_start[n] = stop[n];
|
help = l_start[n];
|
||||||
l_stop[n] = start[n];
|
l_start[n] = l_stop[n];
|
||||||
}
|
l_stop[n] = help;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int n=0;n<3;++n)
|
|
||||||
{
|
|
||||||
l_start[n] = start[n];
|
|
||||||
l_stop[n] = stop[n];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double a_start = FitToAlphaRange(l_start[1]);
|
double a_start = FitToAlphaRange(l_start[1]);
|
||||||
double a_stop = FitToAlphaRange(l_stop[1]);
|
double a_stop = FitToAlphaRange(l_stop[1]);
|
||||||
|
|
||||||
if (a_stop >= a_start)
|
if (a_stop >= a_start)
|
||||||
return Operator_Multithread::FindPath(start, stop);
|
{
|
||||||
|
l_start[1] = a_start;
|
||||||
|
l_stop[1] = a_stop;
|
||||||
|
return Operator_Multithread::FindPath(l_start, l_stop);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if a-stop fitted to disc range is now smaller than a-start, it must step over the a-bounds...
|
||||||
|
|
||||||
|
struct Grid_Path path;
|
||||||
|
for (int n=0;n<3;++n)
|
||||||
|
{
|
||||||
|
if ((l_start[n]<GetDiscLine(n,0)) && (l_stop[n]<GetDiscLine(n,0)))
|
||||||
|
return path; //lower bound violation
|
||||||
|
if ((l_start[n]>GetDiscLine(n,GetNumberOfLines(n,true)-1)) && (l_stop[n]>GetDiscLine(n,GetNumberOfLines(n,true)-1)))
|
||||||
|
return path; //upper bound violation
|
||||||
|
}
|
||||||
|
|
||||||
if (g_settings.GetVerboseLevel()>2)
|
if (g_settings.GetVerboseLevel()>2)
|
||||||
{
|
|
||||||
cerr << __func__ << ": A path was leaving the alpha-direction mesh..." << endl;
|
cerr << __func__ << ": A path was leaving the alpha-direction mesh..." << endl;
|
||||||
}
|
|
||||||
|
|
||||||
// this section comes into play, if the line moves over the angulare mesh-end/start
|
// this section comes into play, if the line moves over the angulare mesh-end/start
|
||||||
// we try to have one part of the path on both "ends" of the mesh and stitch them together
|
// we try to have one part of the path on both "ends" of the mesh and stitch them together
|
||||||
|
|
||||||
struct Grid_Path path;
|
|
||||||
struct Grid_Path path1;
|
struct Grid_Path path1;
|
||||||
struct Grid_Path path2;
|
struct Grid_Path path2;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue