Skip to content
Snippets Groups Projects
Commit 618d6279 authored by Andrew Bauer's avatar Andrew Bauer Committed by Code Review
Browse files

Merge topic 'vtkCellLocator-precision-issue' into master

949ffbf8 Add default value for argument
e7438f2d Fix numerical precision problem in vtkCellLocator::IntersectWithLine
parents 9fc4c29d 949ffbf8
No related branches found
No related tags found
No related merge requests found
......@@ -287,7 +287,7 @@ int vtkCellLocator::IntersectWithLine(double a0[3], double a1[3], double tol,
this->DataSet->GetCell(cId, cell);
if (cell->IntersectWithLine(a0, a1, tol, t, x, pcoords, subId) )
{
if ( ! this->IsInOctantBounds(x) )
if ( ! this->IsInOctantBounds(x, tol) )
{
this->CellHasBeenVisited[cId] = 0; //mark the cell non-visited
}
......
......@@ -259,11 +259,11 @@ protected:
void ComputeOctantBounds(int i, int j, int k);
double OctantBounds[6]; //the bounds of the current octant
int IsInOctantBounds(double x[3])
int IsInOctantBounds(double x[3], double tol = 0.0)
{
if ( this->OctantBounds[0] <= x[0] && x[0] <= this->OctantBounds[1] &&
this->OctantBounds[2] <= x[1] && x[1] <= this->OctantBounds[3] &&
this->OctantBounds[4] <= x[2] && x[2] <= this->OctantBounds[5] )
if ( this->OctantBounds[0]-tol <= x[0] && x[0] <= this->OctantBounds[1]+tol &&
this->OctantBounds[2]-tol <= x[1] && x[1] <= this->OctantBounds[3]+tol &&
this->OctantBounds[4]-tol <= x[2] && x[2] <= this->OctantBounds[5]+tol )
{
return 1;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment