Boost logo

Geometry :

Subject: [ggl] Hello + some newbie questions
From: Mateusz Loskot (mateusz)
Date: 2009-05-05 18:14:00


Mateusz Loskot wrote:
> Barend Gehrels wrote:
>>
>> The constants HALFPI etc should be replaced by / forwarded to
>> boost::math::constants::pi<T> / 2.0 etc (this should also be done
>> for our own ggl::math)
>
> Do you propose to keep constants like
>
> static double const pi = ...
>
> but to change their values to boost::math:: stuff?
>
> Or remove out own constants and use boost::math::* directly in all
> ggl:: code?

I have applied (r685, r686) use of boost::math::constants for PI and for
HALF.
Also, I const-qualified intermediate results in functions, to be sure
compilers will always optimize these values.

I think the ggl::math::hav function could be template for easy
interchangeable use with float and double types:

template <typename T>
inline T hav(T const& theta)
{
    using boost::math::constants::half;
    T const sn = std::sin(half<T>() * theta);
    return sn * sn;
}

Same ggl::math::sqrt.

What you think?

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org

Geometry list run by mateusz at loskot.net