Merge branch 'tm_sla_support_tree_crash_SPE-1305'
This commit is contained in:
commit
c4e133718d
2 changed files with 6 additions and 3 deletions
|
@ -24,6 +24,7 @@ Vec3d get_normal(const AABBMesh &mesh,
|
||||||
Vec3d p;
|
Vec3d p;
|
||||||
|
|
||||||
mesh.squared_distance(picking_point, faceid, p);
|
mesh.squared_distance(picking_point, faceid, p);
|
||||||
|
assert(int(faceid) < int(mesh.get_triangle_mesh()->indices.size()));
|
||||||
|
|
||||||
auto trindex = mesh.indices(faceid);
|
auto trindex = mesh.indices(faceid);
|
||||||
|
|
||||||
|
@ -89,9 +90,10 @@ Vec3d get_normal(const AABBMesh &mesh,
|
||||||
}
|
}
|
||||||
} else if (edge_idx >= 0) { // the point is on and edge
|
} else if (edge_idx >= 0) { // the point is on and edge
|
||||||
size_t neighbor_face = mesh.face_neighbor_index()[faceid](edge_idx);
|
size_t neighbor_face = mesh.face_neighbor_index()[faceid](edge_idx);
|
||||||
|
if (neighbor_face < mesh.indices().size()) {
|
||||||
neigh.emplace_back(mesh.normal_by_face_id(faceid));
|
neigh.emplace_back(mesh.normal_by_face_id(faceid));
|
||||||
neigh.emplace_back(mesh.normal_by_face_id(neighbor_face));
|
neigh.emplace_back(mesh.normal_by_face_id(neighbor_face));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!neigh.empty()) { // there were neighbors to count with
|
if (!neigh.empty()) { // there were neighbors to count with
|
||||||
|
|
|
@ -517,6 +517,7 @@ bool optimize_pinhead_placement(Ex policy,
|
||||||
Head &head)
|
Head &head)
|
||||||
{
|
{
|
||||||
Vec3d n = get_normal(m.emesh, head.pos);
|
Vec3d n = get_normal(m.emesh, head.pos);
|
||||||
|
assert(std::abs(n.norm() - 1.0) < EPSILON);
|
||||||
|
|
||||||
// for all normals the spherical coordinates are generated and
|
// for all normals the spherical coordinates are generated and
|
||||||
// the polar angle is saturated to 45 degrees from the bottom then
|
// the polar angle is saturated to 45 degrees from the bottom then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue