mirror of https://github.com/CGAL/cgal
tests nary union and nary intersection
This commit is contained in:
parent
1e6b97be68
commit
94f7ca5fdf
|
|
@ -2959,6 +2959,7 @@ Nef_3/test/Nef_3/data/octa.off -text svneol=unset#application/octet-stream
|
|||
Nef_3/test/Nef_3/data/star.off -text svneol=unset#application/octet-stream
|
||||
Nef_3/test/Nef_3/data/wrongly_oriented_cube.off -text
|
||||
Nef_3/test/Nef_3/makefile -text
|
||||
Nef_3/test/Nef_3/nary.cpp -text
|
||||
Nef_S2/demo/Nef_S2/visualization.vcproj eol=crlf
|
||||
Nef_S2/doc_tex/Nef_S2/fig/complex.gif -text svneol=unset#image/gif
|
||||
Nef_S2/doc_tex/Nef_S2/fig/complex.pdf -text svneol=unset#application/pdf
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Nef_polyhedron_3.h>
|
||||
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
|
||||
#include <CGAL/Nef_3/SNC_indexed_items.h>
|
||||
#include <CGAL/Nary_union.h>
|
||||
#include <CGAL/Nary_intersection.h>
|
||||
#include <fstream>
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
typedef CGAL::Nef_polyhedron_3<Kernel, CGAL::SNC_indexed_items> Nef_polyhedron;
|
||||
typedef CGAL::Nary_union<Nef_polyhedron> Union;
|
||||
typedef CGAL::Nary_intersection<Nef_polyhedron> Intersection;
|
||||
typedef Kernel::Vector_3 Vector_3;
|
||||
typedef Kernel::Aff_transformation_3 Aff_transformation_3;
|
||||
|
||||
int main()
|
||||
{
|
||||
Nef_polyhedron N;
|
||||
std::ifstream in("data/cube.nef3.SH");
|
||||
in >> N;
|
||||
|
||||
Nef_polyhedron C0, C1, C2;
|
||||
C0.transform(Aff_transformation_3(CGAL::TRANSLATION, Vector_3(1, 0, 0, 100)));
|
||||
C1.transform(Aff_transformation_3(CGAL::TRANSLATION, Vector_3(0, 1, 0, 100)));
|
||||
C2.transform(Aff_transformation_3(CGAL::TRANSLATION, Vector_3(0, 0, 1, 100)));
|
||||
|
||||
Union u;
|
||||
u.add_polyhedron(C0);
|
||||
u.add_polyhedron(C1);
|
||||
u.add_polyhedron(C2);
|
||||
u.get_union();
|
||||
u.add_polyhedron(N);
|
||||
|
||||
Intersection i;
|
||||
i.add_polyhedron(C0);
|
||||
i.add_polyhedron(C1);
|
||||
i.add_polyhedron(C2);
|
||||
i.get_intersection();
|
||||
i.add_polyhedron(N);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue