[Insight-users] How to get PI

Luis Ibanez luis.ibanez at kitware.com
Fri, 09 Jan 2004 13:32:03 -0500


Hi Radhika,

You can do:

#include "vnl_math.h"

int main()
{
   const double PI = vnl_math::pi;
}

In the same file vnl_math.h you will find
the following math constants.

> double e              
> double log2e          
> double log10e         
> double ln2            
> double ln10           
> double pi             
> double pi_over_2      
> double pi_over_4      
> double one_over_pi    
> double two_over_pi    
> double two_over_sqrtpi
> double sqrt2          
> double sqrt1_2        
> double eps            
> double sqrteps        
> float float_eps       
> float float_sqrteps   

this file is in the directory

    Insight/Utilities/vxl/core/vnl


My personal preference for PI
however is to do


   int main()
   {
   const double PI = 4.0 * atan( 1.0 );
   }




Regards,

    Luis


----------------------------
Radhika Sivaramakrishna wrote:

> Hi Luis,
> Can you tell me which is the header file to include for constants like 
> PI etc?
> 
> Thanks
> Radhika
> 
>