Getting rid of signed distance from collision detection.

This commit is contained in:
tamasmeszaros 2019-01-31 10:11:37 +01:00
parent 3f10b2f7f8
commit 095dfcad9e
2 changed files with 11 additions and 7 deletions

View File

@ -659,6 +659,7 @@ double pinhead_mesh_intersect(const Vec3d& s,
if(hr.is_inside()) { // the hit is inside the model
if(hr.distance() > 2*r_pin) phi = 0;
else {
// re-cast the ray from the outside of the object
auto hr2 = m.query_ray_hit(ps + (hr.distance() + 2*sd)*n, n);
phi = hr2.distance();
}
@ -708,13 +709,16 @@ double bridge_mesh_intersect(const Vec3d& s,
s(Y) + rcos * a(Y) + rsin * b(Y),
s(Z) + rcos * a(Z) + rsin * b(Z));
Vec3d sp;
if(ins_check) {
auto result = m.signed_distance(p);
sp = result.value() < 0 ? result.point_on_mesh() : p;
} else sp = p;
auto hr = m.query_ray_hit(p + sd*dir, dir);
phi = m.query_ray_hit(sp + sd*dir, dir).distance();
if(ins_check && hr.is_inside()) {
if(hr.distance() > 2*r) phi = 0;
else {
// re-cast the ray from the outside of the object
auto hr2 = m.query_ray_hit(p + (hr.distance() + 2*sd)*dir, dir);
phi = hr2.distance();
}
} else phi = hr.distance();
});
auto mit = std::min_element(phis.begin(), phis.end());

View File

@ -78,7 +78,7 @@ struct SupportConfig {
double object_elevation_mm = 10;
// The max Z angle for a normal at which it will get completely ignored.
double normal_cutoff_angle = 110.0 * M_PI / 180.0;
double normal_cutoff_angle = 150.0 * M_PI / 180.0;
};