simplify bbox loop

This commit is contained in:
Jane Tournois 2022-04-05 10:14:14 +02:00
parent 2b76e2a555
commit 03a8445b8d
1 changed files with 5 additions and 14 deletions

View File

@ -293,22 +293,13 @@ void Scene_c3t3_item::compute_bbox() const
_bbox = Bbox();
else
{
bool bbox_init = false;
CGAL::Bbox_3 result;
CGAL::Bbox_3 result;//default is [+infinity; -infinity]
for (Tr::Cell_handle c : c3t3().cells_in_complex())
{
if (bbox_init)
{
Tr::Vertex_handle v = (c->vertex(0) != c3t3().triangulation().infinite_vertex())
? c->vertex(0) : c->vertex(1);
result = result + v->point().bbox();
}
else
{
for(int i = 0; i < 4; ++i)
result = c->vertex(i)->point().bbox();
bbox_init = true;
}
Tr::Vertex_handle v = (c->vertex(0) != c3t3().triangulation().infinite_vertex())
? c->vertex(0)
: c->vertex(1);
result += v->point().bbox();
}
_bbox = Bbox(result.xmin(), result.ymin(), result.zmin(),
result.xmax(), result.ymax(), result.zmax());