From ee4f996043e752ef00c64a369929a1c5a93e0680 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 3 Jun 2020 11:24:18 +0200 Subject: [PATCH] Add a clone to the c3t3 and fix an error in the cutting plane orientation --- Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp | 12 ++++++++++-- Polyhedron/demo/Polyhedron/Scene_c3t3_item.h | 5 ++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp index 01c192db153..1595716a2c9 100644 --- a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp @@ -157,7 +157,7 @@ public : const EPICK::Plane_3& plane = qobject_cast(this->parent())->plane(); float shrink_factor = qobject_cast(this->parent())->getShrinkFactor(); QVector4D cp = cgal_plane_to_vector4d(plane); - getTriangleContainer(0)->setPlane(cp); + getTriangleContainer(0)->setPlane(-cp); getTriangleContainer(0)->setShrinkFactor(shrink_factor); // positions_poly is also used for the faces in the cut plane // and changes when the cut plane is moved @@ -569,8 +569,10 @@ Scene_c3t3_item::Scene_c3t3_item(const C3t3& c3t3, bool is_surface) : Scene_group_item("unnamed") , d(new Scene_c3t3_item_priv(c3t3, this)) { - d->reset_cut_plane(); common_constructor(is_surface); + d->reset_cut_plane(); + c3t3_changed(); + changed(); } Scene_c3t3_item::~Scene_c3t3_item() @@ -2097,5 +2099,11 @@ void Scene_c3t3_item::newViewer(Viewer_interface *viewer) d->computeIntersections(viewer); } } + +Scene_c3t3_item* Scene_c3t3_item::clone() const +{ + return new Scene_c3t3_item(d->c3t3, d->is_surface); +} + #include "Scene_c3t3_item.moc" diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.h b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.h index 1c2e4316451..90b02e87c7b 100644 --- a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.h @@ -101,9 +101,8 @@ public: { return Scene_item::bbox(); } - Scene_c3t3_item* clone() const Q_DECL_OVERRIDE{ - return 0; - } + + Scene_c3t3_item* clone() const Q_DECL_OVERRIDE; bool load_binary(std::istream& is);