Triangle: slightly improve point-in-hole heuristic
This commit is contained in:
parent
6506e540f8
commit
e09d638bc5
@ -181,8 +181,8 @@ jint Java_org_oscim_renderer_sublayers_ExtrusionLayer_triangulate(JNIEnv *env, j
|
|||||||
float ux = -vy / a;
|
float ux = -vy / a;
|
||||||
float uy = vx / a;
|
float uy = vx / a;
|
||||||
|
|
||||||
float centerx = cx + vx / 2 - ux;
|
float centerx = cx + vx / 2.0 - (ux * 0.1);
|
||||||
float centery = cy + vy / 2 - uy;
|
float centery = cy + vy / 2.0 - (uy * 0.1);
|
||||||
|
|
||||||
*hole++ = centerx;
|
*hole++ = centerx;
|
||||||
*hole++ = centery;
|
*hole++ = centery;
|
||||||
@ -253,6 +253,7 @@ jint Java_org_oscim_renderer_sublayers_ExtrusionLayer_triangulate(JNIEnv *env, j
|
|||||||
triangulate(&opt, &in, &out, (TriangleIO *) NULL);
|
triangulate(&opt, &in, &out, (TriangleIO *) NULL);
|
||||||
|
|
||||||
if (in.numberofpoints < out.numberofpoints) {
|
if (in.numberofpoints < out.numberofpoints) {
|
||||||
|
// TODO rerun with 'nonodewritten = 0'
|
||||||
printf( "polygon input is bad! points in:%d out%d\n", in.numberofpoints, out.numberofpoints);
|
printf( "polygon input is bad! points in:%d out%d\n", in.numberofpoints, out.numberofpoints);
|
||||||
out.numberoftriangles = 0;
|
out.numberoftriangles = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user