diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/DialogOptions.cpp b/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/DialogOptions.cpp index 0e450ae5283..c2e7c57da1d 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/DialogOptions.cpp +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/DialogOptions.cpp @@ -12,14 +12,16 @@ IMPLEMENT_DYNAMIC(CDialogOptions, CDialog) CDialogOptions::CDialogOptions(CWnd* pParent /*=NULL*/) : CDialog(CDialogOptions::IDD, pParent) , m_sm_distance(0) + , m_sm_error_bound(0) , m_sm_radius(0) , m_sm_angle(0) , m_dr_max_vertices(0) , m_dr_shell_size(0) , m_dr_sizing(0) , m_contouring_value(0) - , m_number_of_neighbours(0) - , m_threshold_percent_avg_knn_sq_dst(0) + , m_projection_error(0) + , m_number_of_neighbours(0) + , m_threshold_percent_avg_knn_sq_dst(0) { } @@ -31,20 +33,22 @@ void CDialogOptions::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); - // processing - DDX_Text(pDX,IDC_EDIT_MIN_CAMERAS_CONE_ANGLE, m_min_cameras_cone_angle); + // processing + DDX_Text(pDX,IDC_EDIT_MIN_CAMERAS_CONE_ANGLE, m_min_cameras_cone_angle); DDX_Text(pDX,IDC_EDIT_AVG_KNN_SQ_DST_PERCENTAGE,m_threshold_percent_avg_knn_sq_dst); DDX_Text(pDX,IDC_EDIT_SM_ANGLE,m_sm_angle); DDX_Text(pDX,IDC_EDIT_SM_RADIUS,m_sm_radius); DDX_Text(pDX,IDC_EDIT_SM_DISTANCE,m_sm_distance); + DDX_Text(pDX,IDC_EDIT_SM_ERROR_BOUND,m_sm_error_bound); DDX_Text(pDX,IDC_EDIT_DR_SHELL_SIZE,m_dr_shell_size); DDX_Text(pDX,IDC_EDIT_DR_SIZING,m_dr_sizing); DDX_Text(pDX,IDC_EDIT_DR_MAXV,m_dr_max_vertices); - DDX_Text(pDX,IDC_EDIT_CONTOURING_VALUE,m_contouring_value); + DDX_Text(pDX,IDC_EDIT_APSS_ERROR,m_projection_error); + DDX_Text(pDX,IDC_EDIT_NB_OF_NEIGHBOURS,m_number_of_neighbours); } diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/DialogOptions.h b/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/DialogOptions.h index fe34c4cc9eb..110c106e970 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/DialogOptions.h +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/DialogOptions.h @@ -1,33 +1,36 @@ #pragma once +#include "resource.h" -// Boîte de dialogue CDialogOptions +// Class CDialogOptions = Options dialog box class CDialogOptions : public CDialog { DECLARE_DYNAMIC(CDialogOptions) public: - CDialogOptions(CWnd* pParent = NULL); // constructeur standard + CDialogOptions(CWnd* pParent = NULL); virtual ~CDialogOptions(); // Données de boîte de dialogue enum { IDD = IDD_DIALOG_OPTIONS }; protected: - virtual void DoDataExchange(CDataExchange* pDX); // Prise en charge DDX/DDV + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV DECLARE_MESSAGE_MAP() public: - double m_sm_distance; - double m_sm_radius; - double m_sm_angle; + double m_sm_distance; // upper bound of distance to surface + double m_sm_error_bound; // error bound to stop dichotomy + double m_sm_radius; // upper bound of Delaunay balls radii + double m_sm_angle; // lower bound of facets angles (degrees) unsigned int m_dr_max_vertices; double m_dr_shell_size; double m_dr_sizing; - double m_contouring_value; - unsigned int m_number_of_neighbours; - double m_min_cameras_cone_angle; // Outliers threshold - int m_threshold_percent_avg_knn_sq_dst; // Threshold corresponding to the number of points to be removed + double m_contouring_value; // Poisson contouring value (TEST) + double m_projection_error; // APSS projection error + unsigned int m_number_of_neighbours; // K-nearest neighbours + double m_min_cameras_cone_angle; // min angle of camera's cone (degrees) + int m_threshold_percent_avg_knn_sq_dst; // percentage of outliers to remove }; diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/Poisson.rc b/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/Poisson.rc index ce26b1c28fb..a171e875f24 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/Poisson.rc +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/Poisson.rc @@ -196,34 +196,25 @@ END IDR_MAINFRAME ACCELERATORS BEGIN - VK_NUMPAD2, ID_RECONSTRUCTION_DELAUNAYREFINEMENT, VIRTKEY, NOINVERT VK_NUMPAD3, ID_ALGORITHMS_EXTRAPOLATENORMALS, VIRTKEY, NOINVERT - VK_NUMPAD4, ID_RECONSTRUCTION_POISSON, VIRTKEY, NOINVERT - VK_NUMPAD5, ID_RECONSTRUCTION_POISSON_SURFACE_MESHING, VIRTKEY, NOINVERT VK_NUMPAD6, ID_ALGORITHMS_MARCHINGTETCONTOURING, VIRTKEY, NOINVERT - "A", ID_RECONSTRUCTION_APSS_RECONSTRUCTION, VIRTKEY, NOINVERT - "A", ID_RENDER_ARCBALL, VIRTKEY, SHIFT, NOINVERT - "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT - "C", ID_RENDER_CONTOUR, VIRTKEY, SHIFT, NOINVERT - "D", ID_RENDER_DELAUNAYEDGES, VIRTKEY, SHIFT, NOINVERT - "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT - "N", ID_RENDER_NORMALS, VIRTKEY, SHIFT, NOINVERT + VK_NUMPAD1, ID_CREATE_POISSON_TRIANGULATION, VIRTKEY, NOINVERT "O", ID_EDIT_OPTIONS, VIRTKEY, NOINVERT "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT - "P", ID_ONE_STEP_POISSON_RECONSTRUCTION, VIRTKEY, NOINVERT "S", ID_FILE_SAVE_AS, VIRTKEY, CONTROL, NOINVERT - "S", ID_RENDER_SURFACE, VIRTKEY, SHIFT, NOINVERT - "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT - "V", ID_RENDER_POINTS, VIRTKEY, SHIFT, NOINVERT - VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT - VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT + "P", ID_ONE_STEP_POISSON_RECONSTRUCTION, VIRTKEY, NOINVERT VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT - VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT - VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT - VK_NUMPAD1, ID_CREATE_POISSON_TRIANGULATION, VIRTKEY, NOINVERT - "X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT - "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "A", ID_RECONSTRUCTION_APSS_RECONSTRUCTION, VIRTKEY, NOINVERT + VK_NUMPAD2, ID_RECONSTRUCTION_DELAUNAYREFINEMENT, VIRTKEY, NOINVERT + VK_NUMPAD4, ID_RECONSTRUCTION_POISSON, VIRTKEY, NOINVERT + VK_NUMPAD5, ID_RECONSTRUCTION_POISSON_SURFACE_MESHING, VIRTKEY, NOINVERT + "A", ID_RENDER_ARCBALL, VIRTKEY, SHIFT, NOINVERT + "C", ID_RENDER_CONTOUR, VIRTKEY, SHIFT, NOINVERT + "D", ID_RENDER_DELAUNAYEDGES, VIRTKEY, SHIFT, NOINVERT + "N", ID_RENDER_NORMALS, VIRTKEY, SHIFT, NOINVERT + "V", ID_RENDER_POINTS, VIRTKEY, SHIFT, NOINVERT + "S", ID_RENDER_SURFACE, VIRTKEY, SHIFT, NOINVERT END @@ -466,37 +457,42 @@ LANGUAGE LANG_FRENCH, SUBLANG_FRENCH // Dialog // -IDD_DIALOG_OPTIONS DIALOGEX 0, 0, 352, 221 +IDD_DIALOG_OPTIONS DIALOGEX 0, 0, 514, 191 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Options" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "OK",IDOK,222,198,50,14 - PUSHBUTTON "Cancel",IDCANCEL,276,198,50,14 - GROUPBOX "Surface Mesh Generator",IDC_STATIC,180,90,156,96 - LTEXT "Angle",IDC_STATIC,192,114,24,8 - LTEXT "Radius",IDC_STATIC,192,138,24,8 - LTEXT "Distance",IDC_STATIC,192,162,30,8 - EDITTEXT IDC_EDIT_SM_ANGLE,294,108,30,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_SM_RADIUS,294,132,30,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_SM_DISTANCE,294,156,30,12,ES_AUTOHSCROLL - GROUPBOX "Poisson",IDC_STATIC,12,90,144,96 - LTEXT "Shell size",IDC_STATIC,30,106,48,8 - LTEXT "Sizing",IDC_STATIC,30,127,48,8 - LTEXT "Max #Steiner",IDC_STATIC,30,145,44,8 - EDITTEXT IDC_EDIT_DR_SHELL_SIZE,92,104,30,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_DR_SIZING,92,121,30,12,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_DR_MAXV,92,138,52,12,ES_AUTOHSCROLL - LTEXT "Contouring Value",IDC_STATIC,30,164,55,8 - EDITTEXT IDC_EDIT_CONTOURING_VALUE,92,161,30,12,ES_AUTOHSCROLL - LTEXT "# of neighbours",IDC_STATIC,30,38,51,8 - EDITTEXT IDC_EDIT_NB_OF_NEIGHBOURS,92,36,30,12,ES_AUTOHSCROLL - GROUPBOX "Processing",IDC_STATIC,180,12,156,60 - LTEXT "Min Cameras Angle (Gyroviz)",IDC_STATIC,192,30,93,8 - EDITTEXT IDC_EDIT_MIN_CAMERAS_CONE_ANGLE,294,24,30,12,ES_AUTOHSCROLL - LTEXT "Outliers % wrt distance",IDC_STATIC,192,52,102,8 - EDITTEXT IDC_EDIT_AVG_KNN_SQ_DST_PERCENTAGE,294,48,30,12,ES_AUTOHSCROLL - GROUPBOX "General",IDC_STATIC,12,12,144,60 + DEFPUSHBUTTON "OK",IDOK,402,162,50,14 + PUSHBUTTON "Cancel",IDCANCEL,456,162,50,14 + GROUPBOX "Surface Mesh Generator",IDC_STATIC,348,12,156,96 + LTEXT "Min Angle (degrees)",IDC_STATIC,360,28,71,8 + LTEXT "Triangles Size",IDC_STATIC,360,47,77,8 + LTEXT "Distance to Surface",IDC_STATIC,360,68,98,8 + EDITTEXT IDC_EDIT_SM_ANGLE,462,25,30,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_SM_RADIUS,462,44,30,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_SM_DISTANCE,462,63,30,12,ES_AUTOHSCROLL + GROUPBOX "Poisson",IDC_STATIC,186,12,144,96 + LTEXT "Shell size",IDC_STATIC,199,28,48,8 + LTEXT "Sizing",IDC_STATIC,199,47,48,8 + LTEXT "Max #Steiner",IDC_STATIC,199,68,44,8 + EDITTEXT IDC_EDIT_DR_SHELL_SIZE,276,25,42,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_DR_SIZING,276,44,42,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_DR_MAXV,276,63,42,12,ES_AUTOHSCROLL + LTEXT "Contouring Value",IDC_STATIC,199,87,55,8 + EDITTEXT IDC_EDIT_CONTOURING_VALUE,276,84,42,12,ES_AUTOHSCROLL + LTEXT "Number of Neighbours",IDC_STATIC,25,38,75,8 + EDITTEXT IDC_EDIT_NB_OF_NEIGHBOURS,126,34,30,12,ES_AUTOHSCROLL + GROUPBOX "Processing",IDC_STATIC,12,120,156,60 + LTEXT "Min Cameras Angle (degrees)",IDC_STATIC,24,138,102,8 + EDITTEXT IDC_EDIT_MIN_CAMERAS_CONE_ANGLE,126,134,30,12,ES_AUTOHSCROLL + LTEXT "Outliers % wrt Distance",IDC_STATIC,24,160,102,8 + EDITTEXT IDC_EDIT_AVG_KNN_SQ_DST_PERCENTAGE,126,156,30,12,ES_AUTOHSCROLL + GROUPBOX "General",IDC_STATIC,12,12,156,60 + LTEXT "Dichotomy Error",IDC_STATIC,361,87,52,8 + EDITTEXT IDC_EDIT_SM_ERROR_BOUND,463,82,30,12,ES_AUTOHSCROLL + LTEXT "Projection Error",IDC_STATIC,199,146,75,8 + EDITTEXT IDC_EDIT_APSS_ERROR,276,142,42,12,ES_AUTOHSCROLL + GROUPBOX "APSS",IDC_STATIC,186,120,144,60 END @@ -511,9 +507,9 @@ BEGIN IDD_DIALOG_OPTIONS, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 345 + RIGHTMARGIN, 507 TOPMARGIN, 7 - BOTTOMMARGIN, 214 + BOTTOMMARGIN, 184 END END #endif // APSTUDIO_INVOKED diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/PoissonDoc.cpp b/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/PoissonDoc.cpp index aab1fa799d6..9e157480f02 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/PoissonDoc.cpp +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/poisson/PoissonDoc.cpp @@ -37,6 +37,10 @@ // STL #include #include +#include +#ifndef M_PI + #define M_PI 3.14159265358979323846 +#endif #ifdef _DEBUG #define new DEBUG_NEW @@ -112,24 +116,26 @@ CPoissonDoc::CPoissonDoc() m_poisson_solved = false; // Need to solve Poisson equation // Surface mesher options - m_sm_angle = 30.0; // theorical guaranty if angle >= 30 + m_sm_angle = 20.0; // theorical guaranty if angle >= 30, but slower m_sm_radius = 0.1; // as suggested by LR m_sm_distance = 0.005; + m_sm_error_bound = 2e-3; - // Delaunay refinement options - m_dr_shell_size = 0.01; + // Poisson options + m_dr_shell_size = 0.01; // 3 Delaunay refinements options m_dr_sizing = 0.5 * m_dr_shell_size; m_dr_max_vertices = (unsigned int)5e6; + m_contouring_value = 0.0; // Poisson contouring value; should be 0 (TEST) - // Surface mesher and marching tet common options - m_contouring_value = 0.0; // 0 by default + // APSS options + m_projection_error = 3.16e-4 /* sqrt(1e-7) */; // APSS projection error // K-nearest neighbours options - m_number_of_neighbours = 7; // by default + m_number_of_neighbours = 10; // was 7 // Outlier removal - m_min_cameras_cone_angle = 0.03; // Outliers threshold = min angle of the cameras cone - m_threshold_percent_avg_knn_sq_dst = 10; // Threshold corresponding to the number of points to be removed + m_min_cameras_cone_angle = 2; // min angle of camera's cone (degrees) + m_threshold_percent_avg_knn_sq_dst = 10; // percentage of outliers to remove } CPoissonDoc::~CPoissonDoc() @@ -501,13 +507,15 @@ void CPoissonDoc::OnEditOptions() dlg.m_sm_angle = m_sm_angle; dlg.m_sm_radius = m_sm_radius; dlg.m_sm_distance = m_sm_distance; + dlg.m_sm_error_bound = m_sm_error_bound; dlg.m_dr_sizing = m_dr_sizing; dlg.m_dr_shell_size = m_dr_shell_size; dlg.m_dr_max_vertices = m_dr_max_vertices; - dlg.m_contouring_value = m_contouring_value; + dlg.m_projection_error = m_projection_error; + dlg.m_number_of_neighbours = m_number_of_neighbours; dlg.m_min_cameras_cone_angle = m_min_cameras_cone_angle; dlg.m_threshold_percent_avg_knn_sq_dst = m_threshold_percent_avg_knn_sq_dst; @@ -517,13 +525,15 @@ void CPoissonDoc::OnEditOptions() m_sm_angle = dlg.m_sm_angle; m_sm_radius = dlg.m_sm_radius; m_sm_distance = dlg.m_sm_distance; + m_sm_error_bound = dlg.m_sm_error_bound; m_dr_sizing = dlg.m_dr_sizing; m_dr_shell_size = dlg.m_dr_shell_size; m_dr_max_vertices = dlg.m_dr_max_vertices; - m_contouring_value = dlg.m_contouring_value; + m_projection_error = dlg.m_projection_error; + m_number_of_neighbours = dlg.m_number_of_neighbours; m_min_cameras_cone_angle = dlg.m_min_cameras_cone_angle; @@ -826,17 +836,20 @@ void CPoissonDoc::OnReconstructionPoissonSurfaceMeshing() FT sm_sphere_radius = 2 * size; sm_sphere_radius *= 1.1; // <= the Surface Mesher fails if the sphere does not contain the surface Surface_3 surface(*m_poisson_function, - Sphere(sm_sphere_center,sm_sphere_radius*sm_sphere_radius)); + Sphere(sm_sphere_center,sm_sphere_radius*sm_sphere_radius), + m_sm_error_bound*size/sm_sphere_radius); // dichotomy stops when segment < m_sm_error_bound*size // defining meshing criteria CGAL::Surface_mesh_default_criteria_3 criteria(m_sm_angle, // lower bound of facets angles (degrees) m_sm_radius*size, // upper bound of Delaunay balls radii m_sm_distance*size); // upper bound of distance to surface - // meshing surface -/*std::cerr << "make_surface_mesh(sphere={center=("<setNofNeighbors(nofNeighbors); + m_apss_function = new APSS_implicit_function(m_points.begin(), m_points.end(), + m_number_of_neighbours, + m_projection_error); // dichotomy stops when segment < m_projection_error*size // Get inner point Point inner_point = m_apss_function->get_inner_point(); @@ -1135,17 +1147,22 @@ void CPoissonDoc::OnReconstructionApssReconstruction() FT sm_sphere_radius = 2 * size; sm_sphere_radius *= 1.1; // <= the Surface Mesher fails if the sphere does not contain the surface Surface_3 surface(*m_apss_function, - Sphere(sm_sphere_center,sm_sphere_radius*sm_sphere_radius)); + Sphere(sm_sphere_center,sm_sphere_radius*sm_sphere_radius), + m_sm_error_bound*size/sm_sphere_radius); // dichotomy stops when segment < m_sm_error_bound*size // defining meshing criteria CGAL::Surface_mesh_default_criteria_3 criteria(m_sm_angle, // lower bound of facets angles (degrees) m_sm_radius*size, // upper bound of Delaunay balls radii m_sm_distance*size); // upper bound of distance to surface - // meshing surface -/*std::cerr << "make_surface_mesh(sphere={center=("< - APSS_implicit_function(InputIterator first, InputIterator beyond) + APSS_implicit_function(InputIterator first, InputIterator beyond, + unsigned int k, + FT projection_error = 3.16e-4) // sqrt(1e-7) { m = new Private; @@ -140,8 +144,13 @@ public: // Find a point inside the surface. find_inner_point(); + + // Number of nearest neighbours + m->nofNeighbors = k; - m->sqError = 0.0000001 * Gt().compute_squared_radius_3_object()(m->bounding_sphere); + // Dichotomy error when projecting point (squared) +// m->sqError = 0.0000001 * Gt().compute_squared_radius_3_object()(m->bounding_sphere); + m->sqError = projection_error * projection_error * Gt().compute_squared_radius_3_object()(m->bounding_sphere); } APSS_implicit_function(const APSS_implicit_function& other) { @@ -577,8 +586,8 @@ private: Sphere bounding_sphere; // Points' bounding sphere Point barycenter; // Points' barycenter FT diameter_standard_deviation; // Standard deviation of the distance to barycenter - FT sqError; - unsigned int nofNeighbors; + FT sqError; // Dichotomy error when projecting point (squared) + unsigned int nofNeighbors; // Number of nearest neighbours mutable AlgebraicSphere as; Point inner_point; // Point inside the surface int count; diff --git a/Surface_reconstruction_3/package_info/Surface_reconstruction_3/workflow.txt b/Surface_reconstruction_3/package_info/Surface_reconstruction_3/workflow.txt index 4f88acd5375..f6960d5afd4 100644 --- a/Surface_reconstruction_3/package_info/Surface_reconstruction_3/workflow.txt +++ b/Surface_reconstruction_3/package_info/Surface_reconstruction_3/workflow.txt @@ -7,7 +7,7 @@ Analysis Processing - smoothing (via jet-fitting + reprojection) (done) - outlier removal (to check which one is easy with CGAL components) (done) -- decimate point sets (laurent) +- simplify point sets: clustering, random simplification (laurent) Normal estimation - KNN + point-based PCA (done) @@ -25,7 +25,7 @@ Implicit function Implicit function contouring - Delaunay refinement & filtering (Surface_mesher) (done) -- Integration of Marching Cubes? (laurent) +- Integration of Marching Cubes (laurent) Delaunay-based contouring - Integration of "Da - Cohen-Steiner" [Cohen Steiner-Da 2003] (laurent) diff --git a/Surface_reconstruction_3/test/Surface_reconstruction_3/APSS_reconstruction_test.cpp b/Surface_reconstruction_3/test/Surface_reconstruction_3/APSS_reconstruction_test.cpp index 93707696b79..6b7ca97f9ec 100644 --- a/Surface_reconstruction_3/test/Surface_reconstruction_3/APSS_reconstruction_test.cpp +++ b/Surface_reconstruction_3/test/Surface_reconstruction_3/APSS_reconstruction_test.cpp @@ -59,8 +59,8 @@ typedef std::vector PointList; typedef CGAL::APSS_implicit_function APSS_implicit_function; // Surface mesher -typedef CGAL::Surface_mesh_default_triangulation_3 Str; -typedef CGAL::Surface_mesh_complex_2_in_triangulation_3 C2t3; +typedef CGAL::Surface_mesh_default_triangulation_3 STr; +typedef CGAL::Surface_mesh_complex_2_in_triangulation_3 C2t3; typedef CGAL::Implicit_surface_3 Surface_3; @@ -109,8 +109,6 @@ int main(int argc, char * argv[]) return(EXIT_FAILURE); } - unsigned int nofNeighbors = 10; - // Accumulated errors int accumulated_fatal_err = EXIT_SUCCESS; @@ -193,14 +191,26 @@ int main(int argc, char * argv[]) //reshape(pwns); // Scale point set to [-1,1]^3 - APSS_implicit_function apss_function(pwns.begin(), pwns.end()); - apss_function.setNofNeighbors(nofNeighbors); + // APSS options + unsigned int number_of_neighbours = 10; + double projection_error = 3.16e-4; // sqrt(1e-7) + + // Create implicit function + APSS_implicit_function apss_function(pwns.begin(), pwns.end(), + number_of_neighbours, + projection_error); // dichotomy stops when segment < projection_error*size //*************************************** // Surface mesh generation //*************************************** - Str tr; // 3D-Delaunay triangulation + // Surface mesher options + FT sm_angle = 20.0; // theorical guaranty if angle >= 30, but slower + FT sm_radius = 0.1; // as suggested by LR + FT sm_distance = 0.005; + FT sm_error_bound = 2e-3; + + STr tr; // 3D-Delaunay triangulation C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation // Get inner point @@ -222,20 +232,22 @@ int main(int argc, char * argv[]) FT sm_sphere_radius = 2 * size; sm_sphere_radius *= 1.1; // <= the Surface Mesher fails if the sphere does not contain the surface Surface_3 surface(apss_function, - Sphere(sm_sphere_center,sm_sphere_radius*sm_sphere_radius)); + Sphere(sm_sphere_center,sm_sphere_radius*sm_sphere_radius), + sm_error_bound*size/sm_sphere_radius); // dichotomy stops when segment < sm_error_bound*size // defining meshing criteria - FT sm_angle = 30.0; // theorical guaranty if angle >= 30 - FT sm_radius = 0.1; // as suggested by LR - FT sm_distance = 0.005; - CGAL::Surface_mesh_default_criteria_3 criteria(sm_angle, // lower bound of facets angles (degrees) + CGAL::Surface_mesh_default_criteria_3 criteria(sm_angle, // lower bound of facets angles (degrees) sm_radius*size, // upper bound of Delaunay balls radii sm_distance*size); // upper bound of distance to surface - // meshing surface -/*std::cerr << "make_surface_mesh(sphere={center=("< Dt3; typedef CGAL::Poisson_implicit_function Poisson_implicit_function; // Surface mesher -typedef CGAL::Surface_mesh_default_triangulation_3 Str; -typedef CGAL::Surface_mesh_complex_2_in_triangulation_3 C2t3; +typedef CGAL::Surface_mesh_default_triangulation_3 STr; +typedef CGAL::Surface_mesh_complex_2_in_triangulation_3 C2t3; typedef CGAL::Implicit_surface_3 Surface_3; @@ -192,7 +192,13 @@ int main(int argc, char * argv[]) // Surface mesh generation //*************************************** - Str tr; // 3D-Delaunay triangulation + // Surface mesher options + FT sm_angle = 20.0; // theorical guaranty if angle >= 30, but slower + FT sm_radius = 0.1; // as suggested by LR + FT sm_distance = 0.005; + FT sm_error_bound = 2e-3; + + STr tr; // 3D-Delaunay triangulation C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation // Get inner point @@ -214,20 +220,20 @@ int main(int argc, char * argv[]) FT sm_sphere_radius = 2 * size; sm_sphere_radius *= 1.1; // <= the Surface Mesher fails if the sphere does not contain the surface Surface_3 surface(poisson_function, - Sphere(sm_sphere_center,sm_sphere_radius*sm_sphere_radius)); + Sphere(sm_sphere_center,sm_sphere_radius*sm_sphere_radius), + sm_error_bound*size/sm_sphere_radius); // dichotomy stops when segment < sm_error_bound*size // defining meshing criteria - FT sm_angle = 30.0; // theorical guaranty if angle >= 30 - FT sm_radius = 0.1; // as suggested by LR - FT sm_distance = 0.005; - CGAL::Surface_mesh_default_criteria_3 criteria(sm_angle, // lower bound of facets angles (degrees) + CGAL::Surface_mesh_default_criteria_3 criteria(sm_angle, // lower bound of facets angles (degrees) sm_radius*size, // upper bound of Delaunay balls radii sm_distance*size); // upper bound of distance to surface - // meshing surface -/*std::cerr << "make_surface_mesh(sphere={center=("<