From 3f4641623f8d1b4661b41314b359eae49b6c1cf8 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 5 Mar 2018 14:53:51 +0100 Subject: [PATCH 1/2] Fix cut_plane when loading c3t3 with offset --- Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp index 325c614bd50..c5e5960f63e 100644 --- a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp @@ -1673,7 +1673,8 @@ Scene_c3t3_item_priv::reset_cut_plane() { const float ycenter = static_cast((bbox.ymax()+bbox.ymin())/2.); const float zcenter = static_cast((bbox.zmax()+bbox.zmin())/2.); const qglviewer::Vec offset = static_cast(QGLViewer::QGLViewerPool().first())->offset(); - frame->setPosition(qglviewer::Vec(xcenter+offset.x, ycenter+offset.y, zcenter+offset.z)); + qglviewer::Vec center(xcenter+offset.x, ycenter+offset.y, zcenter+offset.z); + frame->setPosition(center); } void @@ -2050,6 +2051,7 @@ CGAL::Three::Scene_item::Header_data Scene_c3t3_item::header() const void Scene_c3t3_item::invalidateOpenGLBuffers() { are_buffers_filled = false; + resetCutPlane(); compute_bbox(); d->invalidate_stats(); } From 2cd2319af91c909a1103cc6aa9e6076975d13db2 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 5 Mar 2018 15:04:41 +0100 Subject: [PATCH 2/2] Fix display with offset --- Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp index c5e5960f63e..730dcb927da 100644 --- a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp @@ -223,9 +223,9 @@ public : colors->push_back((float)color.green()/255); colors->push_back((float)color.blue()/255); - barycenters->push_back((pa[0]+pb[0]+pc[0])/3.0); - barycenters->push_back((pa[1]+pb[1]+pc[1])/3.0); - barycenters->push_back((pa[2]+pb[2]+pc[2])/3.0); + barycenters->push_back((pa[0]+pb[0]+pc[0])/3.0 + offset.x); + barycenters->push_back((pa[1]+pb[1]+pc[1])/3.0 + offset.y); + barycenters->push_back((pa[2]+pb[2]+pc[2])/3.0 + offset.z); } } @@ -1096,9 +1096,9 @@ void Scene_c3t3_item_priv::draw_triangle(const Tr::Bare_point& pa, for(int i=0; i<3; ++i) { - positions_barycenter.push_back((pa[0]+pb[0]+pc[0])/3.0); - positions_barycenter.push_back((pa[1]+pb[1]+pc[1])/3.0); - positions_barycenter.push_back((pa[2]+pb[2]+pc[2])/3.0); + positions_barycenter.push_back((pa[0]+pb[0]+pc[0])/3.0 + offset.x); + positions_barycenter.push_back((pa[1]+pb[1]+pc[1])/3.0 + offset.y); + positions_barycenter.push_back((pa[2]+pb[2]+pc[2])/3.0 + offset.z); }