SPE-1926: Fixed crash introduced with 85e567788badabf7f9e89103a2333624814a5dd5

This commit is contained in:
enricoturri1966 2023-10-12 13:30:58 +02:00
parent c12eeee12f
commit c31906b0d1

View File

@ -928,9 +928,12 @@ const std::pair<Vec3d, double> Selection::get_bounding_sphere() const
std::vector<Point> points;
if (m_valid) {
for (unsigned int i : m_list) {
const TriangleMesh* hull = (*m_volumes)[i]->convex_hull();
const Transform3d& matrix = (*m_volumes)[i]->world_matrix();
for (const Vec3f& v : hull->its.vertices) {
const GLVolume& volume = *(*m_volumes)[i];
const TriangleMesh* hull = volume.convex_hull();
const indexed_triangle_set& its = (hull != nullptr) ?
hull->its : m_model->objects[volume.object_idx()]->volumes[volume.volume_idx()]->mesh().its;
const Transform3d& matrix = volume.world_matrix();
for (const Vec3f& v : its.vertices) {
const Vec3d vv = matrix * v.cast<double>();
points.push_back(Point(vv.x(), vv.y(), vv.z()));
}