Skip to content

Commit 932ad32

Browse files
committed
[delaunay-psm] Update to 1.5.4
1 parent 669c477 commit 932ad32

File tree

4 files changed

+38
-56
lines changed

4 files changed

+38
-56
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.1.3)
22

3-
project(delaunay-psm LANGUAGES C CXX VERSION 1.5.3)
3+
project(delaunay-psm LANGUAGES C CXX VERSION 1.5.4)
44

55
set(CMAKE_CXX_STANDARD 11)
66

delaunay-psm/Delaunay_psm.cpp

Lines changed: 22 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3640,6 +3640,10 @@ namespace {
36403640
"one of auto, GLUP150, GLUP440, VanillaGL"
36413641
);
36423642
declare_arg("gfx:full_screen", false, "full screen mode");
3643+
declare_arg(
3644+
"gfx:transparent", false,
3645+
"use transparent backsgroung (desktop integration)"
3646+
);
36433647
declare_arg(
36443648
"gfx:GLSL_tesselation", true, "use tesselation shaders if available"
36453649
);
@@ -4190,7 +4194,7 @@ namespace GEO {
41904194

41914195
void Logger::unregister_client(LoggerClient* c) {
41924196
geo_debug_assert(clients_.find(c) != clients_.end());
4193-
clients_.erase(c);
4197+
clients_.erase(c);
41944198
}
41954199

41964200
void Logger::unregister_all_clients() {
@@ -7245,48 +7249,26 @@ namespace GEO {
72457249
#pragma GCC diagnostic ignored "-Wc++11-long-long"
72467250
#endif
72477251

7248-
#ifdef GEO_COMPILER_MSVC
7249-
#define isnan _isnan
7250-
#define isfinite _finite
7251-
#else
7252-
#ifndef isnan
7253-
#define isnan std::isnan
7254-
#endif
7255-
#ifndef isfinite
7256-
#define isfinite std::isfinite
7257-
#endif
7258-
#endif
7259-
72607252
namespace GEO {
72617253

72627254
namespace Numeric {
72637255

7264-
// Note: do not add global scope (::isnan) for calling
7265-
// this function, since it is a macro in some implementations.
7266-
72677256
bool is_nan(float32 x) {
7268-
return isnan(x) || !isfinite(x);
7257+
#ifdef GEO_COMPILER_MSVC
7258+
return _isnan(x) || !_finite(x);
7259+
#else
7260+
return std::isnan(x) || !std::isfinite(x);
7261+
#endif
72697262
}
72707263

7271-
7272-
// Under GCC, to work for both floats and doubles, isnan() is a macro
7273-
// that calls both isnanf() and isnan(), based on operator size (using ?:),
7274-
// thus it generates a conversion warning (that we ignore using the following
7275-
// pragmas).
7276-
7277-
#ifdef GEO_COMPILER_GCC
7278-
#pragma GCC diagnostic push
7279-
#pragma GCC diagnostic ignored "-Wfloat-conversion"
7280-
#endif
7281-
72827264
bool is_nan(float64 x) {
7283-
return isnan(x) || !isfinite(x);
7265+
#ifdef GEO_COMPILER_MSVC
7266+
return _isnan(x) || !_finite(x);
7267+
#else
7268+
return std::isnan(x) || !std::isfinite(x);
7269+
#endif
72847270
}
72857271

7286-
#ifdef GEO_COMPILER_GCC
7287-
#pragma GCC diagnostic pop
7288-
#endif
7289-
72907272
void random_reset() {
72917273
#ifdef GEO_OS_WINDOWS
72927274
srand(1);
@@ -8696,10 +8678,6 @@ namespace GEO {
86968678
#endif
86978679

86988680

8699-
#if defined(GEO_OS_APPLE) && defined(__MAC_10_12)
8700-
#include <os/lock.h>
8701-
#endif
8702-
87038681
namespace {
87048682

87058683
using namespace GEO;
@@ -20692,11 +20670,13 @@ namespace GEO {
2069220670

2069320671
if(keeps_infinite()) {
2069420672

20695-
// Process the infinite vertex at index nb_vertices().
20696-
signed_index_t t = v_to_cell_[nb_vertices()];
20697-
if(t != -1) {
20698-
index_t lv = index(index_t(t), -1);
20699-
set_next_around_vertex(index_t(t), lv, index_t(t));
20673+
{
20674+
// Process the infinite vertex at index nb_vertices().
20675+
signed_index_t t = v_to_cell_[nb_vertices()];
20676+
if(t != -1) {
20677+
index_t lv = index(index_t(t), -1);
20678+
set_next_around_vertex(index_t(t), lv, index_t(t));
20679+
}
2070020680
}
2070120681

2070220682
for(index_t t = 0; t < nb_cells(); ++t) {

delaunay-psm/Delaunay_psm.h

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ namespace GEO {
404404
#ifndef GEOGRAM_BASIC_NUMERIC
405405
#define GEOGRAM_BASIC_NUMERIC
406406

407-
#include <math.h>
407+
#include <cmath>
408408
#include <float.h>
409409
#include <limits.h>
410410

@@ -1828,11 +1828,11 @@ inline char atomic_bittestandreset_x86(volatile unsigned int* ptr, unsigned int
18281828
#include <vector>
18291829

18301830
#ifdef GEO_OS_APPLE
1831-
# define GEO_USE_DEFAULT_SPINLOCK_ARRAY
1832-
# include <Availability.h>
1833-
# ifdef __MAC_10_12
1834-
# include <os/lock.h>
1835-
# endif
1831+
# define GEO_USE_DEFAULT_SPINLOCK_ARRAY
1832+
# include <AvailabilityMacros.h>
1833+
# if defined(MAC_OS_X_VERSION_10_12) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
1834+
# include <os/lock.h>
1835+
# endif
18361836
#endif
18371837

18381838
#ifdef geo_debug_assert
@@ -1889,7 +1889,7 @@ namespace GEO {
18891889

18901890
#elif defined(GEO_OS_APPLE)
18911891

1892-
#ifdef __MAC_10_12
1892+
#if defined(MAC_OS_X_VERSION_10_12) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
18931893

18941894
typedef os_unfair_lock spinlock;
18951895

@@ -1963,11 +1963,7 @@ namespace GEO {
19631963
}
19641964

19651965
void resize(index_t size_in) {
1966-
#if defined(GEO_OS_APPLE) && defined(__MAC_10_12)
1967-
spinlocks_.assign(size_in, OS_UNFAIR_LOCK_INIT);
1968-
#else
1969-
spinlocks_.assign(size_in, 0);
1970-
#endif
1966+
spinlocks_.assign(size_in, GEOGRAM_SPINLOCK_INIT);
19711967
}
19721968

19731969
void clear() {

example/main.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,19 +335,25 @@ int main(int argc, char** argv) {
335335

336336
Logger::out("Delaunay")
337337
<< "Loaded " << nb_points << " points" << std::endl;
338-
338+
339+
double time = 0.0;
339340
{
340341
Stopwatch Wdel("Delaunay");
341342
// Note: this does not transfer ownership of memory, caller
342343
// is still responsible of the memory of the points (here the
343344
// vector<double>). No memory is copied, Delaunay just keeps
344345
// a pointer.
345346
delaunay->set_vertices(nb_points, points.data());
347+
time = Wdel.elapsed_time();
346348
}
347349

348350
Logger::out("Delaunay") << delaunay->nb_cells() << " tetrahedra"
349351
<< std::endl;
350352

353+
Logger::out("Delaunay") << double(delaunay->nb_cells()) / time
354+
<< " tetrahedra / second"
355+
<< std::endl;
356+
351357
if(output) {
352358
save_Delaunay(delaunay, output_filename, convex_hull_only);
353359
}

0 commit comments

Comments
 (0)