35 #define REAL double // #define REAL float
39 #define FILENAMESIZE 1024
43 #define INPUTLINESIZE 2048
66 #ifdef _MSC_VER // Microsoft Visual C++
68 typedef __int64 intptr_t;
69 typedef unsigned __int64 uintptr_t;
72 typedef unsigned int uintptr_t;
74 #else // not Visual C++
329 bool load_node_call(FILE* infile,
int markers,
int uvflag,
char*);
355 char *
readline(
char*
string, FILE* infile,
int *linenumber);
357 char *
readnumberline(
char*
string, FILE* infile,
char* infilename);
994 void poolinit(
int sizeofobject,
int log2objperblk);
996 void*
lookup(
int objectindex);
999 arraypool(
int sizeofobject,
int log2objperblk);
1007 #define fastlookup(pool, index) \
1008 (void *) ((pool)->toparray[(index) >> (pool)->log2objectsperblock] + \
1009 ((index) & (pool)->objectsperblockmark) * (pool)->objectbytes)
2239 #endif // #ifdef TETLIBRARY
2258 printf(
"Error: Out of memory.\n");
2261 printf(
"Please report this bug to Hang.Si@wias-berlin.de. Include\n");
2262 printf(
" the message above, your input data set, and the exact\n");
2263 printf(
" command line you used to run this program, thank you.\n");
2266 printf(
"A self-intersection was detected. Program stopped.\n");
2267 printf(
"Hint: use -d option to detect all self-intersections.\n");
2270 printf(
"A very small input feature size was detected. Program stopped.\n");
2271 printf(
"Hint: use -T option to set a smaller tolerance.\n");
2274 printf(
"Two very close input facets were detected. Program stopped.\n");
2275 printf(
"Hint: use -Y option to avoid adding Steiner points in boundary.\n");
2278 printf(
"An input error was detected. Program stopped.\n");
2282 #endif // #ifdef TETLIBRARY
2296 return (
tetrahedron) ((uintptr_t) (t).tet | (uintptr_t) (t).ver);
2300 return (
tetrahedron) ((uintptr_t) (ptr) | (uintptr_t) (ver));
2307 (
t).ver = (
int) ((uintptr_t) (ptr) & (uintptr_t) 15);
2308 (
t).tet = (
tetrahedron *) ((uintptr_t) (ptr) ^ (uintptr_t) (t).ver);
2352 (
t2).tet = (t1).tet;
2410 decode((t1).tet[(t1).ver & 3], t2);
2415 #define fsymself(t) \
2417 decode((t).tet[(t).ver & 3], (t));\
2418 (t).ver = fsymtbl[t1ver][(t).ver]
2430 #define fnextself(t) \
2432 decode((t).tet[facepivot1[(t).ver]], (t)); \
2433 (t).ver = facepivot2[t1ver][(t).ver]
2471 #define setvertices(t, torg, tdest, tapex, toppo) \
2472 (t).tet[orgpivot[(t).ver]] = (tetrahedron) (torg);\
2473 (t).tet[destpivot[(t).ver]] = (tetrahedron) (tdest); \
2474 (t).tet[apexpivot[(t).ver]] = (tetrahedron) (tapex); \
2475 (t).tet[oppopivot[(t).ver]] = (tetrahedron) (toppo)
2502 int *iptr = (
int *) &(ptr[10]);
2507 int *iptr = (
int *) &(ptr[10]);
2584 (
int) (64 <<
ver2edge[(t).ver])) != 0;
2637 return ((t.
tet == NULL) || (t.
tet[4] == NULL));
2655 s.
shver = (int) ((uintptr_t) (sptr) & (uintptr_t) 7);
2664 return (
shellface) ((uintptr_t) sh | (uintptr_t) shver);
2741 #define setshvertices(s, pa, pb, pc)\
2831 return (((
int *) ((s).sh))[
shmarkindex+1] & (
int) 1) != 0;
2851 return ((((
int *) ((s).sh))[
shmarkindex+1] & (
int) 2) != 0);
2871 return ((((
int *) ((s).sh))[
shmarkindex+1] & (
int) 4) != 0);
2890 return ((((
int *) ((s).sh))[
shmarkindex+1] & (
int) 8) != 0);
2921 if ((t).tet[9] == NULL) {
2925 for (
int i = 0; i < 4; i++) {
2930 ((
shellface *) (t).tet[9])[(t).ver & 3] =
2933 s.
sh[9 + ((
s).shver & 1)] =
2944 if ((t).tet[9] == NULL) {
2954 #define issubface(t) \
2955 ((t).tet[9] && ((t).tet[9])[(t).ver & 3])
2964 if ((t).tet == NULL) {
2972 #define isshtet(s) \
2973 ((s).sh[9 + ((s).shver & 1)])
2979 if ((t).tet[9] != NULL) {
2980 ((
shellface *) (t).tet[9])[(t).ver & 3] = NULL;
3016 s.
sh[6 + (s.
shver >> 1)] = NULL;
3028 #define isshsubseg(s) \
3029 ((s).sh[6 + ((s).shver >> 1)])
3039 if ((t).tet[8] == NULL) {
3043 for (
int i = 0; i < 6; i++) {
3057 if ((t).tet[8] != NULL) {
3069 if ((t).tet[8] != NULL) {
3078 #define issubseg(t) \
3079 ((t).tet[8] && ((t).tet[8])[ver2edge[(t).ver]])
3109 ((
int) value << 8) + (((
int *) (pt))[
pointmarkindex + 1] & (int) 255);
3239 if ((
point) searchtet.
tet[4] == pa) {
3241 }
else if ((
point) searchtet.
tet[5] == pa) {
3243 }
else if ((
point) searchtet.
tet[6] == pa) {
3246 assert((
point) searchtet.
tet[7] == pa);
3256 if ((
point) searchsh.
sh[3] == pa) {
3258 }
else if ((
point) searchsh.
sh[4] == pa) {
3259 searchsh.
shver = (searchsh.
sh[5] != NULL ? 2 : 1);
3261 assert((
point) searchsh.
sh[5] == pa);
3271 face travesh, neighsh;
3277 if (neighsh.
sh == NULL)
break;
3281 return sorg(travesh);
3286 face travesh, neighsh;
3290 senext(travesh, neighsh);
3292 if (neighsh.
sh == NULL)
break;
3294 senext(neighsh, travesh);
3296 return sdest(travesh);
3308 return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
3314 n[0] = v1[1] * v2[2] - v2[1] * v1[2];
3315 n[1] = -(v1[0] * v2[2] - v2[0] * v1[2]);
3316 n[2] = v1[0] * v2[1] - v2[0] * v1[1];
3322 return sqrt((p2[0] - p1[0]) * (p2[0] - p1[0]) +
3323 (p2[1] - p1[1]) * (p2[1] - p1[1]) +
3324 (p2[2] - p1[2]) * (p2[2] - p1[2]));
3329 return (x) * (
x) + (y) * (
y) + (z) * (
z);
3333 #endif // #ifndef tetgenH