PI

69 views
Skip to first unread message

Gernot

unread,
Jun 5, 2012, 7:08:22 AM6/5/12
to oce-dev
Hi all,

I used OpenCascade some time ago and recently switched over to use
OCE, just because its much easier installation procedure. I do not
know whether there is a special place to discuss OCE so I will ask my
first question here. Please tell me if this is not the right place.

In my source code I use a macro? PI which worked with last versions of
OCE. Now I installed oce-0.9.1-67 and got a compiler message that PI
was not defined.

Unfortunately I do not understand completely the C++ basics around a
construct like this PI. I remember its a macro that is translated
during compilation into the value 3.14... Could someone be so nice to
explain to me how this works or how I can realize an exact value for
PI allover my program? Is there a special OpenCascade replacement for
this?

Thanks for any hints,
Gernot

D. Barbier

unread,
Jun 5, 2012, 9:23:11 AM6/5/12
to oce...@googlegroups.com
On 2012/6/5 Gernot wrote:
> Hi all,
>
> I used OpenCascade some time ago and recently switched over to use
> OCE, just because its much easier installation procedure. I do not
> know whether there is a special place to discuss OCE so I will ask my
> first question here. Please tell me if this is not the right place.

Hello,

This is the right place.

> In my source code I use a macro? PI which worked with last versions of
> OCE. Now I installed oce-0.9.1-67 and got a compiler message that PI
> was not defined.

PI used to be defined in Standard_Real.hxx, but OpenCascade switched
to the standardized M_PI macro, defined in math.h.

> Unfortunately I do not understand completely the C++ basics around a
> construct like this PI. I remember its a macro that is translated
> during compilation into the value 3.14... Could someone be so nice to
> explain to me how this works or how I can realize an exact value for
> PI allover my program? Is there a special OpenCascade replacement for
> this?

In your C++ files, you can replace all occurences of PI by M_PI (and
#include <math.h>), or write something like:

#ifndef PI
# include <math.h>
# define PI M_PI
#endif

Denis
Reply all
Reply to author
Forward
0 new messages