Compare commits
No commits in common. "b44bad92e7245453169148fc251adc0eea4560bb" and "940ba1be7fe67c87bb8d588f8b89629c0c1bb08b" have entirely different histories.
b44bad92e7
...
940ba1be7f
@ -6,15 +6,14 @@ Ceci comprend les fonctionalités suivantes :
|
||||
- analyse de courbure (dans ‘src/curvature.cpp’)
|
||||
- adoucissement d'un maillage par laplacien uniforme ou cotangent (dans
|
||||
‘src/smoothing.cpp’)
|
||||
- suppression de parasites (dans ‘src/noise_removal.cpp’)
|
||||
|
||||
Des maillages exemples sont inclus, ‘data/gargoyle_trou.obj’ est un
|
||||
bon exemple pour le remplissage, ‘data/bunnyLowPoly-noisy.obj’ pour
|
||||
l'adoucissement et ‘data/bunny.obj’ pour la suppression de parasites.
|
||||
l'adoucissement.
|
||||
|
||||
|
||||
Compilation
|
||||
‘cmake -Bbuild -DCMAKE_BUILD_TYPE=Release’
|
||||
‘cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-O2’
|
||||
puis
|
||||
‘cmake --build build’
|
||||
|
||||
|
@ -46,7 +46,6 @@ DoubleInput::DoubleInput(QObject *parent, double min, double max,
|
||||
_spin_box->setValue(value);
|
||||
_slider->setMaximum(_slider_resolution);
|
||||
_slider->setValue(doubleToInt(value));
|
||||
_slider->setTracking(false);
|
||||
connect(_slider, &QSlider::valueChanged,
|
||||
this, &DoubleInput::onSliderValueChanged);
|
||||
connect(_spin_box, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "IO.h"
|
||||
#include "util.h"
|
||||
#include <MeshReconstruction.h>
|
||||
#include <OpenMesh/Core/Utils/PropertyManager.hh>
|
||||
|
||||
|
||||
static std::vector<std::vector<HalfedgeHandle>> findHoles(MyMesh &mesh) {
|
||||
@ -154,7 +153,7 @@ vector<MyMesh::VertexHandle> Hole_Filling::next_neighbors(const vector<MyMesh::V
|
||||
|
||||
// ***** Computation of RBF
|
||||
|
||||
pair<pair<Eigen::MatrixXd &, Eigen::VectorXd &>, vector<MyMesh::Point> &> Hole_Filling::compute_approx_mat(vector<MyMesh::VertexHandle> vlist, double normal_scale)
|
||||
pair<pair<Eigen::MatrixXd &, Eigen::VectorXd &>, vector<MyMesh::Point> &> Hole_Filling::compute_approx_mat(vector<MyMesh::VertexHandle> vlist)
|
||||
{
|
||||
const int n(vlist.size()), d(10) ;
|
||||
Eigen::MatrixXd & A = *(new Eigen::MatrixXd(3*n+d,3*n+d)) ;
|
||||
@ -171,12 +170,12 @@ pair<pair<Eigen::MatrixXd &, Eigen::VectorXd &>, vector<MyMesh::Point> &> Hole_F
|
||||
//Append vertices+normals to pts_list
|
||||
for (int i=0; i<n; i++)
|
||||
{
|
||||
pts_list.push_back(_mesh.point(vlist.at(i)) + _mesh.normal(vlist.at(i)) * normal_scale) ;
|
||||
pts_list.push_back(_mesh.point(vlist.at(i)) + _mesh.normal(vlist.at(i))) ;
|
||||
}
|
||||
//Append vertices-normals to pts_list
|
||||
for (int i=0; i<n; i++)
|
||||
{
|
||||
pts_list.push_back(_mesh.point(vlist.at(i)) - _mesh.normal(vlist.at(i)) * normal_scale) ;
|
||||
pts_list.push_back(_mesh.point(vlist.at(i)) - _mesh.normal(vlist.at(i))) ;
|
||||
}
|
||||
|
||||
int nn = pts_list.size() ;
|
||||
@ -303,37 +302,15 @@ Mesh Hole_Filling::poly_n_out(const Implicit_RBF &implicit, Rect3 domain)
|
||||
}
|
||||
|
||||
|
||||
/* Computes a mesh's bounding box and stores it in a mesh property
|
||||
* named "bounding_box". */
|
||||
static void computeMeshBoundingBox(MyMesh &mesh, Hole_Filling &hf) {
|
||||
try {
|
||||
auto mesh_bb = OpenMesh::getProperty<void, Rect3>
|
||||
(mesh, "bounding_box");
|
||||
} catch (const std::runtime_error &e) {
|
||||
auto mesh_bb = OpenMesh::getOrMakeProperty<void, Rect3>
|
||||
(mesh, "bounding_box");
|
||||
std::vector<VertexHandle> verts;
|
||||
for (VertexHandle vh : mesh.vertices()) {
|
||||
verts.push_back(vh);
|
||||
}
|
||||
*mesh_bb = hf.estimate_BB(verts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MyMesh fillHoleImplicit(MyMesh &mesh, Hole_Filling &hf,
|
||||
std::vector<HalfedgeHandle> &hole) {
|
||||
computeMeshBoundingBox(mesh, hf);
|
||||
Rect3 mesh_bb = *OpenMesh::getProperty<void, Rect3>(mesh, "bounding_box");
|
||||
double diag = mesh_bb.size.Norm();
|
||||
|
||||
std::vector<VertexHandle> verts;
|
||||
for (HalfedgeHandle hh : hole) {
|
||||
verts.push_back(mesh.to_vertex_handle(hh));
|
||||
}
|
||||
auto bb = hf.estimate_BB(verts) ;
|
||||
verts = hf.next_neighbors(verts);
|
||||
auto [system, pts_list] = hf.compute_approx_mat(verts, diag * .1);
|
||||
auto [system, pts_list] = hf.compute_approx_mat(verts);
|
||||
auto [alpha, beta] = hf.solve_approx(system, pts_list.size(), 10);
|
||||
Implicit_RBF rbf(alpha, beta, pts_list);
|
||||
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
vector<MyMesh::VertexHandle> next_neighbors(const vector<MyMesh::VertexHandle> & bnd) ;
|
||||
|
||||
// Computation of RBF
|
||||
pair<pair<Eigen::MatrixXd &,Eigen::VectorXd &>,vector<MyMesh::Point> &> compute_approx_mat(vector<MyMesh::VertexHandle> vlist, double normal_scale=1) ;
|
||||
pair<pair<Eigen::MatrixXd &,Eigen::VectorXd &>,vector<MyMesh::Point> &> compute_approx_mat(vector<MyMesh::VertexHandle> vlist) ;
|
||||
pair<vector<float>&, vector<float>&> solve_approx(const pair<Eigen::MatrixXd &, Eigen::VectorXd &> &p, int n, int d) ;
|
||||
|
||||
// IO
|
||||
|
@ -32,7 +32,6 @@ MeshProcessor::MeshProcessor(const QString &path, MeshViewer &mesh_viewer,
|
||||
qWarning() << "Curvature computation failed";
|
||||
}
|
||||
connect(&mesh_viewer, &MeshViewer::clicked, this, &MeshProcessor::click);
|
||||
|
||||
updateView();
|
||||
}
|
||||
|
||||
@ -45,7 +44,7 @@ MeshProcessor::~MeshProcessor() {
|
||||
}
|
||||
|
||||
|
||||
void MeshProcessor::updateView() {
|
||||
void MeshProcessor::updateView() const {
|
||||
if (mesh_viewer.isInitialized()) {
|
||||
mesh_viewer.removeMesh(mesh);
|
||||
mesh_viewer.addMesh(mesh);
|
||||
|
@ -18,7 +18,7 @@ class MeshProcessor : public QObject {
|
||||
double implicit_hole_filling_discr;
|
||||
std::vector<MyMesh> fillings;
|
||||
|
||||
void updateView();
|
||||
void updateView() const;
|
||||
|
||||
public:
|
||||
MyMesh mesh;
|
||||
|
@ -89,10 +89,9 @@ void MeshViewer::paintGL() {
|
||||
}
|
||||
|
||||
|
||||
void MeshViewer::addMesh(MyMesh &mesh) {
|
||||
void MeshViewer::addMesh(const MyMesh &mesh) {
|
||||
Q_ASSERT(isValid());
|
||||
makeCurrent();
|
||||
mesh.viewer_id = meshes.size();
|
||||
meshes.emplace_back(mesh, program);
|
||||
doneCurrent();
|
||||
update();
|
||||
@ -101,14 +100,9 @@ void MeshViewer::addMesh(MyMesh &mesh) {
|
||||
|
||||
void MeshViewer::removeMesh(const MyMesh &mesh) {
|
||||
makeCurrent();
|
||||
size_t i = 0;
|
||||
for (auto it = meshes.begin(); it != meshes.end(); ++it) {
|
||||
if (i == mesh.viewer_id) {
|
||||
meshes.erase(it);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
meshes.remove_if([&](const MeshView &mv) {
|
||||
return &mv.mesh == &mesh;
|
||||
});
|
||||
doneCurrent();
|
||||
update();
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
constexpr bool isInitialized() { return is_initialized; }
|
||||
|
||||
public slots:
|
||||
void addMesh(MyMesh &mesh);
|
||||
void addMesh(const MyMesh &mesh);
|
||||
void removeMesh(const MyMesh &mesh);
|
||||
void updateForReal();
|
||||
|
||||
|
@ -25,7 +25,6 @@ class MyMesh : public OpenMesh::TriMesh_ArrayKernelT<MyTraits> {
|
||||
public:
|
||||
Color default_color {.5, .5, .5};
|
||||
QMatrix4x4 transform;
|
||||
size_t viewer_id;
|
||||
std::vector<std::vector<HalfedgeHandle>> holes;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user