Triangle: mark second occurrence of duplicate vertices as UNDEAD
so that they are ignored by skeleton builder
This commit is contained in:
parent
c4d0c4af57
commit
46c7c34bb2
@ -23,6 +23,26 @@ int pnpoly(int nvert, float *vert, float testx, float testy)
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
int compare_dups(const void *a, const void *b) {
|
||||
int da = *((const long*) a);
|
||||
int db = *((const long*) b);
|
||||
return (da > db) - (da < db);
|
||||
}
|
||||
|
||||
void shiftSegment(TriangleIO *in, int *seg, int pos) {
|
||||
int size = (in->numberofsegments - pos - 1) * sizeof(int) * 2;
|
||||
printf("shift %d - %d %d\n", size, in->numberofsegments, pos);
|
||||
if (size > 0)
|
||||
memmove(seg, seg + 2, size);
|
||||
|
||||
in->numberofsegments -= 1;
|
||||
}
|
||||
struct {
|
||||
int p1;
|
||||
int p2;
|
||||
} segment;
|
||||
|
||||
#endif
|
||||
|
||||
static void printPoly(TriangleIO *in) {
|
||||
@ -188,7 +208,7 @@ jint Java_org_oscim_renderer_sublayers_ExtrusionLayer_triangulate(JNIEnv *env, j
|
||||
}
|
||||
printPoly(&in);
|
||||
|
||||
// shift segment indices while removing duplicate points
|
||||
// replace duplicate positions with first occurence
|
||||
for (int i = 0; i < dups; i++) {
|
||||
// position of the duplicate vertex
|
||||
int pos = skip_list[i * 2] - i;
|
||||
@ -197,8 +217,10 @@ jint Java_org_oscim_renderer_sublayers_ExtrusionLayer_triangulate(JNIEnv *env, j
|
||||
|
||||
seg = in.segmentlist;
|
||||
for (int j = 0; j < in.numberofsegments * 2; j++, seg++) {
|
||||
if (*seg == pos)
|
||||
if (*seg == pos) {
|
||||
printf("%d: %d <- %d", j, pos, replacement);
|
||||
*seg = replacement;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ void trifree(VOID *memptr) {
|
||||
int error_set = 0;
|
||||
void internalerror() {
|
||||
error_set = 1;
|
||||
|
||||
printf("Triangle is going to quit its job now\n");
|
||||
//printf(" Please report this bug to jrs@cs.berkeley.edu\n");
|
||||
///printf(" Include the message above, your input data set, and the exact\n");
|
||||
//printf(" command line you used to run Triangle.\n");
|
||||
@ -6670,6 +6670,21 @@ void transfernodes(struct mesh *m, struct behavior *b, REAL *pointlist, REAL *po
|
||||
/* If no markers are specified, they default to zero. */
|
||||
setvertexmark(vertexloop, 0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
for (j = (i - 1) * 2; j >= 0; j -= 2){
|
||||
if (x == pointlist[j] && y == pointlist[j+1]){
|
||||
printf("skip duplicate %d\n", j >> 1);
|
||||
setvertextype(vertexloop, UNDEADVERTEX);
|
||||
vertexloop[0] = 0xffffffff;
|
||||
vertexloop[1] = 0xffffffff;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j >= 0)
|
||||
continue;
|
||||
// ----------------------------------------------
|
||||
|
||||
setvertextype(vertexloop, INPUTVERTEX);
|
||||
/* Determine the smallest and largest x and y coordinates. */
|
||||
if (i == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user