Favor earlier exit by reordering planes

This commit is contained in:
Andreas Fabri 2020-11-19 08:44:28 +00:00
parent e668500c05
commit 6080b92f12
2 changed files with 14 additions and 17 deletions

View File

@ -12,7 +12,7 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Envelope.h>
#include <CGAL/Polyhedral_envelope.h>
#include <CGAL/Timer.h>
#include <fstream>
@ -28,7 +28,7 @@ int main(int argc, char* argv[])
typedef std::array<int, 3> Vector3i;
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point_3;
typedef CGAL::Envelope<Kernel> Envelope;
typedef CGAL::Polyhedral_envelope<Kernel> Envelope;
std::vector<Point_3> env_vertices;
std::vector<Vector3i> env_faces;

View File

@ -1745,13 +1745,6 @@ private:
halfspace[i].emplace_back(plane);// number 2
if (obtuse != 1) {
plane = get_corner_plane(ver[faces[i][1]], midpoint(ver[faces[i][0]], ver[faces[i][2]]) , normal,
tolerance, use_accurate_cross);
halfspace[i].emplace_back(plane);// number 3;
}
edgedire = normalize(BC);
// if (use_accurate_cross)edgenormaldist = accurate_cross_product_direction(ORIGIN, edgedire, ORIGIN, normal)*tolerance;
// else
@ -1762,12 +1755,6 @@ private:
ver[faces[i][1]] + edgenormaldist + normal);
halfspace[i].emplace_back(plane);// number 4
if (obtuse != 2) {
plane = get_corner_plane(ver[faces[i][2]], midpoint(ver[faces[i][0]], ver[faces[i][1]]), normal,
tolerance,use_accurate_cross);
halfspace[i].emplace_back(plane);// number 5;
}
edgedire = -normalize(AC);
// if (use_accurate_cross)edgenormaldist = accurate_cross_product_direction(ORIGIN, edgedire, ORIGIN , normal)*tolerance;
@ -1779,11 +1766,21 @@ private:
ver[faces[i][0]] + edgenormaldist + normal);
halfspace[i].emplace_back(plane);// number 6
if (obtuse != 1) {
plane = get_corner_plane(ver[faces[i][1]], midpoint(ver[faces[i][0]], ver[faces[i][2]]) , normal,
tolerance, use_accurate_cross);
halfspace[i].emplace_back(plane);// number 3;
}
if (obtuse != 0) {
plane = get_corner_plane(ver[faces[i][0]], midpoint(ver[faces[i][1]], ver[faces[i][2]]) , normal,
tolerance,use_accurate_cross);
tolerance,use_accurate_cross);
halfspace[i].emplace_back(plane);// number 7;
}
if (obtuse != 2) {
plane = get_corner_plane(ver[faces[i][2]], midpoint(ver[faces[i][0]], ver[faces[i][1]]), normal,
tolerance,use_accurate_cross);
halfspace[i].emplace_back(plane);// number 5;
}
#ifdef CGAL_ENVELOPE_DEBUG