1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

3.14... -> math::pi<T>()

This commit is contained in:
bolero-MURAKAMI 2012-02-28 18:54:39 +09:00
parent 3078d76ceb
commit dacf1f40ac
3 changed files with 11 additions and 11 deletions

View file

@ -7,6 +7,7 @@
#include <sprout/config.hpp>
#include <sprout/tuple/tuple.hpp>
#include <sprout/tuple/functions.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/darkroom/access/access.hpp>
#include <sprout/darkroom/coords/vector.hpp>
#include <sprout/darkroom/rays/ray.hpp>
@ -52,8 +53,6 @@ namespace sprout {
SPROUT_STATIC_CONSTEXPR std::size_t point_of_intersection = 0;
SPROUT_STATIC_CONSTEXPR std::size_t normal = 1;
};
private:
SPROUT_STATIC_CONSTEXPR unit_type pi = 3.1415926535897932384626433832795;
private:
position_type pos_;
radius_type rad_;
@ -156,7 +155,7 @@ namespace sprout {
sprout::darkroom::coords::z(normal),
sprout::darkroom::coords::x(normal)
)
/ pi
/ sprout::math::pi<unit_type>()
,
atan2(
sprout::darkroom::coords::y(normal),
@ -165,7 +164,7 @@ namespace sprout {
+ sprout::darkroom::coords::z(normal) * sprout::darkroom::coords::z(normal)
)
)
/ (pi / 2)
/ sprout::math::pi_div_two<unit_type>()
)
);
}

View file

@ -156,10 +156,7 @@ namespace sprout {
>
{};
} // namespace detail
template<
sprout::index_t I,
std::size_t N
>
template<sprout::index_t I, std::size_t N>
struct index_n
: public sprout::detail::index_n_impl<I, N>
{};

View file

@ -7,6 +7,7 @@
#include <istream>
#include <stdexcept>
#include <sprout/config.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/random/uniform_01.hpp>
#include <sprout/random/random_result.hpp>
@ -22,8 +23,6 @@ namespace sprout {
typedef RealType result_type;
private:
struct private_constructor_tag {};
private:
SPROUT_STATIC_CONSTEXPR result_type pi = result_type(3.14159265358979323846);
private:
static SPROUT_CONSTEXPR bool arg_check_nothrow(RealType mean_arg, RealType sigma_arg) {
return sigma_arg >= RealType(0);
@ -125,7 +124,12 @@ namespace sprout {
using std::sin;
using std::cos;
return sprout::random::random_result<Engine, normal_distribution>(
cached_rho * (valid ? cos(result_type(2) * pi * r1) : sin(result_type(2) * pi * r1)) * sigma_ + mean_,
cached_rho
* (valid
? cos(result_type(2) * sprout::math::pi<result_type>() * r1)
: sin(result_type(2) * sprout::math::pi<result_type>() * r1)
)
* sigma_ + mean_,
eng,
normal_distribution(
mean_,