DGtalTools  1.2.0
surface_approx.h
1 #pragma once
2 
3 #include <DGtal/helpers/StdDefs.h>
4 #include <DGtal/topology/CanonicCellEmbedder.h>
5 #include <DGtal/topology/CanonicSCellEmbedder.h>
6 #include <DGtal/math/linalg/EigenSupport.h>
7 #include <DGtal/dec/DiscreteExteriorCalculus.h>
8 #include <tuple>
9 
10 bool ends_with(const std::string& value, const std::string& ending);
11 
12 typedef DGtal::DiscreteExteriorCalculus<2, 3, DGtal::EigenLinearAlgebraBackend> Calculus;
13 typedef Calculus::LinearAlgebraBackend Backend;
14 typedef Calculus::KSpace KSpace;
15 typedef DGtal::CanonicCellEmbedder<KSpace> CellEmbedder;
16 typedef DGtal::CanonicSCellEmbedder<KSpace> SCellEmbedder;
17 typedef KSpace::SCell SCell;
18 typedef KSpace::Cell Cell;
19 typedef Backend::DenseVector FlatVector;
20 typedef Backend::SparseMatrix OperatorMatrix;
21 typedef Backend::Triplet Triplet;
22 typedef DGtal::Z3i::Point Point;
23 typedef DGtal::Z3i::RealPoint RealPoint;
24 
25 std::tuple<Calculus, FlatVector>
26 initCalculusAndNormalsFromSurfelNormalsCSV(const std::string& filename);
27 
28 bool
29 checkOperatorSymmetry(const OperatorMatrix& matrix, const double tol=1e-8);
30 
31 FlatVector
32 vertexNormals(const Calculus& calculus, const FlatVector& face_normals);
33 
35 {
38  double align;
39  double fairness;
40  double barycenter;
41 };
42 
43 void
44 exportOBJ(const Calculus& calculus, const FlatVector& positions, const std::string& filename);
45 
46 // (original_positions, regularization_position, original_centers, regularized_centers)
47 std::tuple<FlatVector, FlatVector, FlatVector, FlatVector>
48 approximateSurface(const Calculus& calculus, const FlatVector& normals, const ApproxParams& params);
49 
50 // (L_position, L_align)
51 std::tuple<double, double>
52 approximateSurfaceEnergies(const Calculus& calculus, const FlatVector& normals, const FlatVector& positions);
53 
double regularization_position
double regularization_center
double barycenter