Merge pull request #4762 from maxGimeno/Demo-Fixes-maxGimeno

3D Demo: Fixes
This commit is contained in:
Laurent Rineau 2020-06-05 17:51:59 +02:00
commit ad93669f85
7 changed files with 24 additions and 13 deletions

View File

@ -29,7 +29,7 @@
#include <CGAL/spatial_sort.h>
#ifdef CGAL_LINKED_WITH_TBB
#include "tbb/parallel_reduce.h"
#include <tbb/parallel_reduce.h>
#include <tbb/blocked_range.h>
#include <atomic>
#endif // CGAL_LINKED_WITH_TBB
@ -82,7 +82,7 @@ struct Distance_computation{
const PointRange& sample_points;
Point_3 initial_hint;
double distance;
//constro
//constructor
Distance_computation(
const AABB_tree& tree,
const Point_3& p,
@ -92,7 +92,7 @@ struct Distance_computation{
, initial_hint(p)
, distance(-1)
{}
//split constro
//split constructor
Distance_computation(Distance_computation& s, tbb::split )
: tree(s.tree)
, sample_points(s.sample_points)
@ -117,7 +117,7 @@ struct Distance_computation{
distance = hdist;
}
void join( Distance_computation& rhs ) {distance = std::max(rhs.distance, distance); }
void join( Distance_computation& rhs ) {distance = (std::max)(rhs.distance, distance); }
};
#endif

View File

@ -1027,7 +1027,7 @@ void MainWindow::computeViewerBBox(CGAL::qglviewer::Vec& vmin, CGAL::qglviewer::
double l_dist = (std::max)((std::abs)(bbox_center.x - viewer->offset().x),
(std::max)((std::abs)(bbox_center.y - viewer->offset().y),
(std::abs)(bbox_center.z - viewer->offset().z)));
if((std::log2)(l_dist/bbox_diag) > 13.0 )
if((std::log2)(l_dist/bbox_diag) > 11.0 )
for(int i=0; i<3; ++i)
{
offset[i] = -bbox_center[i];

View File

@ -67,7 +67,7 @@
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Tip: To split your mesh according to the result of this operation, you can click on &lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Operations-&amp;gt;Operations on Polyhedra-&amp;gt;Split Selected Polyhedra&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Operations-&amp;gt;Polygon Mesh Processing-&amp;gt;Split Selected Polyhedra&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>

View File

@ -157,7 +157,7 @@ public :
const EPICK::Plane_3& plane = qobject_cast<Scene_c3t3_item*>(this->parent())->plane();
float shrink_factor = qobject_cast<Scene_c3t3_item*>(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()
@ -2098,5 +2100,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"

View File

@ -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);

View File

@ -512,7 +512,7 @@ Scene_polygon_soup_item::toolTip() const
return QString();
QString str = QObject::tr("<p><b>%1</b> (mode: %5, color: %6)<br />"
"<i>Polygons soup</i></p>"
"<i>Polygon soup</i></p>"
"<p>Number of vertices: %2<br />"
"Number of polygons: %3</p>")
.arg(this->name())

View File

@ -245,8 +245,12 @@ public Q_SLOTS:
{
for(int i = 0; i < children.size(); ++i)
{
if(children[i] >= removed_id)
if(children[i] > removed_id)
--children[i];
else if(children[i] == removed_id)//child has been removed from the scene, it doesn't exist anymore.
{
children.removeAll(removed_id);
}
}
}
private: