Permalink
Browse files

fix use of NaN

I forgot that nan is always != to any other number... even if compared
to itself(!). So it cannot be used to detect unused params.
  • Loading branch information...
jlblancoc committed Dec 16, 2018
1 parent f0984ed commit dd91085f33876e5cefe08836344ca5edc7b2979e
@@ -745,11 +745,11 @@ namespace maps
* \return False on any error.
* \sa loadFromBitmap
*/
bool loadFromBitmapFile(const std::string &file, float resolution, float origin_xPixel = std::numeric_limits<float>::quiet_NaN(), float origin_yPixel = std::numeric_limits<float>::quiet_NaN() );
bool loadFromBitmapFile(const std::string &file, float resolution, float origin_xPixel = std::numeric_limits<float>::max(), float origin_yPixel = std::numeric_limits<float>::max() );

/** Load the gridmap from a image in a file (the format can be any supported by CImage::loadFromFile).
* See loadFromBitmapFile() for the meaning of parameters */
bool loadFromBitmap(const mrpt::utils::CImage &img, float resolution, float origin_xPixel = std::numeric_limits<float>::quiet_NaN(), float origin_yPixel = std::numeric_limits<float>::quiet_NaN() );
bool loadFromBitmap(const mrpt::utils::CImage &img, float resolution, float origin_xPixel = std::numeric_limits<float>::max(), float origin_yPixel = std::numeric_limits<float>::max() );

/** See the base class for more details: In this class it is implemented as correspondences of the passed points map to occupied cells.
* NOTICE: That the "z" dimension is ignored in the points. Clip the points as appropiated if needed before calling this method.
@@ -317,8 +317,8 @@ bool COccupancyGridMap2D::loadFromBitmap(const mrpt::utils::CImage &imgFl, floa
if (size_x!=bmpWidth || size_y!=bmpHeight)
{
// Middle of bitmap?
if (origin_xPixel == std::numeric_limits<float>::quiet_NaN() ||
origin_yPixel == std::numeric_limits<float>::quiet_NaN())
if (origin_xPixel == std::numeric_limits<float>::max() ||
origin_yPixel == std::numeric_limits<float>::max())
{
origin_xPixel = imgFl.getWidth() / 2.0f;
origin_yPixel = imgFl.getHeight() / 2.0f;

0 comments on commit dd91085

Please sign in to comment.