26#include <DGtal/base/Common.h>
27#include <DGtal/helpers/StdDefs.h>
28#include <DGtal/helpers/Shortcuts.h>
29#include <DGtal/helpers/ShortcutsGeometry.h>
30#include <DGtal/shapes/SurfaceMesh.h>
31#include <DGtal/geometry/surfaces/DigitalSurfaceRegularization.h>
32#include <DGtal/dec/PolygonalCalculus.h>
34#include <polyscope/polyscope.h>
35#include <polyscope/surface_mesh.h>
36#include <polyscope/point_cloud.h>
37#include <polyscope/curve_network.h>
40#include <Eigen/Sparse>
57polyscope::SurfaceMesh *psMesh;
58polyscope::PointCloud *psVertices;
59polyscope::CurveNetwork *psBoundary;
67 phiEigen << 1.0, 2.0, 0.0, 5.0 ,1.5;
69 psMesh->addVertexScalarQuantity(
"Phi", phiEigen);
70 psVertices->addScalarQuantity(
"Phi", phiEigen);
77 std::vector<PolygonalCalculus<SH3::RealPoint,SH3::RealVector>::Vector> gradients;
78 std::vector<PolygonalCalculus<SH3::RealPoint,SH3::RealVector>::Vector> cogradients;
79 std::vector<PolygonalCalculus<SH3::RealPoint,SH3::RealVector>::Real3dPoint> normals;
80 std::vector<PolygonalCalculus<SH3::RealPoint,SH3::RealVector>::Real3dPoint> vectorArea;
81 std::vector<PolygonalCalculus<SH3::RealPoint,SH3::RealVector>::Real3dPoint> centroids;
82 std::vector<double> faceArea;
87 gradients.push_back( grad );
90 cogradients.push_back( cograd );
95 vectorArea.push_back({vA(0) , vA(1), vA(2)});
97 faceArea.push_back( calculus.
faceArea(f));
103 psMesh->addFaceVectorQuantity(
"Gradients", gradients);
104 psMesh->addFaceVectorQuantity(
"co-Gradients", cogradients);
105 psMesh->addFaceVectorQuantity(
"Normals", normals);
106 psMesh->addFaceScalarQuantity(
"Face area", faceArea);
107 psMesh->addFaceVectorQuantity(
"Vector area", vectorArea);
109 psBoundary->addEdgeScalarQuantity(
"d0*phi", dPhi);
110 psBoundary->addEdgeScalarQuantity(
"A*phi", av);
113 polyscope::registerPointCloud(
"Centroids", centroids);
118 std::vector<PolygonalCalculus<SH3::RealPoint,SH3::RealVector>::Vector> someV={v};
119 psMesh->addFaceVectorQuantity(
"A vector", someV);
122 psBoundary->addEdgeScalarQuantity(
"flat (1-form)", flat);
125 std::vector<PolygonalCalculus<SH3::RealPoint,SH3::RealVector>::Vector> sharpRes={sharp};
126 psMesh->addFaceVectorQuantity(
"Sharp", sharpRes);
131 std::vector<RealPoint> positions={ {0,0,0},{20,0,0}, {20,10,0}, {10,8,5}, {0,15,1} };
132 std::vector<std::vector<size_t>> faces={ {0,1,2,3,4} };
134 surfmesh =
SurfMesh(positions.begin(),
139 psVertices = polyscope::registerPointCloud(
"Vertices", positions);
141 std::vector<std::array<size_t,2>>
edges={{0,1},{1,2},{2,3},{3,4},{4,0} };
142 psBoundary = polyscope::registerCurveNetwork(
"Edges", positions, edges);
147 psMesh = polyscope::registerSurfaceMesh(
"Single face", positions, faces);
Aim: Implements basic operations that will be used in Point and Vector classes.
Implements differential operators on polygonal surfaces from .
DenseMatrix D(const Face f) const
Real3dVector faceNormalAsDGtalVector(const Face f) const
Real3dPoint centroidAsDGtalPoint(const Face f) const
Vector vectorArea(const Face f) const
DenseMatrix sharp(const Face f) const
double faceArea(const Face f) const
DenseMatrix coGradient(const Face f) const
DenseMatrix gradient(const Face f) const
MySurfaceMesh::Face Face
Face type.
LinAlg::DenseVector Vector
Type of Vector.
DenseMatrix A(const Face f) const
DenseMatrix flat(const Face f) const
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
DGtal is the top-level namespace which contains all DGtal functions and types.
std::pair< typename graph_traits< DGtal::DigitalSurface< TDigitalSurfaceContainer > >::edge_iterator, typename graph_traits< DGtal::DigitalSurface< TDigitalSurfaceContainer > >::edge_iterator > edges(const DGtal::DigitalSurface< TDigitalSurfaceContainer > &digSurf)
Aim: Represents an embedded mesh as faces and a list of vertices. Vertices may be shared among faces ...
std::vector< Vertex > Vertices
The type that defines a list/range of vertices (e.g. to define faces)
int main(int argc, char **argv)