27#include <easy3d/core/poly_mesh.h>
28#include <easy3d/util/initializer.h>
54PolyMesh *old_mesh_from_previous_example() {
60 auto v1 = mesh->add_vertex(
vec3(0.0, 0.0, 1.0));
61 auto v2 = mesh->add_vertex(
vec3(1.0, 0.0, 0.0));
62 auto v3 = mesh->add_vertex(
vec3(0.0, 0.0, -1.0));
65 mesh->add_tetra(v0, v1, v2, v3);
70int main(
int argc,
char **argv) {
75 PolyMesh *mesh = old_mesh_from_previous_example();
77 std::cout <<
"----------------------------------------\n";
78 std::cout <<
"The incident vertices of each vertex" << std::endl;
79 std::cout <<
"----------------------------------------\n";
82 std::cout <<
"incident vertices of vertex " << v <<
": ";
85 std::cout << vv <<
" ";
86 std::cout << std::endl;
89 std::cout <<
"----------------------------------------\n";
90 std::cout <<
"The incident edges of each vertex" << std::endl;
91 std::cout <<
"----------------------------------------\n";
94 std::cout <<
"incident edges of vertex " << v <<
": ";
96 for (
auto e : mesh->
edges(v))
97 std::cout << e <<
" ";
98 std::cout << std::endl;
101 std::cout <<
"----------------------------------------\n";
102 std::cout <<
"The incident halffaces of each vertex" << std::endl;
103 std::cout <<
"----------------------------------------\n";
106 std::cout <<
"incident halffaces of vertex " << v <<
": ";
109 std::cout << h <<
" ";
110 std::cout << std::endl;
113 std::cout <<
"----------------------------------------\n";
114 std::cout <<
"The incident cells of each vertex" << std::endl;
115 std::cout <<
"----------------------------------------\n";
118 std::cout <<
"incident cells of vertex " << v <<
": ";
120 for (
auto c : mesh->
cells(v))
121 std::cout << c <<
" ";
122 std::cout << std::endl;
125 std::cout <<
"----------------------------------------\n";
126 std::cout <<
"The incident vertices of each edge" << std::endl;
127 std::cout <<
"----------------------------------------\n";
129 for (
auto e : mesh->
edges()) {
130 std::cout <<
"incident vertices of edge " << e <<
": " << mesh->
vertex(e, 0) <<
" " << mesh->
vertex(e, 1)
134 std::cout <<
"----------------------------------------\n";
135 std::cout <<
"The incident halffaces of each edge" << std::endl;
136 std::cout <<
"----------------------------------------\n";
138 for (
auto e : mesh->
edges()) {
139 std::cout <<
"incident halffaces of edge " << e <<
": ";
142 std::cout << h <<
" ";
143 std::cout << std::endl;
146 std::cout <<
"----------------------------------------\n";
147 std::cout <<
"The incident cells of each edge" << std::endl;
148 std::cout <<
"----------------------------------------\n";
150 for (
auto e : mesh->
edges()) {
151 std::cout <<
"incident cells of edge " << e <<
": ";
153 for (
auto c : mesh->
cells(e))
154 std::cout << c <<
" ";
155 std::cout << std::endl;
158 std::cout <<
"----------------------------------------\n";
159 std::cout <<
"The incident vertices of each halfface" << std::endl;
160 std::cout <<
"----------------------------------------\n";
163 std::cout <<
"incident vertices of halfface " << h <<
": ";
166 std::cout << v <<
" ";
167 std::cout << std::endl;
170 std::cout <<
"----------------------------------------\n";
171 std::cout <<
"The incident edges of each halfface" << std::endl;
172 std::cout <<
"----------------------------------------\n";
175 std::cout <<
"incident edges of halfface " << h <<
": ";
177 for (
auto e : mesh->
edges(h))
178 std::cout << e <<
" ";
179 std::cout << std::endl;
182 std::cout <<
"----------------------------------------\n";
183 std::cout <<
"The associated cell of each halfface" << std::endl;
184 std::cout <<
"----------------------------------------\n";
187 std::cout <<
"incident associated cell of halfface " << h <<
": " << mesh->
cell(h) << std::endl;
190 std::cout <<
"----------------------------------------\n";
191 std::cout <<
"The opposite halfface and cell of each halfface" << std::endl;
192 std::cout <<
"----------------------------------------\n";
195 std::cout <<
"opposite halfface of halfface " << h <<
": " << mesh->
opposite(h) <<
". ";
196 std::cout <<
"opposite cell of halfface " << h <<
": " << mesh->
cell(mesh->
opposite(h)) << std::endl;
199 std::cout <<
"----------------------------------------\n";
200 std::cout <<
"The incident vertices of each cell" << std::endl;
201 std::cout <<
"----------------------------------------\n";
203 for (
auto c : mesh->
cells()) {
204 std::cout <<
"incident vertices of cell " << c <<
": ";
207 std::cout << v <<
" ";
208 std::cout << std::endl;
211 std::cout <<
"----------------------------------------\n";
212 std::cout <<
"The incident edges of each cell" << std::endl;
213 std::cout <<
"----------------------------------------\n";
215 for (
auto c : mesh->
cells()) {
216 std::cout <<
"incident edges of cell " << c <<
": ";
218 for (
auto e : mesh->
edges(c))
219 std::cout << e <<
" ";
220 std::cout << std::endl;
223 std::cout <<
"----------------------------------------\n";
224 std::cout <<
"The incident halffaces of each cell" << std::endl;
225 std::cout <<
"----------------------------------------\n";
227 for (
auto c : mesh->
cells()) {
228 std::cout <<
"incident halffaces of cell " << c <<
": ";
231 std::cout << h <<
" ";
232 std::cout << std::endl;
235 std::cout <<
"----------------------------------------\n";
236 std::cout <<
"The two halffaces of each face" << std::endl;
237 std::cout <<
"----------------------------------------\n";
239 for (
auto f : mesh->
faces()) {
240 std::cout <<
"incident halffaces of face " << f <<
": " << mesh->
halfface(f, 0) <<
" " << mesh->
halfface(f, 1)
Data structure representing a polyhedral mesh.
Definition: poly_mesh.h:50
HalfFace opposite(HalfFace h) const
returns the twin halfface of halfface h.
Definition: poly_mesh.h:1231
EdgeContainer edges() const
returns edge container for C++11 range-based for-loops
Definition: poly_mesh.h:1147
VertexContainer vertices() const
returns vertex container for C++11 range-based for-loops
Definition: poly_mesh.h:1129
FaceContainer faces() const
returns face container for C++11 range-based for-loops
Definition: poly_mesh.h:1183
CellContainer cells() const
returns cell container for C++11 range-based for-loops
Definition: poly_mesh.h:1201
HalffaceContainer halffaces() const
returns halfface container for C++11 range-based for-loops
Definition: poly_mesh.h:1165
Cell cell(HalfFace h) const
returns the cell associated with halfface h
Definition: poly_mesh.h:1311
Vertex add_vertex(const vec3 &p)
add a new vertex with position p
Definition: poly_mesh.h:709
HalfFace halfface(Face f, unsigned int i) const
returns the i'th halfface of face f. i has to be 0 or 1.
Definition: poly_mesh.h:1219
Vertex vertex(Edge e, unsigned int i) const
returns the i'th vertex of edge e. i has to be 0 or 1.
Definition: poly_mesh.h:1237
Definition: collider.cpp:182
void initialize(bool use_log_file, bool use_setting_file, const std::string &resource_dir)
Initialization of Easy3D.
Definition: initializer.cpp:35