Changeset 333

Show
Ignore:
Timestamp:
03/26/08 17:39:03 (8 months ago)
Author:
powell
Message:

Removed the three-corner facet using an area test.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/matml/src/ternary/qhull.c

    r331 r333  
    1111#include <qhull/qhull.h> 
    1212#include <stdlib.h> 
     13#include <math.h> 
    1314 
    1415 
     
    103104          j++; 
    104105        } 
    105       i++; 
     106 
    106107      /* Remove non-simplical facets */ 
    107108      if (j>3) 
    108109        { 
    109110          (*numfacets)--; 
    110           i--; 
    111111        } 
    112       /* TODO: remove the trivial three-corners facet */ 
     112 
     113      /* Remove facet with the three corners using an area test */ 
     114      else 
     115        { 
     116          coordT x0 = qpoints [3* (*facetverts) [3*i]], 
     117            y0 = qpoints [3* (*facetverts) [3*i]+1], 
     118            x1 = qpoints [3* (*facetverts) [3*i+1]], 
     119            y1 = qpoints [3* (*facetverts) [3*i+1]+1], 
     120            x2 = qpoints [3* (*facetverts) [3*i+2]], 
     121            y2 = qpoints [3* (*facetverts) [3*i+2]+1]; 
     122#ifdef DEBUG 
     123          printf ("  xyarea %g\n", 
     124                  fabs ((x1-x0)*(y2-y0) - (x2-x0)*(y1-y0))); 
     125#endif 
     126          if (fabs ((x1-x0)*(y2-y0) - (x2-x0)*(y1-y0)) == 1.) 
     127            (*numfacets)--; 
     128 
     129          else 
     130            i++; 
     131        } 
    113132    } 
    114133 
    115134#ifdef DEBUG 
    116   printf ("%d total facets\n", *numfacets); 
    117135  printf ("After loop: numfacets=%d, i=%d\n", *numfacets, i); 
    118136#endif