Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ create_single_source_cgal_program("test_isolevel_refinement.cpp")
create_single_source_cgal_program("test_pmp_clip.cpp")
create_single_source_cgal_program("test_snap_rounding.cpp")
create_single_source_cgal_program("test_mesh_kernel.cpp")
create_single_source_cgal_program("test_boolean_on_triangle_soup.cpp")

find_package(TBB QUIET)
include(CGAL_TBB_support)
if(TARGET CGAL::TBB_support)
target_link_libraries(test_autorefinement PRIVATE CGAL::TBB_support)
target_link_libraries(test_snap_rounding PRIVATE CGAL::TBB_support)
target_link_libraries(test_boolean_on_triangle_soup PRIVATE CGAL::TBB_support)
else()
message(STATUS "NOTICE: Intel TBB was not found. Tests will use sequential code.")
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
OFF
16 28 0

-1 0 -1
1 0 -1
0 2 -1
1 0 1
0 2 1
-1 0 1
-2 2 -1
2 2 -1
-2 -2 -1
-2 -2 1
-2 2 1
2 -2 1
2 -2 -1
2 2 1
0 2 -1
0 2 1
3 9 3 5
3 8 6 0
3 8 9 10
3 12 7 13
3 8 12 11
3 0 6 14
3 2 15 13
3 4 14 6
3 11 3 9
3 4 5 0
3 2 1 3
3 3 1 0
3 12 0 1
3 8 0 12
3 12 1 7
3 1 2 7
3 0 5 3
3 10 6 8
3 5 4 10
3 3 15 2
3 13 11 12
3 0 14 4
3 11 9 8
3 3 13 15
3 11 13 3
3 13 7 2
3 6 10 4
3 9 5 10

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
OFF
8 12 0
0 1 -1
0 2 -1
1 2 -1
1 1 -1
0 1 1
0 2 1
1 2 1
1 1 1
3 0 1 3
3 3 1 2
3 0 4 1
3 1 4 5
3 3 2 7
3 7 2 6
3 4 0 3
3 7 4 3
3 6 4 7
3 6 5 4
3 1 5 6
3 2 1 6
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
OFF
8 12 0

-0.5 -0.5 0.5
0.5 -0.5 0.5
0.5 -0.5 -0.5
-0.5 -0.5 -0.5
-0.5 0.5 -0.5
-0.5 0.5 0.5
0.5 0.5 0.5
0.5 0.5 -0.5
3 4 5 6
3 1 0 3
3 6 1 2
3 0 1 6
3 3 0 5
3 7 2 3
3 6 7 4
3 3 2 1
3 2 7 6
3 6 5 0
3 5 4 3
3 3 4 7

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
OFF
8 12 0

0.054291486740112305 0.26874995231628418 -0.34933948516845703
1.0542914867401123 0.26874995231628418 -0.34933948516845703
1.0542914867401123 0.26874995231628418 -1.349339485168457
0.054291486740112305 0.26874995231628418 -1.349339485168457
0.054291486740112305 1.2687499523162842 -1.349339485168457
0.054291486740112305 1.2687499523162842 -0.34933948516845703
1.0542914867401123 1.2687499523162842 -0.34933948516845703
1.0542914867401123 1.2687499523162842 -1.349339485168457
3 4 5 6
3 1 0 3
3 6 1 2
3 0 1 6
3 3 0 5
3 7 2 3
3 6 7 4
3 3 2 1
3 2 7 6
3 6 5 0
3 5 4 3
3 3 4 7

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
OFF
8 12 0

-0.109773188829422 -0.065066307783126831 1.1743011474609375
0.89022684097290039 -0.065066307783126831 1.1743011474609375
0.89022684097290039 -0.065066307783126831 0.1743011474609375
-0.109773188829422 -0.065066307783126831 0.1743011474609375
-0.109773188829422 0.93493366241455078 0.1743011474609375
-0.109773188829422 0.93493366241455078 1.1743011474609375
0.89022684097290039 0.93493366241455078 1.1743011474609375
0.89022684097290039 0.93493366241455078 0.1743011474609375
3 4 5 6
3 1 0 3
3 6 1 2
3 0 1 6
3 3 0 5
3 7 2 3
3 6 7 4
3 3 2 1
3 2 7 6
3 6 5 0
3 5 4 3
3 3 4 7

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
OFF
8 12 0

-2 -2 2
2 -2 2
2 -2 -2
-2 -2 -2
-2 2 -2
-2 2 2
2 2 2
2 2 -2
3 4 5 6
3 1 0 3
3 6 1 2
3 0 1 6
3 3 0 5
3 7 2 3
3 6 7 4
3 3 2 1
3 2 7 6
3 6 5 0
3 5 4 3
3 3 4 7

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
OFF
8 12 0

-1 -1 1
1 -1 1
1 -1 -1
-1 -1 -1
-1 1 -1
-1 1 1
1 1 1
1 1 -1
3 4 5 6
3 1 0 3
3 6 1 2
3 0 1 6
3 3 0 5
3 7 2 3
3 6 7 4
3 3 2 1
3 2 7 6
3 6 5 0
3 5 4 3
3 3 4 7

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
OFF
14 24 0

-0.5 -0.5 0.5
0.5 -0.5 0.5
0.5 -0.5 -0.5
-0.5 -0.5 -0.5
-0.5 0.5 -0.5
-0.5 0.5 0.5
0.5 0.5 0.5
0.5 0.5 -0.5
0.5 1.5 0.5
1.5 1.5 0.5
1.5 1.5 -0.5
0.5 1.5 -0.5
1.5 0.5 -0.5
1.5 0.5 0.5
3 4 5 6
3 1 0 3
3 6 1 2
3 0 1 6
3 3 0 5
3 7 2 3
3 9 10 11
3 13 6 7
3 9 13 12
3 9 8 6
3 8 11 7
3 10 12 7
3 6 7 4
3 3 2 1
3 2 7 6
3 6 5 0
3 5 4 3
3 3 4 7
3 11 8 9
3 7 12 13
3 12 10 9
3 6 13 9
3 7 6 8
3 7 11 10

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
OFF
8 12 0

-0.5 -0.5 0.5
0.5 -0.5 0.5
0.5 -0.5 -0.5
-0.5 -0.5 -0.5
-0.5 0.5 -0.5
-0.5 0.5 0.5
0.5 0.5 0.5
0.5 0.5 -0.5
3 4 5 6
3 1 0 3
3 6 1 2
3 0 1 6
3 3 0 5
3 7 2 3
3 6 7 4
3 3 2 1
3 2 7 6
3 6 5 0
3 5 4 3
3 3 4 7

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
OFF
8 12 0

-0.25 -0.25 1.5
0.25 -0.25 1.5
0.25 -0.25 0.5
-0.25 -0.25 0.5
-0.25 0.25 0.5
-0.25 0.25 1.5
0.25 0.25 1.5
0.25 0.25 0.5
3 4 5 6
3 1 0 3
3 6 1 2
3 0 1 6
3 3 0 5
3 7 2 3
3 6 7 4
3 3 2 1
3 2 7 6
3 6 5 0
3 5 4 3
3 3 4 7

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
data-nm_boolop/cube_0.off data-nm_boolop/cube_1.off
data-nm_boolop/cube3_minus_prism.off data-nm_boolop/cube4.off
data-nm_boolop/pair_of_nm_cubes.off data-nm_boolop/cube_2.off
data-nm_boolop/nested_cube1.off data-nm_boolop/nested_cube2.off
data-nm_boolop/nested_cube2.off data-nm_boolop/nested_cube1.off
data-nm_boolop/tangent_cube1.off data-nm_boolop/tangent_cube2.off
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polygon_mesh_processing/triangle_soup_boolean_operations_3.h>
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>

#include <boost/container/small_vector.hpp>

#include <fstream>

#include <CGAL/Real_timer.h>

#ifdef CGAL_LINKED_WITH_TBB
using Concurrency_tag = CGAL::Parallel_tag;
#else
using Concurrency_tag = CGAL::Sequential_tag;
#endif

typedef CGAL::Exact_predicates_exact_constructions_kernel EPECK;
typedef EPECK::Point_3 Exact_point;
typedef CGAL::Surface_mesh<Exact_point> Exact_mesh;
namespace PMP = CGAL::Polygon_mesh_processing;
namespace params = CGAL::parameters;


void run(std::string f1, std::string f2)
{
std::cout << "Running with " << f1 << " and " << f2 << "\n";
using Triangle = boost::container::small_vector<std::size_t, 3>;

std::vector<Exact_point> points_1, points_2;
std::vector<Triangle> triangles_1, triangles_2;

CGAL::IO::read_polygon_soup(f1, points_1, triangles_1);
CGAL::IO::read_polygon_soup(f2, points_2, triangles_2);

{
std::vector<Exact_point> points_res;
std::vector<Triangle> triangles_res;
CGAL::Real_timer timer;
timer.start();
PMP::compute_union<Concurrency_tag>(points_1, triangles_1, points_2, triangles_2, points_res, triangles_res);
timer.stop();
std::cout << "Done in " << timer.time() << "\n";

CGAL::IO::write_OFF("union.off", points_res, triangles_res, params::stream_precision(17));
}
{
std::vector<Exact_point> points_res;
std::vector<Triangle> triangles_res;
CGAL::Real_timer timer;
timer.start();
PMP::compute_intersection<Concurrency_tag>(points_1, triangles_1, points_2, triangles_2, points_res, triangles_res);
timer.stop();
std::cout << "Done in " << timer.time() << "\n";

CGAL::IO::write_OFF("intersection.off", points_res, triangles_res, params::stream_precision(17));
}
{
std::vector<Exact_point> points_res;
std::vector<Triangle> triangles_res;
CGAL::Real_timer timer;
timer.start();
PMP::compute_difference<Concurrency_tag>(points_1, triangles_1, points_2, triangles_2, points_res, triangles_res);
timer.stop();
std::cout << "Done in " << timer.time() << "\n";

CGAL::IO::write_OFF("difference.off", points_res, triangles_res, params::stream_precision(17));
}
}

int main(int argc, char** argv)
{
for (int i=0; i< (argc-1)/2; ++i)
run(argv[2*i+1], argv[2*i+2]);
}
Loading