27#include <easy3d/core/poly_mesh.h>
28#include <easy3d/util/initializer.h>
39PolyMesh *old_mesh_from_previous_example() {
45 auto v1 = mesh->add_vertex(
vec3(0.0, 0.0, 1.0));
46 auto v2 = mesh->add_vertex(
vec3(1.0, 0.0, 0.0));
47 auto v3 = mesh->add_vertex(
vec3(0.0, 0.0, -1.0));
50 mesh->add_tetra(v0, v1, v2, v3);
56int main(
int argc,
char** argv) {
61 PolyMesh *mesh = old_mesh_from_previous_example();
67 for (
auto f : mesh->
faces()) {
71 center[f] = c / mesh->
vertices(f).size();
75 for (
auto f : mesh->
faces()) {
76 std::cout <<
"center of " << f <<
": " << center[f] << std::endl;
Definition: poly_mesh.h:279
Data structure representing a polyhedral mesh.
Definition: poly_mesh.h:50
const vec3 & position(Vertex v) const
position of a vertex (read only)
Definition: poly_mesh.h:1368
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
FaceProperty< T > add_face_property(const std::string &name, const T t=T())
Definition: poly_mesh.h:852
Vertex add_vertex(const vec3 &p)
add a new vertex with position p
Definition: poly_mesh.h:709
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