Program Listing for File mesh.h
↰ Return to documentation for file (zmesh/core/mesh.h)
#pragma once
#include <memory>
#include <zmesh/core/mesh_kernel.h>
#include <zmesh/core/iterators.h>
#include <zmesh/core/circulators.h>
#include <zmesh/core/smart_handles.h>
namespace zmesh {
namespace core {
class Mesh : public MeshKernel {
public:
Mesh() = default;
virtual ~Mesh() {
}
// Mesh(const Mesh& rhs) {
// operator=(rhs);
// }
// also copy all the properties
// Mesh& operator=(const Mesh& rhs) {
// }
// does not copy any custom properties
// Mesh& assign(const Mesh& rhs);
HalfedgeHandle find_halfedge(VertexHandle start, VertexHandle end) const;
EdgeHandle find_edge(VertexHandle v0, VertexHandle v1) const;
void Mesh::adjust_outgoing_halfedge(VertexHandle v);
SmartVertexHandle add_vertex(const Point& p);
SmartVertexHandle add_vertex(float x, float y, float z);
SmartFaceHandle add_face(const std::vector<VertexHandle>& vertices);
SmartFaceHandle add_triangle(VertexHandle v0, VertexHandle v1, VertexHandle v2);
SmartFaceHandle add_triangle(const std::array<VertexHandle, 3>& vertices);
SmartFaceHandle add_quad(VertexHandle v0, VertexHandle v1, VertexHandle v2, VertexHandle v3);
SmartFaceHandle add_quad(const std::array<VertexHandle, 4>& vertices);
int valence(VertexHandle v) const; // number of 1 ring
int valence(FaceHandle f) const; // number of vertices that incident with this face
bool is_triangle_mesh() const;
bool is_quad_mesh() const;
bool is_empty() const {
return n_vertices() == 0;
}
// remove all vertices, edges, faces
// virtual void clear();
VertexIterator vertices_begin() const {
return VertexIterator(make_smart(VertexHandle(0), this));
}
VertexIterator vertices_end() const {
return VertexIterator(make_smart(VertexHandle(n_vertices()), this));
}
VertexRange vertices() const {
return VertexRange(vertices_begin(), vertices_end());
}
EdgeIterator edges_begin() const {
return EdgeIterator(make_smart(EdgeHandle(0), this));
}
EdgeIterator edges_end() const {
return EdgeIterator(make_smart(EdgeHandle(n_edges()), this));
}
EdgeRange edges() const {
return EdgeRange(edges_begin(), edges_end());
}
HalfedgeIterator halfedges_begin() const {
return HalfedgeIterator(make_smart(HalfedgeHandle(0), this));
}
HalfedgeIterator halfedges_end() const {
return HalfedgeIterator(make_smart(HalfedgeHandle(n_halfedges()), this));
}
HalfedgeRange halfedges() const {
return HalfedgeRange(halfedges_begin(), halfedges_end());
}
FaceIterator faces_begin() const {
return FaceIterator(make_smart(FaceHandle(0), this));
}
FaceIterator faces_end() const {
return FaceIterator(make_smart(FaceHandle(n_faces()), this));
}
FaceRange faces() const {
return FaceRange(faces_begin(), faces_end());
}
VertexAroundVertexCirculator vertices(VertexHandle vertex) const {
return VertexAroundVertexCirculator(this, vertex);
}
EdgeAroundVertexCirculator edges(VertexHandle vertex) const {
return EdgeAroundVertexCirculator(this, vertex);
}
HalfedgeAroundVertexCirculator halfedges(VertexHandle vertex) const {
return HalfedgeAroundVertexCirculator(this, vertex);
}
FaceAroundVertexCirculator faces(VertexHandle vertex) const {
return FaceAroundVertexCirculator(this, vertex);
}
VertexAroundFaceCirculator vertices(FaceHandle face) const {
return VertexAroundFaceCirculator(this, face);
}
EdgeAroundFaceCirculator edges(FaceHandle face) const {
return EdgeAroundFaceCirculator(this, face);
}
HalfedgeAroundFaceCirculator halfedges(FaceHandle face) const {
return HalfedgeAroundFaceCirculator(this, face);
}
FaceAroundFaceCirculator faces(FaceHandle face) const {
return FaceAroundFaceCirculator(this, face);
}
// TODO 还可以添加很多其他种类的Circulator, 不过上面的比较常用
private:
};
}
}