mirror of https://github.com/CGAL/cgal
fix the use of integers
patch suggested by Bryn Lloyd on cgal-discuss to avoid an integer overflow problem that occurs when generating a 3D mesh from very large images
This commit is contained in:
parent
452166d3dd
commit
06eb921215
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <limits>
|
||||
#include <set>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
|
|
@ -124,11 +124,11 @@ public:
|
|||
image()->data = d;
|
||||
}
|
||||
|
||||
unsigned int xdim() const { return image_ptr->xdim; }
|
||||
unsigned int ydim() const { return image_ptr->ydim; }
|
||||
unsigned int zdim() const { return image_ptr->zdim; }
|
||||
std::size_t xdim() const { return image_ptr->xdim; }
|
||||
std::size_t ydim() const { return image_ptr->ydim; }
|
||||
std::size_t zdim() const { return image_ptr->zdim; }
|
||||
|
||||
unsigned int size() const { return xdim() * ydim() * zdim(); }
|
||||
std::size_t size() const { return xdim() * ydim() * zdim(); }
|
||||
|
||||
double vx() const { return image_ptr->vx; }
|
||||
double vy() const { return image_ptr->vy; }
|
||||
|
|
@ -237,10 +237,10 @@ Image_3::trilinear_interpolation(const Coord_type& x,
|
|||
const Coord_type lx = x / image()->vx;
|
||||
const Coord_type ly = y / image()->vy;
|
||||
const Coord_type lz = z / image()->vz;
|
||||
const int dimx = xdim();
|
||||
const int dimy = ydim();
|
||||
const int dimz = zdim();
|
||||
const int dimxy = dimx*dimy;
|
||||
const std::size_t dimx = xdim();
|
||||
const std::size_t dimy = ydim();
|
||||
const std::size_t dimz = zdim();
|
||||
const std::size_t dimxy = dimx*dimy;
|
||||
|
||||
if(lx < 0 ||
|
||||
ly < 0 ||
|
||||
|
|
@ -425,9 +425,9 @@ Image_3::labellized_trilinear_interpolation(const Coord_type& x,
|
|||
Coord_type lx = x / image()->vx;
|
||||
Coord_type ly = y / image()->vy;
|
||||
Coord_type lz = z / image()->vz;
|
||||
const int dimx = xdim();
|
||||
const int dimy = ydim();
|
||||
const int dimz = zdim();
|
||||
const std::size_t dimx = xdim();
|
||||
const std::size_t dimy = ydim();
|
||||
const std::size_t dimz = zdim();
|
||||
|
||||
if( lx < 0 ||
|
||||
ly < 0 ||
|
||||
|
|
|
|||
|
|
@ -86,9 +86,9 @@ public:
|
|||
const int py = static_cast<int>(p.y()/r_im_.vy());
|
||||
const int pz = static_cast<int>(p.z()/r_im_.vz());
|
||||
|
||||
const int dimx = r_im_.xdim();
|
||||
const int dimy = r_im_.ydim();
|
||||
const int dimz = r_im_.zdim();
|
||||
const std::size_t dimx = r_im_.xdim();
|
||||
const std::size_t dimy = r_im_.ydim();
|
||||
const std::size_t dimz = r_im_.zdim();
|
||||
|
||||
if(px < 0 ||
|
||||
py < 0 ||
|
||||
|
|
|
|||
Loading…
Reference in New Issue