Skip to content

Commit

Permalink
Merge remote-tracking branch 'cgal/master' into Mesh_3-update_benchma…
Browse files Browse the repository at this point in the history
…rk-jtournois
  • Loading branch information
MaelRL committed May 29, 2024
2 parents ef2a7b3 + e90842f commit 4ba0ec0
Show file tree
Hide file tree
Showing 2,434 changed files with 477,082 additions and 34,877 deletions.
7 changes: 4 additions & 3 deletions .github/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
/usr/local/bin/cmake --version
FACTOR=$1
set -ex
cd Polyhedron/demo
/usr/local/bin/cmake -S Polyhedron -B build -DCGAL_DIR=$2
cd Lab/demo
/usr/local/bin/cmake -S Lab -B build -DCGAL_DIR=$2
LIST_OF_PLUGINS=$(/usr/local/bin/cmake --build build -t help | egrep 'plugin$' |& cut -d\ -f2)
PLUGINS_ARRAY=(${LIST_OF_PLUGINS});
NB_OF_PLUGINS=${#PLUGINS_ARRAY[@]}
DEL=$(($NB_OF_PLUGINS / 4))
cd build
make -j2 ${PLUGINS_ARRAY[@]:$(($FACTOR * $DEL)):$((($FACTOR + 1) * $DEL))}
NUM_PROCS=$(nproc)
make -j${NUM_PROCS} ${PLUGINS_ARRAY[@]:$(($FACTOR * $DEL)):$((($FACTOR + 1) * $DEL))}
4 changes: 2 additions & 2 deletions .github/workflows/build_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ jobs:
echo "DoxygenError=No package affected." >> $GITHUB_OUTPUT
exit 1
fi
cd build_doc && make -j2 doc
make -j2 doc_with_postprocessing 2>tmp.log
cd build_doc && make -j$(nproc) doc
make -j$(nproc) doc_with_postprocessing 2>tmp.log
if [ -s tmp.log ]; then
content=`cat ./tmp.log`
delimiter="$(openssl rand -hex 8)"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/demo.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test Polyhedron Demo
name: Compile CGAL Lab

on: [push, pull_request,workflow_dispatch]

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: REUSE version
uses: fsfe/reuse-action@v2
uses: fsfe/reuse-action@v3
with:
args: --version
- name: REUSE lint
uses: fsfe/reuse-action@v2
uses: fsfe/reuse-action@v3
with:
args: --include-submodules lint
- name: REUSE SPDX SBOM
uses: fsfe/reuse-action@v2
uses: fsfe/reuse-action@v3
with:
args: spdx
- name: install dependencies
run: sudo apt-get install -y cmake
run: sudo apt-get update && sudo apt-get install -y cmake
- name: Create CGAL internal release
run: |
mkdir -p ./release
cmake -DDESTINATION=./release -DCGAL_VERSION=9.9 -P ./Scripts/developer_scripts/cgal_create_release_with_cmake.cmake
- name: REUSE lint release tarball
uses: fsfe/reuse-action@v2
uses: fsfe/reuse-action@v3
with:
args: --root ./release/CGAL-9.9 --include-submodules lint
61 changes: 30 additions & 31 deletions AABB_tree/benchmark/AABB_tree/test.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>

#include <CGAL/Polygon_mesh_processing/intersection.h>
#include <CGAL/Polygon_mesh_processing/transform.h>

#include <CGAL/boost/graph/copy_face_graph.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/Polygon_mesh_processing/internal/AABB_do_intersect_transform_traits.h>
#include <CGAL/AABB_traits_3.h>
#include <CGAL/Rigid_triangle_mesh_collision_detection.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>
#include <CGAL/Side_of_triangle_mesh.h>

Expand All @@ -18,12 +18,12 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Surface_mesh<K::Point_3> Surface_mesh;

typedef CGAL::AABB_face_graph_triangle_primitive<Surface_mesh> Primitive;
typedef CGAL::AABB_do_intersect_transform_traits<K, Primitive> Traits;
typedef CGAL::AABB_traits_3<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;

namespace PMP = CGAL::Polygon_mesh_processing;

void naive_test(int k, const char* fname,
void naive_test(int k, const std::string& fname,
int& nb_inter, int& nb_no_inter, int& nb_include)
{
std::ifstream input(fname);
Expand All @@ -33,7 +33,7 @@ void naive_test(int k, const char* fname,
CGAL::Aff_transformation_3<K> init1(CGAL::SCALING, 6.0);
PMP::transform(init1, tm);
CGAL::Bbox_3 box = PMP::bbox(tm);
typedef CGAL::AABB_tree<CGAL::AABB_traits<K, Primitive> > Tree;

Tree tmTree(tm.faces_begin(), tm.faces_end(), tm);
Tree tmTree2(tm2.faces_begin(), tm2.faces_end(), tm2);
CGAL::Aff_transformation_3<K> init2(CGAL::TRANSLATION, - K::Vector_3(
Expand Down Expand Up @@ -86,7 +86,8 @@ void naive_test(int k, const char* fname,
T0 = CGAL::Aff_transformation_3<K>(CGAL::TRANSLATION, -i*unit_vec);
}
}
void test_no_collision(int k, const char* fname,

void test_no_collision(int k, const std::string &fname,
int& nb_inter, int& nb_no_inter, int& nb_include)
{
std::ifstream input(fname);
Expand All @@ -97,9 +98,11 @@ void test_no_collision(int k, const char* fname,
PMP::transform(init1, tm);
CGAL::Bbox_3 box = PMP::bbox(tm);
Tree tmTree(tm.faces_begin(), tm.faces_end(), tm);

Tree tmTree2(tm2.faces_begin(), tm2.faces_end(), tm2);
CGAL::Aff_transformation_3<K> init2(CGAL::TRANSLATION, - K::Vector_3(
(box.xmax()-box.xmin()),0,0));

PMP::transform(init2, tm2);

tmTree.build();
Expand All @@ -113,6 +116,12 @@ void test_no_collision(int k, const char* fname,

CGAL::Side_of_triangle_mesh<Surface_mesh, K,
VPM, Tree> sotm1(tmTree);

CGAL::Rigid_triangle_mesh_collision_detection<Surface_mesh> collision_detection;

collision_detection.add_mesh(tm);
collision_detection.add_mesh(tm2);

for(int i=1; i<k+1; ++i)
{
K::FT rot[9];
Expand All @@ -130,47 +139,37 @@ void test_no_collision(int k, const char* fname,
rot[6], rot[7], rot[8]);
CGAL::Aff_transformation_3<K> T1 = CGAL::Aff_transformation_3<K>(CGAL::TRANSLATION, i*unit_vec);
CGAL::Aff_transformation_3<K> transfo = R*T1;
tmTree2.traits().set_transformation(transfo);
CGAL::Interval_nt_advanced::Protector protector;
if(tmTree2.do_intersect(tmTree))

collision_detection.set_transformation(1, transfo);

std::vector< std::pair<std::size_t, bool> > res = collision_detection.get_all_intersections_and_inclusions(0);

if (res.empty())
nb_no_inter++;
else if(!res[0].second)
++nb_inter;
else
{
if(sotm1(transfo.transform(vpm2[*tm2.vertices().begin()])) != CGAL::ON_UNBOUNDED_SIDE)
{
++nb_include;
}
else
{
CGAL::Side_of_triangle_mesh<Surface_mesh, K,
VPM, Tree> sotm2(tmTree2);
if(sotm2(tm.point(*tm.vertices().begin())) != CGAL::ON_UNBOUNDED_SIDE)
++nb_include;
else
++nb_no_inter;
}
}
++nb_include;
}
}

int main(int argc, const char** argv)
{
int k = (argc>1) ? atoi(argv[1]) : 10;
const char* path = (argc>2)?argv[2]:"data/handle"
".off";
int k = (argc>1) ? atoi(argv[1]) : 20;
std::string path = (argc>2)?argv[2]: CGAL::data_file_path("meshes/handle.off");

std::cout<< k<<" steps in "<<path<<std::endl;
int nb_inter(0), nb_no_inter(0), nb_include(0),
naive_inter(0), naive_no_inter(0), naive_include(0);
auto start = std::chrono::steady_clock::now();
naive_test(k, path, naive_inter, naive_no_inter, naive_include);
auto end = std::chrono::steady_clock::now();
std::cout<<"Naive test :"<<naive_inter<<" collisions, "<<naive_include<<" inclusions, "<<naive_no_inter<<" no collision, calculated in "
<<std::chrono::duration_cast<std::chrono::microseconds>(end - start).count() << "μs." << std::endl;
std::cout<<"Naive test : "<<naive_inter<<" collisions, "<<naive_include<<" inclusions, "<<naive_no_inter<<" no collision, calculated in "
<<std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << " ms." << std::endl;
start = std::chrono::steady_clock::now();
test_no_collision(k, path,nb_inter, nb_no_inter, nb_include);
end = std::chrono::steady_clock::now();
std::cout<<"With transform_traits: "<<nb_inter<<" collisions, "<<nb_include<<" inclusions, "<<nb_no_inter<<" no collision, calculated in "
<<std::chrono::duration_cast<std::chrono::microseconds>(end - start).count() << "μs." << std::endl;
<<std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << " ms." << std::endl;
return 0;
}
10 changes: 5 additions & 5 deletions AABB_tree/demo/AABB_tree/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ void Scene::generate_points_in(const unsigned int nb_points,
}

typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
typedef CGAL::AABB_traits_3<Kernel, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;

std::cout << "Construct AABB tree...";
Expand Down Expand Up @@ -920,7 +920,7 @@ void Scene::generate_inside_points(const unsigned int nb_points)
}

typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
typedef CGAL::AABB_traits_3<Kernel, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;

std::cout << "Construct AABB tree...";
Expand Down Expand Up @@ -962,7 +962,7 @@ void Scene::generate_boundary_segments(const unsigned int nb_slices)
}

typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
typedef CGAL::AABB_traits_3<Kernel, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef Tree::Object_and_primitive_id Object_and_primitive_id;

Expand Down Expand Up @@ -1012,7 +1012,7 @@ void Scene::generate_boundary_points(const unsigned int nb_points)
}

typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
typedef CGAL::AABB_traits_3<Kernel, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef Tree::Object_and_primitive_id Object_and_primitive_id;

Expand Down Expand Up @@ -1062,7 +1062,7 @@ void Scene::generate_edge_points(const unsigned int nb_points)
}

typedef CGAL::AABB_halfedge_graph_segment_primitive<Polyhedron> Primitive;
typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
typedef CGAL::AABB_traits_3<Kernel, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef Tree::Object_and_primitive_id Object_and_primitive_id;

Expand Down
6 changes: 3 additions & 3 deletions AABB_tree/demo/AABB_tree/Scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "Color_ramp.h"

#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_traits_3.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/AABB_halfedge_graph_segment_primitive.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>
Expand Down Expand Up @@ -62,11 +62,11 @@ class Scene : public QObject

private:
typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Facet_Primitive;
typedef CGAL::AABB_traits<Kernel, Facet_Primitive> Facet_Traits;
typedef CGAL::AABB_traits_3<Kernel, Facet_Primitive> Facet_Traits;
typedef CGAL::AABB_tree<Facet_Traits> Facet_tree;

typedef CGAL::AABB_halfedge_graph_segment_primitive<Polyhedron> Edge_Primitive;
typedef CGAL::AABB_traits<Kernel, Edge_Primitive> Edge_Traits;
typedef CGAL::AABB_traits_3<Kernel, Edge_Primitive> Edge_Traits;
typedef CGAL::AABB_tree<Edge_Traits> Edge_tree;

typedef CGAL::qglviewer::ManipulatedFrame ManipulatedFrame;
Expand Down
Loading

0 comments on commit 4ba0ec0

Please sign in to comment.