Added 2 items in Options dialog: Surface Mesher's dichotomy error and APSS projection error.

Default values are previous hard-coded values.

Use KNN from Options dialog in APSS. 
Default value is now 10 to match previous APSS KNN.
This commit is contained in:
Laurent Saboret 2008-06-20 14:04:47 +00:00
parent 0fb2c81d53
commit 1b3ed3a8c3
10 changed files with 183 additions and 130 deletions

View File

@ -12,12 +12,14 @@ IMPLEMENT_DYNAMIC(CDialogOptions, CDialog)
CDialogOptions::CDialogOptions(CWnd* pParent /*=NULL*/) CDialogOptions::CDialogOptions(CWnd* pParent /*=NULL*/)
: CDialog(CDialogOptions::IDD, pParent) : CDialog(CDialogOptions::IDD, pParent)
, m_sm_distance(0) , m_sm_distance(0)
, m_sm_error_bound(0)
, m_sm_radius(0) , m_sm_radius(0)
, m_sm_angle(0) , m_sm_angle(0)
, m_dr_max_vertices(0) , m_dr_max_vertices(0)
, m_dr_shell_size(0) , m_dr_shell_size(0)
, m_dr_sizing(0) , m_dr_sizing(0)
, m_contouring_value(0) , m_contouring_value(0)
, m_projection_error(0)
, m_number_of_neighbours(0) , m_number_of_neighbours(0)
, m_threshold_percent_avg_knn_sq_dst(0) , m_threshold_percent_avg_knn_sq_dst(0)
{ {
@ -38,13 +40,15 @@ void CDialogOptions::DoDataExchange(CDataExchange* pDX)
DDX_Text(pDX,IDC_EDIT_SM_ANGLE,m_sm_angle); 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_RADIUS,m_sm_radius);
DDX_Text(pDX,IDC_EDIT_SM_DISTANCE,m_sm_distance); 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_SHELL_SIZE,m_dr_shell_size);
DDX_Text(pDX,IDC_EDIT_DR_SIZING,m_dr_sizing); 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_DR_MAXV,m_dr_max_vertices);
DDX_Text(pDX,IDC_EDIT_CONTOURING_VALUE,m_contouring_value); 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); DDX_Text(pDX,IDC_EDIT_NB_OF_NEIGHBOURS,m_number_of_neighbours);
} }

View File

@ -1,33 +1,36 @@
#pragma once #pragma once
#include "resource.h"
// Boîte de dialogue CDialogOptions
// Class CDialogOptions = Options dialog box
class CDialogOptions : public CDialog class CDialogOptions : public CDialog
{ {
DECLARE_DYNAMIC(CDialogOptions) DECLARE_DYNAMIC(CDialogOptions)
public: public:
CDialogOptions(CWnd* pParent = NULL); // constructeur standard CDialogOptions(CWnd* pParent = NULL);
virtual ~CDialogOptions(); virtual ~CDialogOptions();
// Données de boîte de dialogue // Données de boîte de dialogue
enum { IDD = IDD_DIALOG_OPTIONS }; enum { IDD = IDD_DIALOG_OPTIONS };
protected: protected:
virtual void DoDataExchange(CDataExchange* pDX); // Prise en charge DDX/DDV virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
public: public:
double m_sm_distance; double m_sm_distance; // upper bound of distance to surface
double m_sm_radius; double m_sm_error_bound; // error bound to stop dichotomy
double m_sm_angle; 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; unsigned int m_dr_max_vertices;
double m_dr_shell_size; double m_dr_shell_size;
double m_dr_sizing; double m_dr_sizing;
double m_contouring_value; double m_contouring_value; // Poisson contouring value (TEST)
unsigned int m_number_of_neighbours; double m_projection_error; // APSS projection error
double m_min_cameras_cone_angle; // Outliers threshold unsigned int m_number_of_neighbours; // K-nearest neighbours
int m_threshold_percent_avg_knn_sq_dst; // Threshold corresponding to the number of points to be removed 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
}; };

View File

@ -196,34 +196,25 @@ END
IDR_MAINFRAME ACCELERATORS IDR_MAINFRAME ACCELERATORS
BEGIN BEGIN
VK_NUMPAD2, ID_RECONSTRUCTION_DELAUNAYREFINEMENT, VIRTKEY, NOINVERT
VK_NUMPAD3, ID_ALGORITHMS_EXTRAPOLATENORMALS, 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 VK_NUMPAD6, ID_ALGORITHMS_MARCHINGTETCONTOURING, VIRTKEY, NOINVERT
"A", ID_RECONSTRUCTION_APSS_RECONSTRUCTION, VIRTKEY, NOINVERT VK_NUMPAD1, ID_CREATE_POISSON_TRIANGULATION, 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
"O", ID_EDIT_OPTIONS, VIRTKEY, NOINVERT "O", ID_EDIT_OPTIONS, VIRTKEY, NOINVERT
"O", ID_FILE_OPEN, VIRTKEY, CONTROL, 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_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 VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
"P", ID_ONE_STEP_POISSON_RECONSTRUCTION, VIRTKEY, NOINVERT
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT "A", ID_RECONSTRUCTION_APSS_RECONSTRUCTION, VIRTKEY, NOINVERT
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT VK_NUMPAD2, ID_RECONSTRUCTION_DELAUNAYREFINEMENT, VIRTKEY, NOINVERT
VK_NUMPAD1, ID_CREATE_POISSON_TRIANGULATION, VIRTKEY, NOINVERT VK_NUMPAD4, ID_RECONSTRUCTION_POISSON, VIRTKEY, NOINVERT
"X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT VK_NUMPAD5, ID_RECONSTRUCTION_POISSON_SURFACE_MESHING, VIRTKEY, NOINVERT
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, 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 END
@ -466,37 +457,42 @@ LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
// Dialog // 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 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Options" CAPTION "Options"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "OK",IDOK,222,198,50,14 DEFPUSHBUTTON "OK",IDOK,402,162,50,14
PUSHBUTTON "Cancel",IDCANCEL,276,198,50,14 PUSHBUTTON "Cancel",IDCANCEL,456,162,50,14
GROUPBOX "Surface Mesh Generator",IDC_STATIC,180,90,156,96 GROUPBOX "Surface Mesh Generator",IDC_STATIC,348,12,156,96
LTEXT "Angle",IDC_STATIC,192,114,24,8 LTEXT "Min Angle (degrees)",IDC_STATIC,360,28,71,8
LTEXT "Radius",IDC_STATIC,192,138,24,8 LTEXT "Triangles Size",IDC_STATIC,360,47,77,8
LTEXT "Distance",IDC_STATIC,192,162,30,8 LTEXT "Distance to Surface",IDC_STATIC,360,68,98,8
EDITTEXT IDC_EDIT_SM_ANGLE,294,108,30,12,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_SM_ANGLE,462,25,30,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_SM_RADIUS,294,132,30,12,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_SM_RADIUS,462,44,30,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_SM_DISTANCE,294,156,30,12,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_SM_DISTANCE,462,63,30,12,ES_AUTOHSCROLL
GROUPBOX "Poisson",IDC_STATIC,12,90,144,96 GROUPBOX "Poisson",IDC_STATIC,186,12,144,96
LTEXT "Shell size",IDC_STATIC,30,106,48,8 LTEXT "Shell size",IDC_STATIC,199,28,48,8
LTEXT "Sizing",IDC_STATIC,30,127,48,8 LTEXT "Sizing",IDC_STATIC,199,47,48,8
LTEXT "Max #Steiner",IDC_STATIC,30,145,44,8 LTEXT "Max #Steiner",IDC_STATIC,199,68,44,8
EDITTEXT IDC_EDIT_DR_SHELL_SIZE,92,104,30,12,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_DR_SHELL_SIZE,276,25,42,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_DR_SIZING,92,121,30,12,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_DR_SIZING,276,44,42,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_DR_MAXV,92,138,52,12,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_DR_MAXV,276,63,42,12,ES_AUTOHSCROLL
LTEXT "Contouring Value",IDC_STATIC,30,164,55,8 LTEXT "Contouring Value",IDC_STATIC,199,87,55,8
EDITTEXT IDC_EDIT_CONTOURING_VALUE,92,161,30,12,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_CONTOURING_VALUE,276,84,42,12,ES_AUTOHSCROLL
LTEXT "# of neighbours",IDC_STATIC,30,38,51,8 LTEXT "Number of Neighbours",IDC_STATIC,25,38,75,8
EDITTEXT IDC_EDIT_NB_OF_NEIGHBOURS,92,36,30,12,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_NB_OF_NEIGHBOURS,126,34,30,12,ES_AUTOHSCROLL
GROUPBOX "Processing",IDC_STATIC,180,12,156,60 GROUPBOX "Processing",IDC_STATIC,12,120,156,60
LTEXT "Min Cameras Angle (Gyroviz)",IDC_STATIC,192,30,93,8 LTEXT "Min Cameras Angle (degrees)",IDC_STATIC,24,138,102,8
EDITTEXT IDC_EDIT_MIN_CAMERAS_CONE_ANGLE,294,24,30,12,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_MIN_CAMERAS_CONE_ANGLE,126,134,30,12,ES_AUTOHSCROLL
LTEXT "Outliers % wrt distance",IDC_STATIC,192,52,102,8 LTEXT "Outliers % wrt Distance",IDC_STATIC,24,160,102,8
EDITTEXT IDC_EDIT_AVG_KNN_SQ_DST_PERCENTAGE,294,48,30,12,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_AVG_KNN_SQ_DST_PERCENTAGE,126,156,30,12,ES_AUTOHSCROLL
GROUPBOX "General",IDC_STATIC,12,12,144,60 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 END
@ -511,9 +507,9 @@ BEGIN
IDD_DIALOG_OPTIONS, DIALOG IDD_DIALOG_OPTIONS, DIALOG
BEGIN BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 345 RIGHTMARGIN, 507
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 214 BOTTOMMARGIN, 184
END END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED

View File

@ -37,6 +37,10 @@
// STL // STL
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <math.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifdef _DEBUG #ifdef _DEBUG
#define new DEBUG_NEW #define new DEBUG_NEW
@ -112,24 +116,26 @@ CPoissonDoc::CPoissonDoc()
m_poisson_solved = false; // Need to solve Poisson equation m_poisson_solved = false; // Need to solve Poisson equation
// Surface mesher options // 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_radius = 0.1; // as suggested by LR
m_sm_distance = 0.005; m_sm_distance = 0.005;
m_sm_error_bound = 2e-3;
// Delaunay refinement options // Poisson options
m_dr_shell_size = 0.01; m_dr_shell_size = 0.01; // 3 Delaunay refinements options
m_dr_sizing = 0.5 * m_dr_shell_size; m_dr_sizing = 0.5 * m_dr_shell_size;
m_dr_max_vertices = (unsigned int)5e6; 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 // APSS options
m_contouring_value = 0.0; // 0 by default m_projection_error = 3.16e-4 /* sqrt(1e-7) */; // APSS projection error
// K-nearest neighbours options // K-nearest neighbours options
m_number_of_neighbours = 7; // by default m_number_of_neighbours = 10; // was 7
// Outlier removal // Outlier removal
m_min_cameras_cone_angle = 0.03; // Outliers threshold = min angle of the cameras cone m_min_cameras_cone_angle = 2; // min angle of camera's cone (degrees)
m_threshold_percent_avg_knn_sq_dst = 10; // Threshold corresponding to the number of points to be removed m_threshold_percent_avg_knn_sq_dst = 10; // percentage of outliers to remove
} }
CPoissonDoc::~CPoissonDoc() CPoissonDoc::~CPoissonDoc()
@ -501,13 +507,15 @@ void CPoissonDoc::OnEditOptions()
dlg.m_sm_angle = m_sm_angle; dlg.m_sm_angle = m_sm_angle;
dlg.m_sm_radius = m_sm_radius; dlg.m_sm_radius = m_sm_radius;
dlg.m_sm_distance = m_sm_distance; 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_sizing = m_dr_sizing;
dlg.m_dr_shell_size = m_dr_shell_size; dlg.m_dr_shell_size = m_dr_shell_size;
dlg.m_dr_max_vertices = m_dr_max_vertices; dlg.m_dr_max_vertices = m_dr_max_vertices;
dlg.m_contouring_value = m_contouring_value; 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_number_of_neighbours = m_number_of_neighbours;
dlg.m_min_cameras_cone_angle = m_min_cameras_cone_angle; 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; 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_angle = dlg.m_sm_angle;
m_sm_radius = dlg.m_sm_radius; m_sm_radius = dlg.m_sm_radius;
m_sm_distance = dlg.m_sm_distance; 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_sizing = dlg.m_dr_sizing;
m_dr_shell_size = dlg.m_dr_shell_size; m_dr_shell_size = dlg.m_dr_shell_size;
m_dr_max_vertices = dlg.m_dr_max_vertices; m_dr_max_vertices = dlg.m_dr_max_vertices;
m_contouring_value = dlg.m_contouring_value; m_contouring_value = dlg.m_contouring_value;
m_projection_error = dlg.m_projection_error;
m_number_of_neighbours = dlg.m_number_of_neighbours; m_number_of_neighbours = dlg.m_number_of_neighbours;
m_min_cameras_cone_angle = dlg.m_min_cameras_cone_angle; m_min_cameras_cone_angle = dlg.m_min_cameras_cone_angle;
@ -826,17 +836,20 @@ void CPoissonDoc::OnReconstructionPoissonSurfaceMeshing()
FT sm_sphere_radius = 2 * size; FT sm_sphere_radius = 2 * size;
sm_sphere_radius *= 1.1; // <= the Surface Mesher fails if the sphere does not contain the surface sm_sphere_radius *= 1.1; // <= the Surface Mesher fails if the sphere does not contain the surface
Surface_3 surface(*m_poisson_function, 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 // defining meshing criteria
CGAL::Surface_mesh_default_criteria_3<STr> criteria(m_sm_angle, // lower bound of facets angles (degrees) CGAL::Surface_mesh_default_criteria_3<STr> criteria(m_sm_angle, // lower bound of facets angles (degrees)
m_sm_radius*size, // upper bound of Delaunay balls radii m_sm_radius*size, // upper bound of Delaunay balls radii
m_sm_distance*size); // upper bound of distance to surface m_sm_distance*size); // upper bound of distance to surface
// meshing surface std::cerr << "Implicit_surface_3(dichotomy error="<<m_sm_error_bound*size << ")\n";
/*std::cerr << "make_surface_mesh(sphere={center=("<<sm_sphere_center << "), radius="<<sm_sphere_radius << "},\n" std::cerr << "make_surface_mesh(sphere={center=("<<sm_sphere_center << "), radius="<<sm_sphere_radius << "},\n"
<< " criteria={angle="<<m_sm_angle << ", radius="<<m_sm_radius*size << ", distance="<<m_sm_distance*size << "},\n" << " criteria={angle="<<m_sm_angle << ", radius="<<m_sm_radius*size << ", distance="<<m_sm_distance*size << "},\n"
<< " Non_manifold_tag())...\n";*/ << " Non_manifold_tag())...\n";
// meshing surface
CGAL::make_surface_mesh(m_surface_mesher_c2t3, surface, criteria, CGAL::Non_manifold_tag()); CGAL::make_surface_mesh(m_surface_mesher_c2t3, surface, criteria, CGAL::Non_manifold_tag());
// get output surface // get output surface
@ -1029,7 +1042,7 @@ void CPoissonDoc::OnAlgorithmsOutliersRemovalWrtCamerasConeAngle()
remove_outliers_wrt_camera_cone_angle_3( remove_outliers_wrt_camera_cone_angle_3(
m_points.begin(), m_points.end(), m_points.begin(), m_points.end(),
std::back_inserter(output), std::back_inserter(output),
m_min_cameras_cone_angle); m_min_cameras_cone_angle*M_PI/180.0);
m_points.clear(); m_points.clear();
std::copy(output.begin(),output.end(),std::back_inserter(m_points)); std::copy(output.begin(),output.end(),std::back_inserter(m_points));
@ -1110,11 +1123,10 @@ void CPoissonDoc::OnReconstructionApssReconstruction()
m_surface_mesher_c2t3.clear(); m_surface_mesher_c2t3.clear();
m_surface.clear(); m_surface.clear();
unsigned int nofNeighbors = 10;
// Create implicit function // Create implicit function
m_apss_function = new APSS_implicit_function(m_points.begin(), m_points.end()); m_apss_function = new APSS_implicit_function(m_points.begin(), m_points.end(),
m_apss_function->setNofNeighbors(nofNeighbors); m_number_of_neighbours,
m_projection_error); // dichotomy stops when segment < m_projection_error*size
// Get inner point // Get inner point
Point inner_point = m_apss_function->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; FT sm_sphere_radius = 2 * size;
sm_sphere_radius *= 1.1; // <= the Surface Mesher fails if the sphere does not contain the surface sm_sphere_radius *= 1.1; // <= the Surface Mesher fails if the sphere does not contain the surface
Surface_3 surface(*m_apss_function, 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 // defining meshing criteria
CGAL::Surface_mesh_default_criteria_3<STr> criteria(m_sm_angle, // lower bound of facets angles (degrees) CGAL::Surface_mesh_default_criteria_3<STr> criteria(m_sm_angle, // lower bound of facets angles (degrees)
m_sm_radius*size, // upper bound of Delaunay balls radii m_sm_radius*size, // upper bound of Delaunay balls radii
m_sm_distance*size); // upper bound of distance to surface m_sm_distance*size); // upper bound of distance to surface
// meshing surface std::cerr << "APSS_implicit_function(knn="<<m_number_of_neighbours << ",\n"
/*std::cerr << "make_surface_mesh(sphere={center=("<<sm_sphere_center << "), radius="<<sm_sphere_radius << "},\n" << " projection error="<<m_projection_error*size << ")\n";
std::cerr << "Implicit_surface_3(dichotomy error="<<m_sm_error_bound*size << ")\n";
std::cerr << "make_surface_mesh(sphere={center=("<<sm_sphere_center << "), radius="<<sm_sphere_radius << "},\n"
<< " criteria={angle="<<m_sm_angle << ", radius="<<m_sm_radius*size << ", distance="<<m_sm_distance*size << "},\n" << " criteria={angle="<<m_sm_angle << ", radius="<<m_sm_radius*size << ", distance="<<m_sm_distance*size << "},\n"
<< " Non_manifold_tag())...\n";*/ << " Non_manifold_tag())...\n";
// meshing surface
CGAL::make_surface_mesh(m_surface_mesher_c2t3, surface, criteria, CGAL::Non_manifold_tag()); CGAL::make_surface_mesh(m_surface_mesher_c2t3, surface, criteria, CGAL::Non_manifold_tag());
// get output surface // get output surface

View File

@ -106,24 +106,26 @@ private:
Triangular_surface m_contour; Triangular_surface m_contour;
// Surface mesher options // Surface mesher options
double m_sm_angle; double m_sm_angle; // lower bound of facets angles (degrees)
double m_sm_radius; double m_sm_radius; // upper bound of Delaunay balls radii
double m_sm_distance; double m_sm_distance; // upper bound of distance to surface
double m_sm_error_bound; // error bound to stop dichotomy
// Delaunay refinement options // Poisson options
double m_dr_sizing; double m_dr_sizing; // 3 Delaunay refinements options
double m_dr_shell_size; double m_dr_shell_size;
unsigned int m_dr_max_vertices; unsigned int m_dr_max_vertices;
double m_contouring_value; // Poisson contouring value (TEST)
// Surface mesher and marching tet common options // APSS options
double m_contouring_value; double m_projection_error; // APSS projection error
// K-nearest neighbours options // K-nearest neighbours options
unsigned int m_number_of_neighbours; unsigned int m_number_of_neighbours;
// Outlier removal // Outlier removal
double m_min_cameras_cone_angle; // Outliers threshold = min angle of the cameras cone double m_min_cameras_cone_angle; // min angle of camera's cone (degrees)
int m_threshold_percent_avg_knn_sq_dst; // Threshold corresponding to the number of points to be removed int m_threshold_percent_avg_knn_sq_dst; // percentage of outliers to remove
// Public methods // Public methods
public: public:

View File

@ -19,7 +19,11 @@
#define IDC_EDIT_CONTOURING_VALUE 1006 #define IDC_EDIT_CONTOURING_VALUE 1006
#define IDC_EDIT_NB_OF_NEIGHBOURS 1007 #define IDC_EDIT_NB_OF_NEIGHBOURS 1007
#define IDC_EDIT_MIN_CAMERAS_CONE_ANGLE 1008 #define IDC_EDIT_MIN_CAMERAS_CONE_ANGLE 1008
#define IDC_EDIT_SM_DISTANCE2 1009
#define IDC_EDIT_SM_ERROR_BOUND 1009
#define IDC_EDIT_AVG_KNN_SQ_DST_PERCENTAGE 1010 #define IDC_EDIT_AVG_KNN_SQ_DST_PERCENTAGE 1010
#define IDC_EDIT_NB_OF_NEIGHBOURS2 1011
#define IDC_EDIT_APSS_ERROR 1011
#define ID_RENDER_POINTS 32771 #define ID_RENDER_POINTS 32771
#define ID_RENDER_NORMALS 32772 #define ID_RENDER_NORMALS 32772
#define ID_RENDER_DELAUNAYEDGES 32773 #define ID_RENDER_DELAUNAYEDGES 32773

View File

@ -106,8 +106,12 @@ public:
/// ///
/// @param first First point of point set. /// @param first First point of point set.
/// @param beyond Past-the-end point of point set. /// @param beyond Past-the-end point of point set.
/// @param k Number of nearest neighbours.
/// @param projection_error Dichotomy error when projecting point.
template < class InputIterator > template < class InputIterator >
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; m = new Private;
@ -141,7 +145,12 @@ public:
// Find a point inside the surface. // Find a point inside the surface.
find_inner_point(); find_inner_point();
m->sqError = 0.0000001 * Gt().compute_squared_radius_3_object()(m->bounding_sphere); // Number of nearest neighbours
m->nofNeighbors = k;
// 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) { APSS_implicit_function(const APSS_implicit_function& other) {
@ -577,8 +586,8 @@ private:
Sphere bounding_sphere; // Points' bounding sphere Sphere bounding_sphere; // Points' bounding sphere
Point barycenter; // Points' barycenter Point barycenter; // Points' barycenter
FT diameter_standard_deviation; // Standard deviation of the distance to barycenter FT diameter_standard_deviation; // Standard deviation of the distance to barycenter
FT sqError; FT sqError; // Dichotomy error when projecting point (squared)
unsigned int nofNeighbors; unsigned int nofNeighbors; // Number of nearest neighbours
mutable AlgebraicSphere as; mutable AlgebraicSphere as;
Point inner_point; // Point inside the surface Point inner_point; // Point inside the surface
int count; int count;

View File

@ -7,7 +7,7 @@ Analysis
Processing Processing
- smoothing (via jet-fitting + reprojection) (done) - smoothing (via jet-fitting + reprojection) (done)
- outlier removal (to check which one is easy with CGAL components) (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 Normal estimation
- KNN + point-based PCA (done) - KNN + point-based PCA (done)
@ -25,7 +25,7 @@ Implicit function
Implicit function contouring Implicit function contouring
- Delaunay refinement & filtering (Surface_mesher) (done) - Delaunay refinement & filtering (Surface_mesher) (done)
- Integration of Marching Cubes? (laurent) - Integration of Marching Cubes (laurent)
Delaunay-based contouring Delaunay-based contouring
- Integration of "Da - Cohen-Steiner" [Cohen Steiner-Da 2003] (laurent) - Integration of "Da - Cohen-Steiner" [Cohen Steiner-Da 2003] (laurent)

View File

@ -59,8 +59,8 @@ typedef std::vector<Point_with_normal> PointList;
typedef CGAL::APSS_implicit_function<Kernel,Point_with_normal> APSS_implicit_function; typedef CGAL::APSS_implicit_function<Kernel,Point_with_normal> APSS_implicit_function;
// Surface mesher // Surface mesher
typedef CGAL::Surface_mesh_default_triangulation_3 Str; typedef CGAL::Surface_mesh_default_triangulation_3 STr;
typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<Str> C2t3; typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<STr> C2t3;
typedef CGAL::Implicit_surface_3<Kernel, APSS_implicit_function&> Surface_3; typedef CGAL::Implicit_surface_3<Kernel, APSS_implicit_function&> Surface_3;
@ -109,8 +109,6 @@ int main(int argc, char * argv[])
return(EXIT_FAILURE); return(EXIT_FAILURE);
} }
unsigned int nofNeighbors = 10;
// Accumulated errors // Accumulated errors
int accumulated_fatal_err = EXIT_SUCCESS; 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 //reshape(pwns); // Scale point set to [-1,1]^3
APSS_implicit_function apss_function(pwns.begin(), pwns.end()); // APSS options
apss_function.setNofNeighbors(nofNeighbors); 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 // 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 C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation
// Get inner point // Get inner point
@ -222,20 +232,22 @@ int main(int argc, char * argv[])
FT sm_sphere_radius = 2 * size; FT sm_sphere_radius = 2 * size;
sm_sphere_radius *= 1.1; // <= the Surface Mesher fails if the sphere does not contain the surface sm_sphere_radius *= 1.1; // <= the Surface Mesher fails if the sphere does not contain the surface
Surface_3 surface(apss_function, 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 // defining meshing criteria
FT sm_angle = 30.0; // theorical guaranty if angle >= 30 CGAL::Surface_mesh_default_criteria_3<STr> criteria(sm_angle, // lower bound of facets angles (degrees)
FT sm_radius = 0.1; // as suggested by LR
FT sm_distance = 0.005;
CGAL::Surface_mesh_default_criteria_3<Str> criteria(sm_angle, // lower bound of facets angles (degrees)
sm_radius*size, // upper bound of Delaunay balls radii sm_radius*size, // upper bound of Delaunay balls radii
sm_distance*size); // upper bound of distance to surface sm_distance*size); // upper bound of distance to surface
// meshing surface std::cerr << "APSS_implicit_function(knn="<<number_of_neighbours << ",\n"
/*std::cerr << "make_surface_mesh(sphere={center=("<<sm_sphere_center << "), radius="<<sm_sphere_radius << "},\n" << " projection error="<<projection_error*size << ")\n";
std::cerr << "Implicit_surface_3(dichotomy error="<<sm_error_bound*size << ")\n";
std::cerr << "make_surface_mesh(sphere={center=("<<sm_sphere_center << "), radius="<<sm_sphere_radius << "},\n"
<< " criteria={angle="<<sm_angle << ", radius="<<sm_radius*size << ", distance="<<sm_distance*size << "},\n" << " criteria={angle="<<sm_angle << ", radius="<<sm_radius*size << ", distance="<<sm_distance*size << "},\n"
<< " Non_manifold_tag())...\n";*/ << " Non_manifold_tag())...\n";
// meshing surface
CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag()); CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag());
// Print status // Print status

View File

@ -61,8 +61,8 @@ typedef CGAL::Implicit_fct_delaunay_triangulation_3<Kernel> Dt3;
typedef CGAL::Poisson_implicit_function<Kernel, Dt3> Poisson_implicit_function; typedef CGAL::Poisson_implicit_function<Kernel, Dt3> Poisson_implicit_function;
// Surface mesher // Surface mesher
typedef CGAL::Surface_mesh_default_triangulation_3 Str; typedef CGAL::Surface_mesh_default_triangulation_3 STr;
typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<Str> C2t3; typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<STr> C2t3;
typedef CGAL::Implicit_surface_3<Kernel, Poisson_implicit_function&> Surface_3; typedef CGAL::Implicit_surface_3<Kernel, Poisson_implicit_function&> Surface_3;
@ -192,7 +192,13 @@ int main(int argc, char * argv[])
// Surface mesh generation // 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 C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation
// Get inner point // Get inner point
@ -214,20 +220,20 @@ int main(int argc, char * argv[])
FT sm_sphere_radius = 2 * size; FT sm_sphere_radius = 2 * size;
sm_sphere_radius *= 1.1; // <= the Surface Mesher fails if the sphere does not contain the surface sm_sphere_radius *= 1.1; // <= the Surface Mesher fails if the sphere does not contain the surface
Surface_3 surface(poisson_function, 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 // defining meshing criteria
FT sm_angle = 30.0; // theorical guaranty if angle >= 30 CGAL::Surface_mesh_default_criteria_3<STr> criteria(sm_angle, // lower bound of facets angles (degrees)
FT sm_radius = 0.1; // as suggested by LR
FT sm_distance = 0.005;
CGAL::Surface_mesh_default_criteria_3<Str> criteria(sm_angle, // lower bound of facets angles (degrees)
sm_radius*size, // upper bound of Delaunay balls radii sm_radius*size, // upper bound of Delaunay balls radii
sm_distance*size); // upper bound of distance to surface sm_distance*size); // upper bound of distance to surface
// meshing surface std::cerr << "Implicit_surface_3(dichotomy error="<<sm_error_bound*size << ")\n";
/*std::cerr << "make_surface_mesh(sphere={center=("<<sm_sphere_center << "), radius="<<sm_sphere_radius << "},\n" std::cerr << "make_surface_mesh(sphere={center=("<<sm_sphere_center << "), radius="<<sm_sphere_radius << "},\n"
<< " criteria={angle="<<sm_angle << ", radius="<<sm_radius*size << ", distance="<<sm_distance*size << "},\n" << " criteria={angle="<<sm_angle << ", radius="<<sm_radius*size << ", distance="<<sm_distance*size << "},\n"
<< " Non_manifold_tag())...\n";*/ << " Non_manifold_tag())...\n";
// meshing surface
CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag()); CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag());
// Print status // Print status