Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d141d8147e |
68
predicates.h
Normal file
68
predicates.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Routines for Arbitrary Precision Floating-point Arithmetic */
|
||||
/* and Fast Robust Geometric Predicates */
|
||||
/* */
|
||||
/* Declarations */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef PREDICATES_H
|
||||
#define PREDICATES_H
|
||||
|
||||
#include "tetgen.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void exactinit(int verbose, int noexact, int nofilter, REAL maxx, REAL maxy,
|
||||
REAL maxz);
|
||||
|
||||
int grow_expansion(int elen, REAL *e, REAL b, REAL *h);
|
||||
int grow_expansion_zeroelim(int elen, REAL *e, REAL b, REAL *h);
|
||||
int expansion_sum(int elen, REAL *e, int flen, REAL *f, REAL *h);
|
||||
int expansion_sum_zeroelim1(int elen, REAL *e, int flen, REAL *f, REAL *h);
|
||||
int expansion_sum_zeroelim2(int elen, REAL *e, int flen, REAL *f, REAL *h);
|
||||
int linear_expansion_sum(int elen, REAL *e, int flen, REAL *f, REAL *h);
|
||||
int linear_expansion_sum_zeroelim(int elen, REAL *e, int flen, REAL *f,
|
||||
REAL *h);
|
||||
int scale_expansion(int elen, REAL *e, REAL b, REAL *h);
|
||||
int scale_expansion_zeroelim(int elen, REAL *e, REAL b, REAL *h);
|
||||
int compress(int elen, REAL *e, REAL *h);
|
||||
REAL estimate(int elen, REAL *e);
|
||||
|
||||
REAL orient2dfast(REAL *pa, REAL *pb, REAL *pc);
|
||||
REAL orient2dexact(REAL *pa, REAL *pb, REAL *pc);
|
||||
REAL orient2dslow(REAL *pa, REAL *pb, REAL *pc);
|
||||
REAL orient2d(REAL *pa, REAL *pb, REAL *pc);
|
||||
|
||||
REAL orient3dfast(REAL *pa, REAL *pb, REAL *pc, REAL *pd);
|
||||
REAL orient3dexact(REAL *pa, REAL *pb, REAL *pc, REAL *pd);
|
||||
REAL orient3dslow(REAL *pa, REAL *pb, REAL *pc, REAL *pd);
|
||||
REAL orient3d(REAL *pa, REAL *pb, REAL *pc, REAL *pd);
|
||||
|
||||
REAL incirclefast(REAL *pa, REAL *pb, REAL *pc, REAL *pd);
|
||||
REAL incircleexact(REAL *pa, REAL *pb, REAL *pc, REAL *pd);
|
||||
REAL incircleslow(REAL *pa, REAL *pb, REAL *pc, REAL *pd);
|
||||
REAL incircle(REAL *pa, REAL *pb, REAL *pc, REAL *pd);
|
||||
|
||||
REAL inspherefast(REAL *pa, REAL *pb, REAL *pc, REAL *pd, REAL *pe);
|
||||
REAL insphereexact(REAL *pa, REAL *pb, REAL *pc, REAL *pd, REAL *pe);
|
||||
REAL insphere(REAL *pa, REAL *pb, REAL *pc, REAL *pd, REAL *pe);
|
||||
|
||||
REAL orient4dfast(REAL *pa, REAL *pb, REAL *pc, REAL *pd, REAL *pe,
|
||||
REAL aheight, REAL bheight, REAL cheight, REAL dheight,
|
||||
REAL eheight);
|
||||
REAL orient4dexact(REAL *pa, REAL *pb, REAL *pc, REAL *pd, REAL *pe,
|
||||
REAL aheight, REAL bheight, REAL cheight, REAL dheight,
|
||||
REAL eheight);
|
||||
REAL orient4d(REAL *pa, REAL *pb, REAL *pc, REAL *pd, REAL *pe,
|
||||
REAL aheight, REAL bheight, REAL cheight, REAL dheight,
|
||||
REAL eheight);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
142
tetgen.cxx
142
tetgen.cxx
@@ -46,28 +46,19 @@
|
||||
//============================================================================//
|
||||
|
||||
#include "tetgen.h"
|
||||
#include "io.cxx"
|
||||
|
||||
//== io_cxx ==================================================================//
|
||||
//== behavior_cxx ============================================================//
|
||||
// //
|
||||
// //
|
||||
|
||||
//============================================================================//
|
||||
// //
|
||||
// load_node_call() Read a list of points from a file. //
|
||||
// //
|
||||
// 'infile' is the file handle contains the node list. It may point to a //
|
||||
// .node, or .poly or .smesh file. 'markers' indicates each node contains an //
|
||||
// additional marker (integer) or not. 'uvflag' indicates each node contains //
|
||||
// u,v coordinates or not. It is reuqired by a PSC. 'infilename' is the name //
|
||||
// of the file being read, it is only used in error messages. //
|
||||
// //
|
||||
// The 'firstnumber' (0 or 1) is automatically determined by the number of //
|
||||
// the first index of the first point. //
|
||||
// syntax() Print list of command line switches. //
|
||||
// //
|
||||
//============================================================================//
|
||||
|
||||
bool tetgenio::load_node_call(FILE* infile, int markers, int uvflag,
|
||||
char* infilename)
|
||||
void tetgenbehavior::syntax()
|
||||
{
|
||||
char inputline[INPUTLINESIZE];
|
||||
char *stringptr;
|
||||
@@ -2826,131 +2817,10 @@ void tetgenio::save_faces2smesh(char* filebasename)
|
||||
|
||||
//============================================================================//
|
||||
// //
|
||||
// readline() Read a nonempty line from a file. //
|
||||
// //
|
||||
// A line is considered "nonempty" if it contains something more than white //
|
||||
// spaces. If a line is considered empty, it will be dropped and the next //
|
||||
// line will be read, this process ends until reaching the end-of-file or a //
|
||||
// non-empty line. Return NULL if it is the end-of-file, otherwise, return //
|
||||
// a pointer to the first non-whitespace character of the line. //
|
||||
// //
|
||||
//
|
||||
//
|
||||
//============================================================================//
|
||||
|
||||
char* tetgenio::readline(char *string, FILE *infile, int *linenumber)
|
||||
{
|
||||
char *result;
|
||||
|
||||
// Search for a non-empty line.
|
||||
do {
|
||||
result = fgets(string, INPUTLINESIZE - 1, infile);
|
||||
if (linenumber) (*linenumber)++;
|
||||
if (result == (char *) NULL) {
|
||||
return (char *) NULL;
|
||||
}
|
||||
// Skip white spaces.
|
||||
while ((*result == ' ') || (*result == '\t')) result++;
|
||||
// If it's end of line, read another line and try again.
|
||||
} while ((*result == '\0') || (*result == '\r') || (*result == '\n'));
|
||||
return result;
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// //
|
||||
// findnextfield() Find the next field of a string. //
|
||||
// //
|
||||
// Jumps past the current field by searching for whitespace or a comma, then //
|
||||
// jumps past the whitespace or the comma to find the next field. //
|
||||
// //
|
||||
//============================================================================//
|
||||
|
||||
char* tetgenio::findnextfield(char *string)
|
||||
{
|
||||
char *result;
|
||||
|
||||
result = string;
|
||||
// Skip the current field. Stop upon reaching whitespace or a comma.
|
||||
while ((*result != '\0') && (*result != ' ') && (*result != '\t') &&
|
||||
(*result != ',') && (*result != ';')) {
|
||||
result++;
|
||||
}
|
||||
// Now skip the whitespace or the comma, stop at anything else that looks
|
||||
// like a character, or the end of a line.
|
||||
while ((*result == ' ') || (*result == '\t') || (*result == ',') ||
|
||||
(*result == ';')) {
|
||||
result++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// //
|
||||
// readnumberline() Read a nonempty number line from a file. //
|
||||
// //
|
||||
// A line is considered "nonempty" if it contains something that looks like //
|
||||
// a number. Comments (prefaced by `#') are ignored. //
|
||||
// //
|
||||
//============================================================================//
|
||||
|
||||
char* tetgenio::readnumberline(char *string, FILE *infile, char *infilename)
|
||||
{
|
||||
char *result;
|
||||
|
||||
// Search for something that looks like a number.
|
||||
do {
|
||||
result = fgets(string, INPUTLINESIZE, infile);
|
||||
if (result == (char *) NULL) {
|
||||
return result;
|
||||
}
|
||||
// Skip anything that doesn't look like a number, a comment,
|
||||
// or the end of a line.
|
||||
while ((*result != '\0') && (*result != '#')
|
||||
&& (*result != '.') && (*result != '+') && (*result != '-')
|
||||
&& ((*result < '0') || (*result > '9'))) {
|
||||
result++;
|
||||
}
|
||||
// If it's a comment or end of line, read another line and try again.
|
||||
} while ((*result == '#') || (*result == '\0'));
|
||||
return result;
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// //
|
||||
// findnextnumber() Find the next field of a number string. //
|
||||
// //
|
||||
// Jumps past the current field by searching for whitespace or a comma, then //
|
||||
// jumps past the whitespace or the comma to find the next field that looks //
|
||||
// like a number. //
|
||||
// //
|
||||
//============================================================================//
|
||||
|
||||
char* tetgenio::findnextnumber(char *string)
|
||||
{
|
||||
char *result;
|
||||
|
||||
result = string;
|
||||
// Skip the current field. Stop upon reaching whitespace or a comma.
|
||||
while ((*result != '\0') && (*result != '#') && (*result != ' ') &&
|
||||
(*result != '\t') && (*result != ',')) {
|
||||
result++;
|
||||
}
|
||||
// Now skip the whitespace and anything else that doesn't look like a
|
||||
// number, a comment, or the end of a line.
|
||||
while ((*result != '\0') && (*result != '#')
|
||||
&& (*result != '.') && (*result != '+') && (*result != '-')
|
||||
&& ((*result < '0') || (*result > '9'))) {
|
||||
result++;
|
||||
}
|
||||
// Check for a comment (prefixed with `#').
|
||||
if (*result == '#') {
|
||||
*result = '\0';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// //
|
||||
// //
|
||||
//== io_cxx ==================================================================//
|
||||
|
||||
|
||||
//== behavior_cxx ============================================================//
|
||||
// //
|
||||
|
||||
Reference in New Issue
Block a user