mirror of https://github.com/KLayout/klayout.git
Fixed a numerical issue leading to an infinite loop on some compilers
This commit is contained in:
parent
cb3d7bc5f3
commit
6ad1f3f73f
|
|
@ -491,7 +491,7 @@ Triangles::find_closest_edge (const db::DPoint &p, db::Vertex *vstart, bool insi
|
||||||
db::DVector r = p - *cv;
|
db::DVector r = p - *cv;
|
||||||
double edge_sp = db::sprod (r, edge_d) / edge_d.length ();
|
double edge_sp = db::sprod (r, edge_d) / edge_d.length ();
|
||||||
double s_sp = db::sprod (r, e_d) / e_d.length ();
|
double s_sp = db::sprod (r, e_d) / e_d.length ();
|
||||||
if (s_sp > edge_sp) {
|
if (s_sp > edge_sp + db::epsilon) {
|
||||||
edge = *e;
|
edge = *e;
|
||||||
vnext = edge->other (v);
|
vnext = edge->other (v);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ TEST(insert_vertex_convex)
|
||||||
tris.insert_point (0.6, 0.5);
|
tris.insert_point (0.6, 0.5);
|
||||||
tris.insert_point (0.7, 0.5);
|
tris.insert_point (0.7, 0.5);
|
||||||
tris.insert_point (0.6, 0.4);
|
tris.insert_point (0.6, 0.4);
|
||||||
EXPECT_EQ (tris.to_string (), "((0.2, 0.2), (0.2, 0.8), (0.6, 0.5)), ((0.7, 0.5), (0.6, 0.5), (0.2, 0.8)), ((0.6, 0.5), (0.6, 0.4), (0.2, 0.2)), ((0.6, 0.5), (0.7, 0.5), (0.6, 0.4))");
|
EXPECT_EQ (tris.to_string (), "((0.2, 0.2), (0.2, 0.8), (0.6, 0.5)), ((0.2, 0.8), (0.7, 0.5), (0.6, 0.5)), ((0.6, 0.4), (0.6, 0.5), (0.7, 0.5)), ((0.6, 0.4), (0.2, 0.2), (0.6, 0.5))");
|
||||||
EXPECT_EQ (tris.check(), true);
|
EXPECT_EQ (tris.check(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue