mirror of https://github.com/CGAL/cgal
cleanup and reduce model sizes
This commit is contained in:
parent
39a19c21cf
commit
3b5ec29388
|
|
@ -3117,11 +3117,10 @@ Polyhedron/demo/Polyhedron/MainWindow.ui -text
|
|||
Polyhedron/demo/Polyhedron/Polyhedron_3.qrc -text
|
||||
Polyhedron/demo/Polyhedron/data/anchor.off -text svneol=unset#application/octet-stream
|
||||
Polyhedron/demo/Polyhedron/data/cow.off -text svneol=unset#application/octet-stream
|
||||
Polyhedron/demo/Polyhedron/data/dilo.off -text svneol=unset#application/octet-stream
|
||||
Polyhedron/demo/Polyhedron/data/ellipsoid.off -text svneol=unset#application/octet-stream
|
||||
Polyhedron/demo/Polyhedron/data/knot.off -text svneol=unset#application/octet-stream
|
||||
Polyhedron/demo/Polyhedron/data/knot_2_3.off -text svneol=unset#application/octet-stream
|
||||
Polyhedron/demo/Polyhedron/data/lucy-100kt.off -text svneol=unset#application/octet-stream
|
||||
Polyhedron/demo/Polyhedron/data/lucy-25kf.off -text svneol=unset#application/octet-stream
|
||||
Polyhedron/demo/Polyhedron/data/part5.off -text svneol=unset#application/octet-stream
|
||||
Polyhedron/demo/Polyhedron/data/pinion.off -text svneol=unset#application/octet-stream
|
||||
Polyhedron/demo/Polyhedron/resources/about.html svneol=native#text/html
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@
|
|||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Nef_polyhedron_3.h>
|
||||
|
||||
// PA: dirty hacks to convert polyhedra from exact to inexact and vice-versa
|
||||
// Laurent, if you have a better idea
|
||||
|
||||
// quick hacks to convert polyhedra from exact to inexact and vice-versa
|
||||
|
||||
void from_exact(Exact_polyhedron& in,
|
||||
Polyhedron& out)
|
||||
|
|
@ -45,12 +43,14 @@ void MainWindow::boolean_operation(const int operation)
|
|||
{
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
|
||||
// PA: to be done by LR
|
||||
// PA: to be done by LR?
|
||||
//int indexA = scene->getPolygonAIndex();
|
||||
//int indexB = scene->getPolygonBIndex();
|
||||
|
||||
// to remove
|
||||
int indexA = 0;
|
||||
int indexB = 1;
|
||||
|
||||
Polyhedron* polyA = scene->polyhedron(indexA);
|
||||
Polyhedron* polyB = scene->polyhedron(indexB);
|
||||
if(!polyA) return;
|
||||
|
|
@ -92,22 +92,22 @@ void MainWindow::boolean_operation(const int operation)
|
|||
case BOOLEAN_UNION:
|
||||
scene->addPolyhedron(pResult,
|
||||
tr("%1 union %2").arg(scene->polyhedronName(indexA),scene->polyhedronName(indexB)),
|
||||
scene->polyhedronColor(indexA), // PA: to be changed to red
|
||||
scene->isPolyhedronActivated(indexA),
|
||||
Qt::yellow,
|
||||
true,
|
||||
scene->polyhedronRenderingMode(indexA));
|
||||
break;
|
||||
case BOOLEAN_INTERSECTION:
|
||||
scene->addPolyhedron(pResult,
|
||||
tr("%1 intersection %2").arg(scene->polyhedronName(indexA),scene->polyhedronName(indexB)),
|
||||
scene->polyhedronColor(indexA), // PA: to be changed to red
|
||||
scene->isPolyhedronActivated(indexA),
|
||||
Qt::yellow,
|
||||
true,
|
||||
scene->polyhedronRenderingMode(indexA));
|
||||
break;
|
||||
case BOOLEAN_DIFFERENCE:
|
||||
scene->addPolyhedron(pResult,
|
||||
tr("%1 minus %2").arg(scene->polyhedronName(indexA),scene->polyhedronName(indexB)),
|
||||
scene->polyhedronColor(indexA), // PA: to be changed to red
|
||||
scene->isPolyhedronActivated(indexA),
|
||||
Qt::yellow,
|
||||
true,
|
||||
scene->polyhedronRenderingMode(indexA));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
#include "MainWindow.h"
|
||||
#include "Scene.h"
|
||||
#include <CGAL/Make_triangle_soup.h>
|
||||
|
||||
#include <CGAL/intersections.h>
|
||||
#include <CGAL/Bbox_3.h>
|
||||
#include <CGAL/box_intersection_d.h>
|
||||
|
||||
#include <CGAL/self_intersect.h>
|
||||
|
||||
|
||||
#include <CGAL/Make_triangle_soup.h>
|
||||
|
||||
void MainWindow::on_actionSelf_intersection_triggered()
|
||||
{
|
||||
|
|
@ -19,25 +18,27 @@ void MainWindow::on_actionSelf_intersection_triggered()
|
|||
int index = getSelectedPolygonIndex();
|
||||
Polyhedron* pMesh = scene->polyhedron(index);
|
||||
|
||||
// types
|
||||
// compute self-intersections
|
||||
typedef std::list<Triangle>::iterator Iterator;
|
||||
typedef CGAL::Box_intersection_d::Box_with_handle_d<double,3,Iterator> Box;
|
||||
|
||||
// compute self-intersections
|
||||
std::list<Triangle> intersecting_triangles;
|
||||
typedef std::back_insert_iterator<std::list<Triangle> > OutputIterator;
|
||||
std::cout << "self-intersect...";
|
||||
self_intersect<Polyhedron,Kernel,OutputIterator>(*pMesh,std::back_inserter(intersecting_triangles));
|
||||
std::cout << "ok (" << intersecting_triangles.size() << " triangle(s))" << std::endl;
|
||||
|
||||
// add intersecting triangles as a new polyhedron (a triangle soup)
|
||||
Polyhedron *pSoup = new Polyhedron;
|
||||
Make_triangle_soup<Polyhedron,Kernel,Iterator> soup;
|
||||
soup.run(intersecting_triangles.begin(),intersecting_triangles.end(),*pSoup);
|
||||
|
||||
scene->addPolyhedron(pSoup,
|
||||
tr("%1 (intersecting triangles)").arg(scene->polyhedronName(index)),
|
||||
Qt::red,
|
||||
scene->isPolyhedronActivated(index),
|
||||
scene->polyhedronRenderingMode(index));
|
||||
if(intersecting_triangles.size() != 0)
|
||||
{
|
||||
Polyhedron *pSoup = new Polyhedron;
|
||||
Make_triangle_soup<Polyhedron,Kernel,Iterator> soup_builder;
|
||||
soup_builder.run(intersecting_triangles.begin(),intersecting_triangles.end(),*pSoup);
|
||||
scene->addPolyhedron(pSoup,
|
||||
tr("%1 (intersecting triangles)").arg(scene->polyhedronName(index)),
|
||||
Qt::red,
|
||||
scene->isPolyhedronActivated(index),
|
||||
scene->polyhedronRenderingMode(index));
|
||||
}
|
||||
|
||||
QApplication::setOverrideCursor(Qt::ArrowCursor);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue