fix in operator curve handling

pull/1/head
Thorsten Liebig 2010-03-26 19:33:44 +01:00
parent 79574aa3e6
commit 207e22f1db
1 changed files with 20 additions and 36 deletions

View File

@ -139,19 +139,17 @@ struct Operator::Grid_Path Operator::FindPath(double start[], double stop[])
double meshStart[] = {discLines[0][uiStart[0]], discLines[1][uiStart[1]], discLines[2][uiStart[2]]};
double meshStop[] = {discLines[0][uiStop[0]], discLines[1][uiStop[1]], discLines[2][uiStop[2]]};
double foot,dist,minFoot,minDist,minDir;
double foot,dist,minFoot,minDist;
int minDir;
bool UpDir;
unsigned int minPos[3];
double startFoot,stopFoot,currFoot;
Point_Line_Distance(meshStart,start,stop,startFoot,dist);
Point_Line_Distance(meshStop,start,stop,stopFoot,dist);
currFoot=startFoot;
minFoot=startFoot;
double P[3];
// cerr << "start pos " << discLines[0][currPos[0]] << " " << discLines[1][currPos[1]] << " " << discLines[2][currPos[2]] << endl;
//
// FDTD_FLOAT**** array = Create_N_3DArray(numLines);
while (minFoot<stopFoot)
{
minDist=1e300;
@ -169,11 +167,7 @@ struct Operator::Grid_Path Operator::FindPath(double start[], double stop[])
minFoot=foot;
minDist=dist;
minDir = n;
minPos[0]=currPos[0];
minPos[1]=currPos[1];
minPos[2]=currPos[2];
minPos[n]=currPos[n]-1;
// array[n][minPos[0]][minPos[1]][minPos[2]] = 1;
UpDir = false;
}
}
if ((currPos[n]+1)<numLines[n])
@ -185,30 +179,28 @@ struct Operator::Grid_Path Operator::FindPath(double start[], double stop[])
minFoot=foot;
minDist=dist;
minDir = n;
minPos[0]=currPos[0];
minPos[1]=currPos[1];
minPos[2]=currPos[2];
minPos[n]=currPos[n]+1;
// array[n][minPos[0]][minPos[1]][minPos[2]] = 1;
UpDir = true;
}
}
}
// cerr << "next best pos " << minDir << " " << " " << discLines[0][minPos[0]] << " " << discLines[1][minPos[1]] << " " << discLines[2][minPos[2]] << endl;
currPos[0]=minPos[0];
currPos[1]=minPos[1];
currPos[2]=minPos[2];
currFoot=minFoot;
path.dir.push_back(minDir);
minPos[0]=currPos[0];
minPos[1]=currPos[1];
minPos[2]=currPos[2];
if (UpDir)
{
currPos[minDir]+=1;
}
else
{
currPos[minDir]+=-1;
minPos[minDir]-=1;
}
path.posPath[0].push_back(minPos[0]);
path.posPath[1].push_back(minPos[1]);
path.posPath[2].push_back(minPos[2]);
currFoot=minFoot;
path.dir.push_back(minDir);
}
// ofstream file("test.vtk",ios_base::out);
//
// ProcessFields::DumpVectorArray2VTK(file,"path",array,discLines,numLines);
// file.close();
return path;
}
@ -862,19 +854,11 @@ bool Operator::CalcPEC()
curv->GetPoint(i-1,p1);
curv->GetPoint(i,p2);
path = FindPath(p1,p2);
// cerr << p1[0] << " " << p1[1] << " " << p1[2] << endl;
// cerr << p2[0] << " " << p2[1] << " " << p2[2] << endl;
for (size_t t=0;t<path.dir.size();++t)
{
// cerr << path.dir.at(t) << " " << path.posPath[0].at(t) << " " << path.posPath[1].at(t) << " " << path.posPath[2].at(t) << endl;
vv[path.dir.at(t)][path.posPath[0].at(t)][path.posPath[1].at(t)][path.posPath[2].at(t)] = 0;
vi[path.dir.at(t)][path.posPath[0].at(t)][path.posPath[1].at(t)][path.posPath[2].at(t)] = 0;
vv[0][path.posPath[0].at(t)][path.posPath[1].at(t)][path.posPath[2].at(t)] = 0;
vi[0][path.posPath[0].at(t)][path.posPath[1].at(t)][path.posPath[2].at(t)] = 0;
vv[1][path.posPath[0].at(t)][path.posPath[1].at(t)][path.posPath[2].at(t)] = 0;
vi[1][path.posPath[0].at(t)][path.posPath[1].at(t)][path.posPath[2].at(t)] = 0;
vv[2][path.posPath[0].at(t)][path.posPath[1].at(t)][path.posPath[2].at(t)] = 0;
vi[2][path.posPath[0].at(t)][path.posPath[1].at(t)][path.posPath[2].at(t)] = 0;
}
// cerr << "found path size: " << path.dir.size() << endl;
}