From b07c7d0894239dff471f03f60bf10344a40a7928 Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Thu, 11 Mar 2021 19:21:56 +0100 Subject: [PATCH] fixes due to min/max... --- .../trimesh_sampling/trimesh_sampling.pro | 5 +++ vcg/complex/algorithms/point_sampling.h | 32 +++++++++---------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/apps/sample/trimesh_sampling/trimesh_sampling.pro b/apps/sample/trimesh_sampling/trimesh_sampling.pro index e112f066..1f9039f4 100644 --- a/apps/sample/trimesh_sampling/trimesh_sampling.pro +++ b/apps/sample/trimesh_sampling/trimesh_sampling.pro @@ -1,3 +1,8 @@ include(../common.pri) TARGET = trimesh_sampling SOURCES += trimesh_sampling.cpp + +# Awful.. +win32{ + DEFINES += NOMINMAX +} diff --git a/vcg/complex/algorithms/point_sampling.h b/vcg/complex/algorithms/point_sampling.h index 1d61bbfd..8e2418ed 100644 --- a/vcg/complex/algorithms/point_sampling.h +++ b/vcg/complex/algorithms/point_sampling.h @@ -494,18 +494,6 @@ static math::MarsenneTwisterRNG &SamplingRandomGenerator() return rnd; } -class MarsenneTwisterURBG -{ -public: - MarsenneTwisterURBG(unsigned int max) : _max(max) {} - typedef unsigned int result_type; - unsigned int min() const {return 0;} - unsigned int max() const {return _max;} - unsigned int operator()() {return RandomInt(_max);} -private: - unsigned int _max; -}; - // Returns an integer random number in the [0,i-1] interval using the improve Marsenne-Twister method. // this functor is needed for passing it to the std functions. static unsigned int RandomInt(unsigned int i) @@ -513,6 +501,18 @@ static unsigned int RandomInt(unsigned int i) return (SamplingRandomGenerator().generate(i)); } +class MarsenneTwisterURBG +{ +public: + typedef unsigned int result_type; + MarsenneTwisterURBG(result_type max) : _max(max) {} + result_type min() const {return 0;} + result_type max() const {return _max;} + result_type operator()() {return SamplingRandomGenerator().generate(_max);} +private: + result_type _max; +}; + // Returns a random number in the [0,1) real interval using the improved Marsenne-Twister method. static double RandomDouble01() { @@ -725,7 +725,7 @@ static void FillAndShuffleFacePointerVector(MeshType & m, std::vector &vertVec) { @@ -735,7 +735,7 @@ static void FillAndShuffleVertexPointerVector(MeshType & m, std::vector