Skip to content
Snippets Groups Projects
Commit de36cef7 authored by Mathieu Westphal (Kitware)'s avatar Mathieu Westphal (Kitware) :zap:
Browse files

vtkImageData: Add tolerance param to ComputeStructuredCoordinates

parent 1ff833c6
No related branches found
No related tags found
No related merge requests found
......@@ -1012,16 +1012,15 @@ void vtkImageData::SetDimensions(const int dim[3])
}
//------------------------------------------------------------------------------
// Convenience function computes the structured coordinates for a point x[3].
// The voxel is specified by the array ijk[3], and the parametric coordinates
// in the cell are specified with pcoords[3]. The function returns a 0 if the
// point x is outside of the volume, and a 1 if inside the volume.
int vtkImageData::ComputeStructuredCoordinates(const double x[3], int ijk[3], double pcoords[3])
{
// tolerance is needed for floating points error margin
// (this is squared tolerance)
const double tol2 = 1e-12;
return this->ComputeStructuredCoordinates(x, ijk, pcoords, 1e-12);
}
//------------------------------------------------------------------------------
int vtkImageData::ComputeStructuredCoordinates(
const double x[3], int ijk[3], double pcoords[3], double tol2)
{
//
// Compute the ijk location
//
......
......@@ -222,13 +222,18 @@ public:
virtual void GetDimensions(vtkIdType dims[3]);
#endif
///@{
/**
* Convenience function computes the structured coordinates for a point x[3].
* The voxel is specified by the array ijk[3], and the parametric coordinates
* in the cell are specified with pcoords[3]. The function returns a 0 if the
* point x is outside of the volume, and a 1 if inside the volume.
* point x is outside of the volume, and a 1 if inside the volume, using squared tolerance tol2
* (1e-12 if not provided).
*/
virtual int ComputeStructuredCoordinates(const double x[3], int ijk[3], double pcoords[3]);
virtual int ComputeStructuredCoordinates(
const double x[3], int ijk[3], double pcoords[3], double tol2);
///@}
/**
* Given structured coordinates (i,j,k) for a voxel cell, compute the eight
......
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