Skip to content

Commit 4f3bfba

Browse files
authored
V1.6 (#9)
* revert cmake version to match libigl * build executable option * update to 1.6
1 parent a754f24 commit 4f3bfba

File tree

7 files changed

+12053
-7870
lines changed

7 files changed

+12053
-7870
lines changed

CMakeLists.txt

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
cmake_minimum_required(VERSION 3.11)
1+
cmake_minimum_required(VERSION 3.1)
22
project(tetgen)
33

4-
add_library(tetgen STATIC tetgen.cxx predicates.cxx)
5-
target_compile_definitions(tetgen PRIVATE -DTETLIBRARY)
4+
option(BUILD_EXECUTABLE "Build tetgen executable" OFF)
5+
option(BUILD_LIBRARY "Build libtetgen library" ON)
66

7-
# Generate position independent code
8-
set_target_properties(tetgen PROPERTIES POSITION_INDEPENDENT_CODE ON)
7+
if(BUILD_LIBRARY)
8+
add_library(tetgen STATIC tetgen.cxx predicates.cxx)
9+
target_compile_definitions(tetgen PRIVATE -DTETLIBRARY)
10+
# Generate position independent code
11+
set_target_properties(tetgen PROPERTIES POSITION_INDEPENDENT_CODE ON)
12+
endif()
13+
14+
15+
if(BUILD_EXECUTABLE)
16+
add_executable(tetgen_exec tetgen.cxx predicates.cxx)
17+
set_target_properties(tetgen_exec PROPERTIES OUTPUT_NAME tetgen)
18+
endif()

README

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This is TetGen version 1.5.1 (released on August, 2018)
1+
This is TetGen version 1.6.0 (released on August 31, 2020)
22

33
Please see the documentation of TetGen for compiling and using TetGen.
44
It is available at the following link:
@@ -13,7 +13,6 @@ For more information on this product, contact :
1313
Mohrenstr. 39
1414
10117 Berlin, Germany
1515

16-
Phone: +49 (0) 30-20372-446 Fax: +49 (0) 30-2044975
1716
1817
Web Site: http://www.wias-berlin.de/~si
1918

example.poly

100644100755
File mode changed.

makefile

100644100755
File mode changed.

predicates.cxx

Lines changed: 40 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,12 @@ static REAL o3derrboundA, o3derrboundB, o3derrboundC;
382382
static REAL iccerrboundA, iccerrboundB, iccerrboundC;
383383
static REAL isperrboundA, isperrboundB, isperrboundC;
384384

385-
// Options to choose types of geometric computtaions.
385+
// Options to choose types of geometric computtaions.
386386
// Added by H. Si, 2012-08-23.
387387
static int _use_inexact_arith; // -X option.
388388
static int _use_static_filter; // Default option, disable it by -X1
389389

390-
// Static filters for orient3d() and insphere().
390+
// Static filters for orient3d() and insphere().
391391
// They are pre-calcualted and set in exactinit().
392392
// Added by H. Si, 2012-08-23.
393393
static REAL o3dstaticfilter;
@@ -399,7 +399,7 @@ static REAL ispstaticfilter;
399399
// http://www.math.utah.edu/~beebe/software/ieee/
400400
// The original program was "fpinfo2.c".
401401

402-
double fppow2(int n)
402+
static double fppow2(int n)
403403
{
404404
double x, power;
405405
x = (n < 0) ? ((double)1.0/(double)2.0) : (double)2.0;
@@ -412,12 +412,12 @@ double fppow2(int n)
412412

413413
#ifdef SINGLE
414414

415-
float fstore(float x)
415+
static float fstore(float x)
416416
{
417417
return (x);
418418
}
419419

420-
int test_float(int verbose)
420+
static int test_float(int verbose)
421421
{
422422
float x;
423423
int pass = 1;
@@ -467,12 +467,12 @@ int test_float(int verbose)
467467

468468
# else
469469

470-
double dstore(double x)
470+
static double dstore(double x)
471471
{
472472
return (x);
473473
}
474474

475-
int test_double(int verbose)
475+
static int test_double(int verbose)
476476
{
477477
double x;
478478
int pass = 1;
@@ -488,7 +488,7 @@ int test_double(int verbose)
488488
x = 1.0;
489489
while (dstore(1.0 + x/2.0) != 1.0)
490490
x /= 2.0;
491-
if (verbose)
491+
if (verbose)
492492
(void)printf(" machine epsilon = %13.5le ", x);
493493

494494
if (x == (double)fppow2(-52)) {
@@ -540,7 +540,7 @@ int test_double(int verbose)
540540
/* */
541541
/*****************************************************************************/
542542

543-
void exactinit(int verbose, int noexact, int nofilter, REAL maxx, REAL maxy,
543+
void exactinit(int verbose, int noexact, int nofilter, REAL maxx, REAL maxy,
544544
REAL maxz)
545545
{
546546
REAL half;
@@ -881,7 +881,7 @@ int expansion_sum_zeroelim2(int elen, REAL *e, int flen, REAL *f, REAL *h)
881881
/* */
882882
/*****************************************************************************/
883883

884-
int fast_expansion_sum(int elen, REAL *e, int flen, REAL *f, REAL *h)
884+
static int fast_expansion_sum(int elen, REAL *e, int flen, REAL *f, REAL *h)
885885
/* h cannot be e or f. */
886886
{
887887
REAL Q;
@@ -953,7 +953,7 @@ int fast_expansion_sum(int elen, REAL *e, int flen, REAL *f, REAL *h)
953953
/* properties. */
954954
/* */
955955
/*****************************************************************************/
956-
956+
static
957957
int fast_expansion_sum_zeroelim(int elen, REAL *e, int flen, REAL *f, REAL *h)
958958
/* h cannot be e or f. */
959959
{
@@ -970,47 +970,19 @@ int fast_expansion_sum_zeroelim(int elen, REAL *e, int flen, REAL *f, REAL *h)
970970
eindex = findex = 0;
971971
if ((fnow > enow) == (fnow > -enow)) {
972972
Q = enow;
973-
/**
974-
* [JWP] Increment 'eindex,' but only update 'enow' if it is
975-
* safe. Otherwise, 'enow' remains unchanged from the previous
976-
* iteration...
977-
*/
978-
++eindex;
979-
if (eindex < elen)
980-
enow = e[eindex];
973+
enow = e[++eindex];
981974
} else {
982975
Q = fnow;
983-
/**
984-
* [JWP] Increment 'findex,' but only update 'fnow' if it is
985-
* safe. Otherwise, 'fnow' remains unchanged from the previous
986-
* iteration...
987-
*/
988-
++findex;
989-
if (findex < flen)
990-
fnow = f[findex];
976+
fnow = f[++findex];
991977
}
992978
hindex = 0;
993979
if ((eindex < elen) && (findex < flen)) {
994980
if ((fnow > enow) == (fnow > -enow)) {
995981
Fast_Two_Sum(enow, Q, Qnew, hh);
996-
/**
997-
* [JWP] Increment 'eindex,' but only update 'enow' if it is
998-
* safe. Otherwise, 'enow' remains unchanged from the previous
999-
* iteration...
1000-
*/
1001-
++eindex;
1002-
if (eindex < elen)
1003-
enow = e[eindex];
982+
enow = e[++eindex];
1004983
} else {
1005984
Fast_Two_Sum(fnow, Q, Qnew, hh);
1006-
/**
1007-
* [JWP] Increment 'findex,' but only update 'fnow' if it is
1008-
* safe. Otherwise, 'fnow' remains unchanged from the previous
1009-
* iteration...
1010-
*/
1011-
++findex;
1012-
if (findex < flen)
1013-
fnow = f[findex];
985+
fnow = f[++findex];
1014986
}
1015987
Q = Qnew;
1016988
if (hh != 0.0) {
@@ -1019,24 +991,10 @@ int fast_expansion_sum_zeroelim(int elen, REAL *e, int flen, REAL *f, REAL *h)
1019991
while ((eindex < elen) && (findex < flen)) {
1020992
if ((fnow > enow) == (fnow > -enow)) {
1021993
Two_Sum(Q, enow, Qnew, hh);
1022-
/**
1023-
* [JWP] Increment 'eindex,' but only update 'enow' if it is
1024-
* safe. Otherwise, 'enow' remains unchanged from the previous
1025-
* iteration...
1026-
*/
1027-
++eindex;
1028-
if (eindex < elen)
1029-
enow = e[eindex];
994+
enow = e[++eindex];
1030995
} else {
1031996
Two_Sum(Q, fnow, Qnew, hh);
1032-
/**
1033-
* [JWP] Increment 'findex,' but only update 'fnow' if it is
1034-
* safe. Otherwise, 'fnow' remains unchanged from the previous
1035-
* iteration...
1036-
*/
1037-
++findex;
1038-
if (findex < flen)
1039-
fnow = f[findex];
997+
fnow = f[++findex];
1040998
}
1041999
Q = Qnew;
10421000
if (hh != 0.0) {
@@ -1046,29 +1004,15 @@ int fast_expansion_sum_zeroelim(int elen, REAL *e, int flen, REAL *f, REAL *h)
10461004
}
10471005
while (eindex < elen) {
10481006
Two_Sum(Q, enow, Qnew, hh);
1049-
/**
1050-
* [JWP] Increment 'eindex,' but only update 'enow' if it is
1051-
* safe. Otherwise, 'enow' remains unchanged from the previous
1052-
* iteration...
1053-
*/
1054-
++eindex;
1055-
if (eindex < elen)
1056-
enow = e[eindex];
1007+
enow = e[++eindex];
10571008
Q = Qnew;
10581009
if (hh != 0.0) {
10591010
h[hindex++] = hh;
10601011
}
10611012
}
10621013
while (findex < flen) {
10631014
Two_Sum(Q, fnow, Qnew, hh);
1064-
/**
1065-
* [JWP] Increment 'findex,' but only update 'fnow' if it is
1066-
* safe. Otherwise, 'fnow' remains unchanged from the previous
1067-
* iteration...
1068-
*/
1069-
++findex;
1070-
if (findex < flen)
1071-
fnow = f[findex];
1015+
fnow = f[++findex];
10721016
Q = Qnew;
10731017
if (hh != 0.0) {
10741018
h[hindex++] = hh;
@@ -1221,7 +1165,7 @@ int linear_expansion_sum_zeroelim(int elen, REAL *e, int flen, REAL *f,
12211165
/* will h.) */
12221166
/* */
12231167
/*****************************************************************************/
1224-
1168+
static
12251169
int scale_expansion(int elen, REAL *e, REAL b, REAL *h)
12261170
/* e and h cannot be the same. */
12271171
{
@@ -1267,7 +1211,7 @@ int scale_expansion(int elen, REAL *e, REAL b, REAL *h)
12671211
/* will h.) */
12681212
/* */
12691213
/*****************************************************************************/
1270-
1214+
static
12711215
int scale_expansion_zeroelim(int elen, REAL *e, REAL b, REAL *h)
12721216
/* e and h cannot be the same. */
12731217
{
@@ -1319,7 +1263,7 @@ int scale_expansion_zeroelim(int elen, REAL *e, REAL b, REAL *h)
13191263
/* nonadjacent expansion. */
13201264
/* */
13211265
/*****************************************************************************/
1322-
1266+
static
13231267
int compress(int elen, REAL *e, REAL *h)
13241268
/* e and h may be the same. */
13251269
{
@@ -1362,7 +1306,7 @@ int compress(int elen, REAL *e, REAL *h)
13621306
/* See either version of my paper for details. */
13631307
/* */
13641308
/*****************************************************************************/
1365-
1309+
static
13661310
REAL estimate(int elen, REAL *e)
13671311
{
13681312
REAL Q;
@@ -1400,7 +1344,7 @@ REAL estimate(int elen, REAL *e)
14001344
/* nearly so. */
14011345
/* */
14021346
/*****************************************************************************/
1403-
1347+
static
14041348
REAL orient2dfast(REAL *pa, REAL *pb, REAL *pc)
14051349
{
14061350
REAL acx, bcx, acy, bcy;
@@ -1412,6 +1356,7 @@ REAL orient2dfast(REAL *pa, REAL *pb, REAL *pc)
14121356
return acx * bcy - acy * bcx;
14131357
}
14141358

1359+
//static
14151360
REAL orient2dexact(REAL *pa, REAL *pb, REAL *pc)
14161361
{
14171362
INEXACT REAL axby1, axcy1, bxcy1, bxay1, cxay1, cxby1;
@@ -2233,9 +2178,9 @@ REAL orient3dadapt(REAL *pa, REAL *pb, REAL *pc, REAL *pd, REAL permanent)
22332178

22342179
REAL orient3d(REAL *pa, REAL *pb, REAL *pc, REAL *pd)
22352180
{
2236-
return (REAL)
2181+
return (REAL)
22372182
- cgal_pred_obj.orientation_3_object()
2238-
(Point(pa[0], pa[1], pa[2]),
2183+
(Point(pa[0], pa[1], pa[2]),
22392184
Point(pb[0], pb[1], pb[2]),
22402185
Point(pc[0], pc[1], pc[2]),
22412186
Point(pd[0], pd[1], pd[2]));
@@ -2269,7 +2214,7 @@ REAL orient3d(REAL *pa, REAL *pb, REAL *pc, REAL *pd)
22692214
adxbdy = adx * bdy;
22702215
bdxady = bdx * ady;
22712216

2272-
det = adz * (bdxcdy - cdxbdy)
2217+
det = adz * (bdxcdy - cdxbdy)
22732218
+ bdz * (cdxady - adxcdy)
22742219
+ cdz * (adxbdy - bdxady);
22752220

@@ -4237,9 +4182,9 @@ REAL insphere(REAL *pa, REAL *pb, REAL *pc, REAL *pd, REAL *pe)
42374182
/* See my Robust Predicates paper for details. */
42384183
/* */
42394184
/*****************************************************************************/
4240-
4185+
//static
42414186
REAL orient4dexact(REAL* pa, REAL* pb, REAL* pc, REAL* pd, REAL* pe,
4242-
REAL aheight, REAL bheight, REAL cheight, REAL dheight,
4187+
REAL aheight, REAL bheight, REAL cheight, REAL dheight,
42434188
REAL eheight)
42444189
{
42454190
INEXACT REAL axby1, bxcy1, cxdy1, dxey1, exay1;
@@ -4453,8 +4398,9 @@ REAL orient4dexact(REAL* pa, REAL* pb, REAL* pc, REAL* pd, REAL* pe,
44534398
return deter[deterlen - 1];
44544399
}
44554400

4401+
static
44564402
REAL orient4dadapt(REAL* pa, REAL* pb, REAL* pc, REAL* pd, REAL* pe,
4457-
REAL aheight, REAL bheight, REAL cheight, REAL dheight,
4403+
REAL aheight, REAL bheight, REAL cheight, REAL dheight,
44584404
REAL eheight, REAL permanent)
44594405
{
44604406
INEXACT REAL aex, bex, cex, dex, aey, bey, cey, dey, aez, bez, cez, dez;
@@ -4649,8 +4595,8 @@ REAL orient4dadapt(REAL* pa, REAL* pb, REAL* pc, REAL* pd, REAL* pe,
46494595
aheight, bheight, cheight, dheight, eheight);
46504596
}
46514597

4652-
REAL orient4d(REAL* pa, REAL* pb, REAL* pc, REAL* pd, REAL* pe,
4653-
REAL aheight, REAL bheight, REAL cheight, REAL dheight,
4598+
REAL orient4d(REAL* pa, REAL* pb, REAL* pc, REAL* pd, REAL* pe,
4599+
REAL aheight, REAL bheight, REAL cheight, REAL dheight,
46544600
REAL eheight)
46554601
{
46564602
REAL aex, bex, cex, dex;
@@ -4756,3 +4702,9 @@ REAL orient4d(REAL* pa, REAL* pb, REAL* pc, REAL* pd, REAL* pe,
47564702

47574703

47584704

4705+
4706+
4707+
4708+
//==============================================================================
4709+
4710+

0 commit comments

Comments
 (0)