Easy3D 2.6.1
Loading...
Searching...
No Matches
surface_mesh_topology.h
1/********************************************************************
2 * Copyright (C) 2015-2021 by Liangliang Nan <liangliang.nan@gmail.com>
3 * Copyright (C) 2000-2005 INRIA - Project ALICE
4 *
5 * The code in this file is partly from OGF/Graphite (2.0 alpha-4) with
6 * modifications and enhancement:
7 * https://gforge.inria.fr/forum/forum.php?forum_id=11459
8 * The original code was distributed under the GNU GPL license.
9 ********************************************************************/
10
11#ifndef EASY3D_ALGO_SURFACE_MESH_TOPOLOGY_H
12#define EASY3D_ALGO_SURFACE_MESH_TOPOLOGY_H
13
14
15#include <cstddef>
16
17namespace easy3d {
18
20
24 public:
29 explicit SurfaceMeshTopology(const SurfaceMeshComponent *comp);
30
35 int euler_poincare() const;
36
41 std::size_t number_of_borders() const { return number_of_borders_; }
42
47 std::size_t largest_border_size() const { return largest_border_size_; }
48
53 bool is_closed() const { return number_of_borders_ == 0; }
54
59 bool is_sphere() const { return (number_of_borders() == 0) && (euler_poincare() == 2); }
60
65 bool is_disc() const { return (number_of_borders() == 1) && (euler_poincare() == 1); }
66
71 bool is_cylinder() const { return (number_of_borders() == 2) && (euler_poincare() == 0); }
72
77 bool is_torus() const { return (number_of_borders() == 0) && (euler_poincare() == 0); }
78
79 private:
80 const SurfaceMeshComponent *component_;
81
82 std::size_t number_of_borders_;
83 std::size_t largest_border_size_;
84 };
85
86}
87
88#endif // EASY3D_ALGO_SURFACE_MESH_TOPOLOGY_H
89
A connected component of a SurfaceMesh.
Definition surface_mesh_components.h:27
bool is_disc() const
Returns if the surface is topologically equivalent to a disc.
Definition surface_mesh_topology.h:65
int euler_poincare() const
Returns the Euler-Poincare characteristic.
Definition surface_mesh_topology.cpp:46
std::size_t largest_border_size() const
Returns the number of edges in the largest border.
Definition surface_mesh_topology.h:47
bool is_closed() const
Returns if the surface is closed.
Definition surface_mesh_topology.h:53
bool is_torus() const
Returns if the surface is topologically equivalent to a torus.
Definition surface_mesh_topology.h:77
bool is_cylinder() const
Returns if the surface is topologically equivalent to a cylinder.
Definition surface_mesh_topology.h:71
bool is_sphere() const
Returns if the surface is topologically equivalent to a sphere.
Definition surface_mesh_topology.h:59
std::size_t number_of_borders() const
Returns the number of borders.
Definition surface_mesh_topology.h:41
SurfaceMeshTopology(const SurfaceMeshComponent *comp)
Construct with the surface mesh component to analyze.
Definition surface_mesh_topology.cpp:19
Definition collider.cpp:182