+/* check to see if specified node is in the extra list */
+int is_extra_node(double *n) {
+ int i;
+
+ for ( i = 1; i <= excount; i++ ) {
+ // we only check lon/lat in case the height got fooled with
+ // along the way
+ if ( (fabs(n[0] - exnodes[i][0]) < FG_EPSILON) &&
+ (fabs(n[1] - exnodes[i][1]) < FG_EPSILON) ) {
+ return(1);
+ }
+ }
+
+ return(0);
+}
+
+/* Read all the extra nodes. These typically define inner areas to
+ exclude from triangulations. There will be a .poly file that
+ refers to these by position number which assumes all the extra
+ nodes come first in the generated .node file. */
+void read_extra_nodes(char *exfile) {
+ FILE *fd;
+ int i, junk1, junk2, junk3;
+
+ // load extra nodes if they exist
+ excount = 0;
+ if ( (fd = fopen(exfile, "r")) != NULL ) {
+ printf("Found and 'extra' node file = %s\n", exfile);
+ fscanf(fd, "%d %d %d %d", &excount, &junk1, &junk2, &junk3);
+
+ if ( excount > MAX_NODES - 1 ) {
+ printf("Error, too many 'extra' nodes, increase array size\n");
+ exit(-1);
+ } else {
+ printf(" Expecting %d 'extra' nodes\n", excount);
+ }
+
+ for ( i = 1; i <= excount; i++ ) {
+ fscanf(fd, "%d %lf %lf %lf\n", &junk1,
+ &exnodes[i][0], &exnodes[i][1], &exnodes[i][2]);
+ printf("(extra) %d %.2f %.2f %.2f\n",
+ i, exnodes[i][0], exnodes[i][1], exnodes[i][2]);
+ }
+ }
+ fclose(fd);
+}
+
+