Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Re: How to correct these conflicts between CGAL with MSVC8

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Re: How to correct these conflicts between CGAL with MSVC8


Chronological Thread 
  • From: Andreas Fabri <>
  • To:
  • Subject: Re: [cgal-discuss] Re: How to correct these conflicts between CGAL with MSVC8
  • Date: Thu, 20 May 2010 14:03:47 +0200
  • Organization: GeometryFactory


No way to help you for something else than the latest release of CGAL.
Unless you pay well ===>:-

andreas

On 20/05/2010 13:21, JohnHans wrote:

Hi, Sebastien Loriot, Andreas Fabri,

Thank you very much for your soon reply.

Actually, I would move an application routine from Linux to Windows, which
had already been built successfully on CGAL 3.3.1 by senior fellow
apprentice on Linux. When I built it based on Qt4, CGAL-3.3.1 within VS2005
on Windows, there are many C3861 errors (identifier not found) for lroundf,
isnan and so on, which usually are defined in Linux. So I try to create a
MathFix.h as following:

MathFix.h:
#include<math.h>
#include<stdlib.h>
#include<limits>
#include<float.h>

#ifndef M_PI
const double piDouble = 3.14159265358979323846;
const float piFloat = 3.14159265358979323846f;
#else
const double piDouble = M_PI;
const float piFloat = static_cast<float>(M_PI);
#endif

#ifndef M_PI_4
const double piOverFourDouble = 0.785398163397448309616;
const float piOverFourFloat = 0.785398163397448309616f;
#else
const double piOverFourDouble = M_PI_4;
const float piOverFourFloat = static_cast<float>(M_PI_4);
#endif

inline long lround(double num) { return static_cast<long>(num> 0 ? num +
0.5 : ceil(num - 0.5)); }
inline long lroundf(float num) { return static_cast<long>(num> 0 ? num +
0.5f : ceilf(num - 0.5f)); }
inline double round(double num) { return num> 0 ? floor(num + 0.5) :
ceil(num - 0.5); }
inline float roundf(float num) { return num> 0 ? floorf(num + 0.5f) :
ceilf(num - 0.5f); }
inline double trunc(double num) { return num> 0 ? floor(num) : ceil(num); }

inline bool isinf(double num) { return !_finite(num)&& !_isnan(num); }
inline bool isnan(double num) { return !!_isnan(num); }
inline bool signbit(double num) { return _copysign(1.0, num)< 0; }

inline double nextafter(double x, double y) { return _nextafter(x, y); }
inline float nextafterf(float x, float y) { return x> y ? x - FLT_EPSILON :
x + FLT_EPSILON; }

inline double copysign(double x, double y) { return _copysign(x, y); }
inline int isfinite(double x) { return _finite(x); }

inline double wtf_atan2(double x, double y)
{
double posInf = std::numeric_limits<double>::infinity();
double negInf = -std::numeric_limits<double>::infinity();
double nan = std::numeric_limits<double>::quiet_NaN();

double result = nan;

if (x == posInf&& y == posInf)
result = piOverFourDouble;
else if (x == posInf&& y == negInf)
result = 3 * piOverFourDouble;
else if (x == negInf&& y == posInf)
result = -piOverFourDouble;
else if (x == negInf&& y == negInf)
result = -3 * piOverFourDouble;
else
result = ::atan2(x, y);

return result;
}

inline double wtf_fmod(double x, double y) { return (!isinf(x)&& isinf(y))
? x : fmod(x, y); }

inline double wtf_pow(double x, double y) { return y == 0 ? 1 : pow(x, y); }

#define atan2(x, y) wtf_atan2(x, y)
#define fmod(x, y) wtf_fmod(x, y)
#define pow(x, y) wtf_pow(x, y)

After MathFix.h was included in that application routine, I tried to build
it based on Qt4, CGAL3.3.1 (and later CGAL 3.5.1) within VS2005 on Windows
and got the conflicts between CGAL with VS2005 as I described in the first
message.

BTW, I just installed CGAL3.3.1 and later CGAL 3.5.1 on Windows and have not
built them yet.

What’s wrong with me? What’s wrong with MathFix.h? Is there another way to
solve the problem of isnan, lroundf and so on? Or the conflicts?

I have spent more than 2 weeks on these problems, could you, someone please
instruct me to solve it or give me some advice?

Thank you very much in advance.

Best wishes,

John Hans





Archive powered by MHonArc 2.6.16.

Top of Page