Skip to content

Commit f923aa5

Browse files
authored
Merge pull request #33 from olivier-roussel/fix_image_tests_compat
Fix CGAL >=4.13 compat for tests with image plugin
2 parents bb8ceea + ee28356 commit f923aa5

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/CGALPlugin/MeshGenerationFromImage.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@
3333
#include <CGAL/Mesh_triangulation_3.h>
3434
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
3535
#include <CGAL/Mesh_criteria_3.h>
36+
37+
#if CGAL_VERSION_NR >= CGAL_VERSION_NUMBER(4,13,0)
38+
#include <CGAL/Labeled_mesh_domain_3.h>
39+
#else
3640
#include <CGAL/Labeled_image_mesh_domain_3.h>
41+
#endif
42+
3743
#include <CGAL/Mesh_domain_with_polyline_features_3.h>
3844
#include <CGAL/make_mesh_3.h>
3945
#include <CGAL/refine_mesh_3.h>
@@ -68,7 +74,11 @@ class MeshGenerationFromImage : public sofa::core::DataEngine
6874

6975
// Domain
7076
// (we use exact intersection computation with Robust_intersection_traits_3)
77+
#if CGAL_VERSION_NR >= CGAL_VERSION_NUMBER(4,13,0)
78+
typedef CGAL::Mesh_domain_with_polyline_features_3<CGAL::Labeled_mesh_domain_3<K> > Mesh_domain;
79+
#else
7180
typedef CGAL::Mesh_domain_with_polyline_features_3<CGAL::Labeled_image_mesh_domain_3<CGAL::Image_3,K> > Mesh_domain;
81+
#endif
7282
typedef K::Point_3 Point3;
7383

7484
typedef std::vector<Point3> Polyline;

src/CGALPlugin/MeshGenerationFromImage.inl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,11 @@ void MeshGenerationFromImage<DataTypes, _ImageTypes>::doUpdate()
206206
image3.read(this->d_filename.getFullPath().c_str());
207207
}
208208

209+
#if CGAL_VERSION_NR >= CGAL_VERSION_NUMBER(4,13,0)
210+
Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image3);
211+
#else
209212
Mesh_domain domain(image3);
210-
213+
#endif
211214
int volume_dimension = 3;
212215
Sizing_field size(d_cellSize.getValue());
213216

@@ -228,9 +231,16 @@ void MeshGenerationFromImage<DataTypes, _ImageTypes>::doUpdate()
228231

229232
#if CGAL_VERSION_NR >= CGAL_VERSION_NUMBER(3,6,0)
230233
msg_info(this) << "Create Mesh";
231-
Mesh_criteria criteria(edge_size=d_edgeSize.getValue(),
234+
Mesh_criteria criteria(
235+
#if CGAL_VERSION_NR >= CGAL_VERSION_NUMBER(3,8,0)
236+
edge_size=d_edgeSize.getValue(),
237+
cell_radius_edge_ratio=d_cellRatio.getValue(),
238+
#else
239+
cell_radius_edge=d_cellRatio.getValue(),
240+
#endif
241+
232242
facet_angle=d_facetAngle.getValue(), facet_size=d_facetSize.getValue(), facet_distance=d_facetApproximation.getValue(),
233-
cell_radius_edge=d_cellRatio.getValue(), cell_size=size);
243+
cell_size=size);
234244

235245
size_t nfts = fts.size();
236246
Polylines polylines (nfts);

0 commit comments

Comments
 (0)