SLA gizmo no more uses IGL code directly, all was moved to the new MeshRaycaster class

This commit is contained in:
Lukas Matena 2019-09-17 14:56:46 +02:00
parent 1dfd8a0e62
commit 6bcafd7c83
4 changed files with 24 additions and 39 deletions

View file

@ -240,11 +240,27 @@ std::vector<unsigned> MeshRaycaster::get_unobscured_idxs(const Geometry::Transfo
if (! is_obscured)
out.push_back(i);
}
return out;
}
Vec3f MeshRaycaster::get_closest_point(const Vec3f& point, Vec3f* normal) const
{
int idx = 0;
Eigen::Matrix<float, 1, 3> closest_point;
m_AABB_wrapper->m_AABB.squared_distance(
AABBWrapper::MapMatrixXfUnaligned(m_mesh->its.vertices.front().data(), m_mesh->its.vertices.size(), 3),
AABBWrapper::MapMatrixXiUnaligned(m_mesh->its.indices.front().data(), m_mesh->its.indices.size(), 3),
point, idx, closest_point);
if (normal) {
igl::Hit imag_hit;
imag_hit.id = idx;
*normal = m_AABB_wrapper->get_hit_normal(imag_hit);
}
return closest_point;
}
} // namespace GUI
} // namespace Slic3r