mirror of https://github.com/CGAL/cgal
Minor Bug Fix: trilinear interpolation may crash when querying with coordinates between -1 and 0. Add a test on real coordinates to exit interpolation if it is < 0.
This commit is contained in:
parent
37fdaefe04
commit
86527359ed
|
|
@ -221,6 +221,9 @@ Image_3::trilinear_interpolation(const Coord_type& x,
|
|||
const Image_word_type& value_outside,
|
||||
Image_transform transform) const
|
||||
{
|
||||
// Check on double/float coordinates, because (int)-0.1 gives 0
|
||||
if ( x < 0 || y < 0 || z < 0 ) return value_outside;
|
||||
|
||||
const Coord_type lx = x / image()->vx;
|
||||
const Coord_type ly = y / image()->vy;
|
||||
const Coord_type lz = z / image()->vz;
|
||||
|
|
@ -406,6 +409,9 @@ Image_3::labellized_trilinear_interpolation(const Coord_type& x,
|
|||
const Coord_type& z,
|
||||
const Image_word_type& value_outside) const
|
||||
{
|
||||
// Check on double/float coordinates, because (int)-0.1 gives 0
|
||||
if ( x < 0 || y < 0 || z < 0 ) return value_outside;
|
||||
|
||||
const int dimx = xdim();
|
||||
const int dimy = ydim();
|
||||
const int dimz = zdim();
|
||||
|
|
|
|||
Loading…
Reference in New Issue