mirror of https://github.com/CGAL/cgal
get the demo compiled
This commit is contained in:
parent
a99ff3c822
commit
fb1c691ffa
|
|
@ -2359,11 +2359,12 @@ advancing_front_surface_reconstruction(PointIterator b,
|
|||
}
|
||||
|
||||
|
||||
template <typename PointIterator, typename Kernel>
|
||||
template <typename PointIterator, typename Kernel, typename Items, typename Filter>
|
||||
void
|
||||
advancing_front_surface_reconstruction(PointIterator b,
|
||||
advancing_front_surface_reconstructionP(PointIterator b,
|
||||
PointIterator e,
|
||||
Polyhedron_3<Kernel>& polyhedron,
|
||||
Polyhedron_3<Kernel,Items>& polyhedron,
|
||||
Filter filter,
|
||||
double radius_ratio_bound = 5,
|
||||
double beta = 0.52)
|
||||
{
|
||||
|
|
@ -2373,7 +2374,7 @@ advancing_front_surface_reconstruction(PointIterator b,
|
|||
typedef Triangulation_data_structure_3<LVb,LCb> Tds;
|
||||
typedef Delaunay_triangulation_3<Kernel,Tds> Triangulation_3;
|
||||
|
||||
typedef Advancing_front_surface_reconstruction<Kernel,Triangulation_3> Reconstruction;
|
||||
typedef Advancing_front_surface_reconstruction<Kernel,Triangulation_3,Filter> Reconstruction;
|
||||
typedef typename Kernel::Point_3 Point_3;
|
||||
|
||||
Triangulation_3 dt( boost::make_transform_iterator(b, AFSR::Auto_count<Point_3>()),
|
||||
|
|
@ -2382,7 +2383,7 @@ advancing_front_surface_reconstruction(PointIterator b,
|
|||
AFSR_options opt;
|
||||
opt.K = radius_ratio_bound;
|
||||
// TODO: What to do with beta???
|
||||
Reconstruction R(dt, opt);
|
||||
Reconstruction R(dt, opt,filter);
|
||||
R.run(opt);
|
||||
AFSR::construct_polyhedron(polyhedron, R);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
|||
target_link_libraries(pca_plugin scene_polyhedron_item scene_basic_objects)
|
||||
|
||||
qt4_wrap_ui( advancing_frontUI_FILES Polyhedron_demo_advancing_front_plugin.ui)
|
||||
polyhedron_demo_plugin(advancing_front_plugin Polyhedron_demo_advancing_front_plugin Polyhedron_demo_advancing_front_plugin_impl ${advancing_frontUI_FILES})
|
||||
polyhedron_demo_plugin(advancing_front_plugin Polyhedron_demo_advancing_front_plugin ${advancing_frontUI_FILES})
|
||||
target_link_libraries(advancing_front_plugin scene_polygon_soup_item scene_points_with_normal_item)
|
||||
|
||||
if(EIGEN3_FOUND)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@
|
|||
#include "Polyhedron_demo_plugin_helper.h"
|
||||
#include "Polyhedron_demo_plugin_interface.h"
|
||||
#include <Scene_polyhedron_item.h>
|
||||
|
||||
#include "Kernel_type.h"
|
||||
#include "Polyhedron_type.h"
|
||||
#include <CGAL/Advancing_front_surface_reconstruction.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QAction>
|
||||
|
|
@ -14,10 +16,28 @@
|
|||
|
||||
#include "ui_Polyhedron_demo_advancing_front_plugin.h"
|
||||
|
||||
// Reconstructs a surface mesh from a point set and writes facet indices into polygon soup.
|
||||
Polyhedron* advancing_front_reconstruct(const Point_set& points,
|
||||
double sm_perimeter,
|
||||
double sm_area);
|
||||
struct Perimeter {
|
||||
|
||||
double bound;
|
||||
|
||||
Perimeter(double bound)
|
||||
: bound(bound)
|
||||
{}
|
||||
|
||||
bool operator()(const Kernel::Point_3& p, const Kernel::Point_3& q, const Kernel::Point_3& r) const
|
||||
{
|
||||
if(bound == 0){
|
||||
return true;
|
||||
}
|
||||
double d = sqrt(squared_distance(p,q));
|
||||
if(d>bound) return true;
|
||||
d += sqrt(squared_distance(p,r)) ;
|
||||
if(d>bound) return true;
|
||||
d+= sqrt(squared_distance(q,r));
|
||||
return d>bound;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Polyhedron_demo_advancing_front_plugin :
|
||||
public QObject,
|
||||
|
|
@ -61,7 +81,6 @@ class Polyhedron_demo_advancing_front_plugin_dialog : public QDialog, private Ui
|
|||
}
|
||||
|
||||
double trianglePerimeter() const { return m_inputPerimeter->value(); }
|
||||
double triangleArea() const { return m_inputArea->value(); }
|
||||
};
|
||||
|
||||
void Polyhedron_demo_advancing_front_plugin::on_actionAdvancingFrontReconstruction_triggered()
|
||||
|
|
@ -82,7 +101,6 @@ void Polyhedron_demo_advancing_front_plugin::on_actionAdvancingFrontReconstructi
|
|||
if(!dialog.exec())
|
||||
return;
|
||||
const double sm_perimeter = dialog.trianglePerimeter();
|
||||
const double sm_area = dialog.triangleArea();
|
||||
|
||||
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
|
|
@ -90,15 +108,15 @@ void Polyhedron_demo_advancing_front_plugin::on_actionAdvancingFrontReconstructi
|
|||
// Add polyhedron to scene
|
||||
|
||||
// Reconstruct point set as a polyhedron
|
||||
Polyhedron *poly = advancing_front_reconstruct(*points, sm_perimeter, sm_area);
|
||||
|
||||
Scene_polyhedron_item* new_item = new Scene_polyhedron_item(poly);
|
||||
Scene_polyhedron_item* new_item = new Scene_polyhedron_item(Polyhedron());
|
||||
Polyhedron& P = * const_cast<Polyhedron*>(new_item->polyhedron());
|
||||
Perimeter filter(sm_perimeter);
|
||||
CGAL::advancing_front_surface_reconstructionP((points)->begin(), points->end(), P, filter);
|
||||
|
||||
|
||||
new_item->setName(tr("%1 Advancing Front (%2 %3)")
|
||||
.arg(point_set_item->name())
|
||||
.arg(sm_perimeter)
|
||||
.arg(sm_area));
|
||||
.arg(sm_perimeter));
|
||||
new_item->setColor(Qt::lightGray);
|
||||
scene->addItem(new_item);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Min triangle perimeter:</string>
|
||||
<string>Max triangle perimeter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="m_inputPerimeter">
|
||||
<property name="suffix">
|
||||
<string>* average spacing</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
|
|
@ -37,36 +37,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Max triangle area:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="m_inputArea">
|
||||
<property name="suffix">
|
||||
<string> * average spacing^2</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>20.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<item row="1" column="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
|
|
|
|||
Loading…
Reference in New Issue