21 typedef gsEigen::Vector<real_t,3> Point;
22 typedef gsEigen::Vector<float,2> Vec2f;
32 EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(gismo::Point)
33 EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(gismo::Vec2f)
36 #include <gsMesh2/gsProperty.h>
50 typedef gismo::Point Point;
54 typedef gsEigen::Vector<Scalar,3>
Vec3;
68 int idx()
const {
return idx_; }
78 return idx_ == _rhs.idx_;
83 return idx_ != _rhs.idx_;
88 return idx_ < _rhs.idx_;
107 std::ostream& operator<<(std::ostream& os)
const {
return os <<
'v' << idx(); }
192 return gsProperty<T>::operator[](v.
idx());
198 return gsProperty<T>::operator[](v.
idx());
216 return gsProperty<T>::operator[](h.
idx());
222 return gsProperty<T>::operator[](h.
idx());
235 explicit Edge_property(gsProperty<T> p) : gsProperty<T>(p) {}
240 return gsProperty<T>::operator[](e.
idx());
246 return gsProperty<T>::operator[](e.
idx());
259 explicit Face_property(gsProperty<T> p) : gsProperty<T>(p) {}
264 return gsProperty<T>::operator[](f.
idx());
270 return gsProperty<T>::operator[](f.
idx());
283 explicit Mesh_property(gsProperty<T> p) : gsProperty<T>(p) {}
288 return gsProperty<T>::operator[](idx);
292 typename gsProperty<T>::const_reference
operator[](
size_t idx)
const
294 return gsProperty<T>::operator[](idx);
312 if (mesh_ && mesh_->garbage())
while (mesh_->is_valid(hnd_) && mesh_->is_deleted(hnd_)) ++hnd_.idx_;
318 const Vertex * operator->()
const {
return &hnd_; }
321 size_t operator-(
const Vertex_iterator& rhs)
const
324 return (hnd_.idx_ - rhs.hnd_.idx_);
328 Vertex_iterator& operator+=(
const size_t i)
338 return (hnd_==rhs.hnd_);
344 return (hnd_<rhs.hnd_);
350 return !operator==(rhs);
358 while (mesh_->garbage() && mesh_->is_valid(hnd_) && mesh_->is_deleted(hnd_)) ++hnd_.idx_;
367 while (mesh_->garbage() && mesh_->is_valid(hnd_) && mesh_->is_deleted(hnd_)) --hnd_.idx_;
387 if (mesh_ && mesh_->garbage())
while (mesh_->is_valid(hnd_) && mesh_->is_deleted(hnd_)) ++hnd_.idx_;
393 const Halfedge * operator->()
const {
return &hnd_; }
398 return (hnd_==rhs.hnd_);
404 return !operator==(rhs);
412 while (mesh_->garbage() && mesh_->is_valid(hnd_) && mesh_->is_deleted(hnd_)) ++hnd_.idx_;
421 while (mesh_->garbage() && mesh_->is_valid(hnd_) && mesh_->is_deleted(hnd_)) --hnd_.idx_;
441 if (mesh_ && mesh_->garbage())
while (mesh_->is_valid(hnd_) && mesh_->is_deleted(hnd_)) ++hnd_.idx_;
447 const Edge * operator->()
const {
return &hnd_; }
452 return (hnd_==rhs.hnd_);
458 return !operator==(rhs);
466 while (mesh_->garbage() && mesh_->is_valid(hnd_) && mesh_->is_deleted(hnd_)) ++hnd_.idx_;
475 while (mesh_->garbage() && mesh_->is_valid(hnd_) && mesh_->is_deleted(hnd_)) --hnd_.idx_;
495 if (mesh_ && mesh_->garbage())
while (mesh_->is_valid(hnd_) && mesh_->is_deleted(hnd_)) ++hnd_.idx_;
501 const Face * operator->()
const {
return &hnd_; }
504 size_t operator-(
const Face_iterator& rhs)
const
507 return (hnd_.idx_ - rhs.hnd_.idx_);
511 Face_iterator& operator+=(
const size_t i)
521 return (hnd_==rhs.hnd_);
527 return (hnd_<rhs.hnd_);
533 return !operator==(rhs);
541 while (mesh_->garbage() && mesh_->is_valid(hnd_) && mesh_->is_deleted(hnd_)) ++hnd_.idx_;
550 while (mesh_->garbage() && mesh_->is_valid(hnd_) && mesh_->is_deleted(hnd_)) --hnd_.idx_;
636 : mesh_(m), active_(true)
638 if (mesh_) halfedge_ = mesh_->halfedge(v);
645 return (active_ && (mesh_==rhs.mesh_) && (halfedge_==rhs.halfedge_));
651 return !operator==(rhs);
658 halfedge_ = mesh_->ccw_rotated_halfedge(halfedge_);
667 halfedge_ = mesh_->cw_rotated_halfedge(halfedge_);
675 return mesh_->to_vertex(halfedge_);
679 operator bool()
const {
return halfedge_.is_valid(); }
687 Vertex_around_vertex_circulator& end() { active_=
true;
return *
this; }
690 const gsSurfMesh* mesh_;
706 : mesh_(m), active_(true)
708 if (mesh_) halfedge_ = mesh_->halfedge(v);
715 return (active_ && (mesh_==rhs.mesh_) && (halfedge_==rhs.halfedge_));
721 return !operator==(rhs);
728 halfedge_ = mesh_->ccw_rotated_halfedge(halfedge_);
737 halfedge_ = mesh_->cw_rotated_halfedge(halfedge_);
744 const Halfedge * operator->()
const {
return &halfedge_; }
747 operator bool()
const {
return halfedge_.
is_valid(); }
752 Halfedge_around_vertex_circulator& end() { active_=
true;
return *
this; }
755 const gsSurfMesh* mesh_;
771 : mesh_(m), active_(true)
775 halfedge_ = mesh_->halfedge(v);
776 if (halfedge_.is_valid() && mesh_->is_boundary(halfedge_))
785 return (active_ && (mesh_==rhs.mesh_) && (halfedge_==rhs.halfedge_));
791 return !operator==(rhs);
797 assert(mesh_ && halfedge_.is_valid());
799 halfedge_ = mesh_->ccw_rotated_halfedge(halfedge_);
800 }
while (mesh_->is_boundary(halfedge_));
808 assert(mesh_ && halfedge_.is_valid());
810 halfedge_ = mesh_->cw_rotated_halfedge(halfedge_);
811 while (mesh_->is_boundary(halfedge_));
818 assert(mesh_ && halfedge_.is_valid());
819 return mesh_->face(halfedge_);
823 operator bool()
const {
return halfedge_.
is_valid(); }
828 Face_around_vertex_circulator& end() { active_=
true;
return *
this; }
831 const gsSurfMesh* mesh_;
847 : mesh_(m), active_(true)
849 if (mesh_) halfedge_ = mesh_->halfedge(f);
856 return (active_ && (mesh_==rhs.mesh_) && (halfedge_==rhs.halfedge_));
862 return !operator==(rhs);
868 assert(mesh_ && halfedge_.is_valid());
869 halfedge_ = mesh_->next_halfedge(halfedge_);
877 assert(mesh_ && halfedge_.is_valid());
878 halfedge_ = mesh_->prev_halfedge(halfedge_);
885 assert(mesh_ && halfedge_.is_valid());
886 return mesh_->to_vertex(halfedge_);
892 assert(mesh_ && halfedge_.is_valid());
899 Vertex_around_face_circulator& end() { active_=
true;
return *
this; }
902 const gsSurfMesh* mesh_;
918 : mesh_(m), active_(true)
920 if (mesh_) halfedge_ = mesh_->halfedge(f);
927 return (active_ && (mesh_==rhs.mesh_) && (halfedge_==rhs.halfedge_));
933 return !operator==(rhs);
939 assert(mesh_ && halfedge_.is_valid());
940 halfedge_ = mesh_->next_halfedge(halfedge_);
948 assert(mesh_ && halfedge_.is_valid());
949 halfedge_ = mesh_->prev_halfedge(halfedge_);
956 const Halfedge * operator->()
const {
return &halfedge_; }
959 Halfedge_around_face_circulator& begin() { active_=
false;
return *
this; }
961 Halfedge_around_face_circulator& end() { active_=
true;
return *
this; }
964 const gsSurfMesh* mesh_;
981 gsSurfMesh(
const gsMatrix<Scalar> & pts);
984 virtual ~gsSurfMesh();
1007 bool read(
const std::string& filename);
1011 bool write(
const std::string& filename)
const;
1024 Vertex add_vertex(
const Point& p);
1028 Face add_face(
const std::vector<Vertex>& vertices);
1032 Face add_triangle(Vertex v1, Vertex v2, Vertex v3);
1036 Face add_quad(Vertex v1, Vertex v2, Vertex v3, Vertex v4);
1053 unsigned int edges_size()
const {
return (
unsigned int) eprops_.size(); }
1055 unsigned int faces_size()
const {
return (
unsigned int) fprops_.size(); }
1059 unsigned int n_vertices()
const {
return vertices_size() - deleted_vertices_; }
1061 unsigned int n_halfedges()
const {
return halfedges_size() - 2*deleted_edges_; }
1063 unsigned int n_edges()
const {
return edges_size() - deleted_edges_; }
1065 unsigned int n_faces()
const {
return faces_size() - deleted_faces_; }
1069 unsigned int empty()
const {
return n_vertices() == 0; }
1079 void reserve(
unsigned int nvertices,
1080 unsigned int nedges,
1081 unsigned int nfaces );
1085 void garbage_collection();
1092 return vdeleted_[v];
1098 return edeleted_[edge(h)];
1104 return edeleted_[e];
1110 return fdeleted_[f];
1117 return (0 <= v.
idx()) && (v.
idx() < (int)vertices_size());
1122 return (0 <= h.
idx()) && (h.
idx() < (int)halfedges_size());
1127 return (0 <= e.
idx()) && (e.
idx() < (int)edges_size());
1132 return (0 <= f.
idx()) && (f.
idx() < (int)faces_size());
1149 return vconn_[v].halfedge_;
1155 vconn_[v].halfedge_ = h;
1162 return (!(h.
is_valid() && face(h).is_valid()));
1168 return !halfedge(v).is_valid();
1180 if (is_boundary(*hit))
1183 while (++hit!=hend);
1190 return hconn_[h].vertex_;
1196 return to_vertex(opposite_halfedge(h));
1202 hconn_[h].vertex_ = v;
1208 return hconn_[h].face_;
1214 hconn_[h].face_ = f;
1220 return hconn_[h].next_halfedge_;
1226 hconn_[h].next_halfedge_ = nh;
1227 hconn_[nh].prev_halfedge_ = h;
1233 return hconn_[h].prev_halfedge_;
1246 return opposite_halfedge(prev_halfedge(h));
1253 return next_halfedge(opposite_halfedge(h));
1265 return !face(h).is_valid();
1271 return is_boundary(opposite_halfedge(h));
1285 return to_vertex(halfedge(e, i));
1292 return face(halfedge(e, i));
1299 return (is_boundary(halfedge(e, 0)) || is_boundary(halfedge(e, 1)));
1305 return fconn_[f].halfedge_;
1311 fconn_[f].halfedge_ = h;
1321 if (is_boundary(opposite_halfedge(h)))
1323 h = next_halfedge(h);
1441 std::string newname)
1443 vprops_.rename(p,
give(newname));
1448 const std::string & name2)
1450 vprops_.swap(name1,name2);
1484 return vprops_.get_type(name);
1490 return hprops_.get_type(name);
1496 return eprops_.get_type(name);
1502 return fprops_.get_type(name);
1508 return mprops_.get_type(name);
1515 return vprops_.properties();
1520 return hprops_.properties();
1525 return eprops_.properties();
1530 return fprops_.properties();
1535 return mprops_.properties();
1539 void property_stats()
const;
1667 bool is_triangle_mesh()
const;
1671 bool is_quad_mesh()
const;
1679 void triangulate(Face f);
1684 bool is_collapse_ok(Halfedge h);
1696 void collapse(Halfedge h);
1710 void split(Face f, Vertex v);
1716 void quad_split(Face f, Vertex v, Halfedge s);
1738 Halfedge split(Edge e, Vertex v);
1750 return insert_vertex(halfedge(e,0), add_vertex(p));
1761 return insert_vertex(halfedge(e,0), v);
1770 Halfedge insert_vertex(Halfedge h, Vertex v);
1776 Halfedge insert_edge(Halfedge h0, Halfedge h1);
1783 bool is_flip_ok(Edge e)
const;
1795 unsigned int valence(Vertex v)
const;
1798 unsigned int valence(Face f)
const;
1801 unsigned int face_valence_sum()
const;
1804 Halfedge find_halfedge(Vertex start, Vertex end)
const;
1807 Edge find_edge(Vertex a, Vertex b)
const;
1810 void delete_vertex(Vertex v);
1813 void delete_edge(Edge e);
1816 void delete_face(Face f);
1833 std::vector<Point>&
points() {
return vpoint_.vector(); }
1836 void update_face_normals();
1839 Normal compute_face_normal(Face f)
const;
1842 void update_vertex_normals();
1845 Normal compute_vertex_normal(Vertex v)
const;
1848 Scalar edge_length(Edge e)
const;
1860 vprops_.push_back();
1861 return Vertex(vertices_size()-1);
1867 assert(start != end);
1869 eprops_.push_back();
1870 hprops_.push_back();
1871 hprops_.push_back();
1876 set_vertex(h0, end);
1877 set_vertex(h1, start);
1885 fprops_.push_back();
1886 return Face(faces_size()-1);
1889 friend std::ostream& operator<<(std::ostream& os,
const gsSurfMesh & sm)
1892 " edges and "<<sm.
n_faces()<<
" faces.\n";
1899 void cc_subdivide();
1902 Vertex_property<Point> cc_limit_points(std::string label =
"v:limit");
1905 Vertex_property<Point> cc_limit_normals(std::string label =
"v:normal",
1906 bool normalize =
true);
1909 Vertex_property<Point> cc_limit_tangent_vec(std::string label =
"v:tanvec",
1910 bool normalize =
true);
1913 gsMultiPatch<real_t> cc_acc3(
bool comp_topology =
false)
const;
1916 gsMultiPatch<real_t> linear_patches()
const;
1922 void adjust_outgoing_halfedge(Vertex v);
1925 void remove_edge(Halfedge h);
1928 void remove_loop(Halfedge h);
1935 friend bool GISMO_EXPORT read_poly(
gsSurfMesh& mesh,
const std::string& filename);
1937 gsProperty_container vprops_;
1938 gsProperty_container hprops_;
1939 gsProperty_container eprops_;
1940 gsProperty_container fprops_;
1941 gsProperty_container mprops_;
1943 Vertex_property<Vertex_connectivity> vconn_;
1944 Halfedge_property<Halfedge_connectivity> hconn_;
1945 Face_property<Face_connectivity> fconn_;
1947 Vertex_property<bool> vdeleted_;
1948 Edge_property<bool> edeleted_;
1949 Face_property<bool> fdeleted_;
1951 Vertex_property<Point> vpoint_;
1952 Vertex_property<Normal> vnormal_;
1953 Face_property<Normal> fnormal_;
1955 unsigned int deleted_vertices_;
1956 unsigned int deleted_edges_;
1957 unsigned int deleted_faces_;
1961 typedef std::pair<Halfedge, Halfedge> NextCacheEntry;
1962 typedef std::vector<NextCacheEntry> NextCache;
1963 std::vector<Vertex> add_face_vertices_;
1964 std::vector<Halfedge> add_face_halfedges_;
1965 std::vector<bool> add_face_is_new_;
1966 std::vector<bool> add_face_needs_adjust_;
1967 NextCache add_face_next_cache_;
1974 inline std::ostream& operator<<(std::ostream& os, gsSurfMesh::Vertex v)
1976 return (os <<
'v' << v.idx());
1979 inline std::ostream&
operator<<(std::ostream& os, gsSurfMesh::Halfedge h)
1981 return (os <<
'h' << h.idx());
1984 inline std::ostream&
operator<<(std::ostream& os, gsSurfMesh::Edge e)
1986 return (os <<
'e' << e.idx());
1989 inline std::ostream&
operator<<(std::ostream& os, gsSurfMesh::Face f)
1991 return (os <<
'f' << f.idx());
2000 class GISMO_EXPORT gsXml<gsSurfMesh>
2005 GSXML_COMMON_FUNCTIONS(gsSurfMesh)
2006 GSXML_GET_POINTER(gsSurfMesh)
2007 static std::
string tag () {
return "Mesh"; }
2008 static std::string type() {
return "off"; }
2010 static void get_into(gsXmlNode * node, gsSurfMesh & result);
2011 static gsXmlNode * put (
const gsSurfMesh & obj, gsXmlTree & data);
Edge_property< T > add_edge_property(const std::string &name, T t=T())
Definition: gsSurfMesh.h:1356
const std::type_info & get_mesh_property_type(const std::string &name)
Definition: gsSurfMesh.h:1506
void reset()
reset handle to be invalid (index=-1)
Definition: gsSurfMesh.h:71
Vertex(int _idx=-1)
default constructor (with invalid index)
Definition: gsSurfMesh.h:106
Vertex operator*() const
get the vertex the iterator refers to
Definition: gsSurfMesh.h:316
Edge(int _idx=-1)
default constructor (with invalid index)
Definition: gsSurfMesh.h:125
bool operator<(const Base_handle &_rhs) const
compare operator useful for sorting handles
Definition: gsSurfMesh.h:87
std::vector< std::string > vertex_properties() const
returns the names of all vertex properties
Definition: gsSurfMesh.h:1513
Halfedge opposite_halfedge(Halfedge h) const
returns the opposite halfedge of h
Definition: gsSurfMesh.h:1237
void remove_mesh_property(Mesh_property< T > &p)
remove the mesh property p
Definition: gsSurfMesh.h:1474
Definition: gsSurfMesh.h:581
real_t Scalar
Scalar type.
Definition: gsSurfMesh.h:49
bool operator==(const Face_iterator &rhs) const
are two iterators equal?
Definition: gsSurfMesh.h:519
bool operator==(const Face_around_vertex_circulator &rhs) const
are two circulators equal?
Definition: gsSurfMesh.h:782
Face_around_vertex_circulator & operator++()
pre-increment (rotates counter-clockwise)
Definition: gsSurfMesh.h:795
void swap_vertex_property(const std::string &name1, const std::string &name2)
swaps (the values of) two vertex properties of the same type
Definition: gsSurfMesh.h:1447
gsProperty< T >::reference operator[](Halfedge h)
access the data stored for halfedge h
Definition: gsSurfMesh.h:214
Halfedge prev_halfedge(Halfedge h) const
returns the previous halfedge within the incident face
Definition: gsSurfMesh.h:1231
Face_iterator & operator++()
pre-increment iterator
Definition: gsSurfMesh.h:537
Definition: gsSurfMesh.h:253
Face face_
face incident to halfedge
Definition: gsSurfMesh.h:156
Face operator*() const
get the face the iterator refers to
Definition: gsSurfMesh.h:499
unsigned int empty() const
returns true iff the mesh is empty, i.e., has no vertices
Definition: gsSurfMesh.h:1069
Face_around_vertex_circulator faces(Vertex v) const
returns circulator for faces around vertex v
Definition: gsSurfMesh.h:1636
Halfedge halfedge_
an outgoing halfedge per vertex (it will be a bounday halfedge for boundary vertices) ...
Definition: gsSurfMesh.h:147
std::vector< std::string > edge_properties() const
returns the names of all edge properties
Definition: gsSurfMesh.h:1523
bool is_valid() const
return whether the handle is valid, i.e., the index is not equal to -1.
Definition: gsSurfMesh.h:74
bool operator!=(const Vertex_around_face_circulator &rhs) const
are two circulators different?
Definition: gsSurfMesh.h:860
Halfedge_iterator halfedges_end() const
returns end iterator for halfedges
Definition: gsSurfMesh.h:1576
bool operator!=(const Edge_iterator &rhs) const
are two iterators different?
Definition: gsSurfMesh.h:456
bool operator==(const Vertex_around_face_circulator &rhs) const
are two circulators equal?
Definition: gsSurfMesh.h:853
Halfedge operator*() const
get the halfedge the circulator refers to
Definition: gsSurfMesh.h:742
bool operator==(const Base_handle &_rhs) const
are two handles equal?
Definition: gsSurfMesh.h:77
bool is_isolated(Vertex v) const
returns whether v is isolated, i.e., not incident to any face
Definition: gsSurfMesh.h:1166
Face_property< T > add_face_property(const std::string &name, const T t=T())
Definition: gsSurfMesh.h:1363
bool is_deleted(Face f) const
Definition: gsSurfMesh.h:1108
Definition: gsSurfMesh.h:168
Halfedge_around_face_circulator & operator++()
pre-increment (rotates counter-clockwise)
Definition: gsSurfMesh.h:937
Edge operator*() const
get the edge the iterator refers to
Definition: gsSurfMesh.h:445
bool operator==(const Halfedge_around_face_circulator &rhs) const
are two circulators equal?
Definition: gsSurfMesh.h:924
Vertex_container vertices() const
returns vertex container for C++11 range-based for-loops
Definition: gsSurfMesh.h:1564
Definition: gsSurfMesh.h:596
Halfedge halfedge_
a halfedge that is part of the face
Definition: gsSurfMesh.h:171
Vertex_around_vertex_circulator & operator--()
pre-decrement (rotate clockwise)
Definition: gsSurfMesh.h:664
bool operator<(const Face_iterator &rhs) const
how do two iterators compare?
Definition: gsSurfMesh.h:525
void rename_vertex_property(Vertex_property< T > &p, std::string newname)
rename the vertex property p
Definition: gsSurfMesh.h:1440
Halfedge_around_vertex_circulator halfedges(Vertex v) const
returns circulator for outgoing halfedges around vertex v
Definition: gsSurfMesh.h:1630
Definition: gsSurfMesh.h:205
Halfedge_iterator & operator++()
pre-increment iterator
Definition: gsSurfMesh.h:408
bool operator==(const Vertex_around_vertex_circulator &rhs) const
are two circulators equal?
Definition: gsSurfMesh.h:642
bool operator==(const Edge_iterator &rhs) const
are two iterators equal?
Definition: gsSurfMesh.h:450
Halfedge insert_vertex(Edge e, Vertex v)
Definition: gsSurfMesh.h:1759
Definition: gsSurfMesh.h:60
Base_handle(int _idx=-1)
constructor
Definition: gsSurfMesh.h:65
Edge_container edges() const
returns edge container for C++11 range-based for-loops
Definition: gsSurfMesh.h:1600
Definition: gsSurfMesh.h:841
S give(S &x)
Definition: gsMemory.h:266
Mesh_property< T > get_mesh_property(const std::string &name) const
Definition: gsSurfMesh.h:1401
bool operator!=(const Face_around_vertex_circulator &rhs) const
are two circulators different?
Definition: gsSurfMesh.h:789
Vertex_property< T > vertex_property(const std::string &name, const T t=T())
Definition: gsSurfMesh.h:1409
Point & position(Vertex v)
position of a vertex
Definition: gsSurfMesh.h:1830
bool is_valid(Vertex v) const
return whether vertex v is valid, i.e. the index it stores is within the array bounds.
Definition: gsSurfMesh.h:1115
unsigned int n_faces() const
returns number of faces in the mesh
Definition: gsSurfMesh.h:1065
bool is_boundary(Vertex v) const
returns whether v is a boundary vertex
Definition: gsSurfMesh.h:1159
Definition: gsSurfMesh.h:566
std::vector< std::string > mesh_properties() const
returns the names of all mesh properties
Definition: gsSurfMesh.h:1533
Definition: gsSurfMesh.h:131
Edge_iterator(Edge e=Edge(), const gsSurfMesh *m=NULL)
Default constructor.
Definition: gsSurfMesh.h:439
const std::type_info & get_edge_property_type(const std::string &name)
Definition: gsSurfMesh.h:1494
gsProperty< T >::reference operator[](size_t idx)
access the data stored for the mesh
Definition: gsSurfMesh.h:286
Definition: gsSurfMesh.h:305
Face new_face()
allocate a new face, resize face properties accordingly.
Definition: gsSurfMesh.h:1883
Vertex_iterator vertices_begin() const
returns start iterator for vertices
Definition: gsSurfMesh.h:1552
bool operator==(const Halfedge_around_vertex_circulator &rhs) const
are two circulators equal?
Definition: gsSurfMesh.h:712
bool operator!=(const Halfedge_around_vertex_circulator &rhs) const
are two circulators different?
Definition: gsSurfMesh.h:719
Halfedge insert_vertex(Edge e, const Point &p)
Definition: gsSurfMesh.h:1748
Definition: gsSurfMesh.h:434
Edge_iterator & operator++()
pre-increment iterator
Definition: gsSurfMesh.h:462
Halfedge halfedge() const
return current halfedge
Definition: gsSurfMesh.h:682
A halfedge data structure for polygonal meshes.
Definition: gsSurfMesh.h:45
std::vector< std::string > halfedge_properties() const
returns the names of all halfedge properties
Definition: gsSurfMesh.h:1518
bool operator<(const Vertex_iterator &rhs) const
how do two iterators compare?
Definition: gsSurfMesh.h:342
Halfedge_iterator halfedges_begin() const
returns start iterator for halfedges
Definition: gsSurfMesh.h:1570
Definition: gsSurfMesh.h:181
Face_iterator(Face f=Face(), const gsSurfMesh *m=NULL)
Default constructor.
Definition: gsSurfMesh.h:493
Point Texture_coordinate
Texture coordinate type.
Definition: gsSurfMesh.h:28
void set_halfedge(Face f, Halfedge h)
sets the halfedge of face f to h
Definition: gsSurfMesh.h:1309
std::ostream & operator<<(std::ostream &os, const _expr< E > &b)
Stream operator for expressions.
Definition: gsExpressions.h:382
const std::type_info & get_vertex_property_type(const std::string &name)
Definition: gsSurfMesh.h:1482
Mesh_property< T > mesh_property(const std::string &name, const T t=T())
Definition: gsSurfMesh.h:1434
Vertex from_vertex(Halfedge h) const
returns the vertex the halfedge h emanates from
Definition: gsSurfMesh.h:1194
gsProperty< T >::const_reference operator[](Vertex v) const
access the data stored for vertex v
Definition: gsSurfMesh.h:196
Vertex_around_vertex_circulator vertices(Vertex v) const
returns circulator for vertices around vertex v
Definition: gsSurfMesh.h:1624
void set_next_halfedge(Halfedge h, Halfedge nh)
sets the next halfedge of h within the face to nh
Definition: gsSurfMesh.h:1224
Point Normal
Normal type.
Definition: gsSurfMesh.h:24
Halfedge split(Edge e, const Point &p)
Definition: gsSurfMesh.h:1727
Halfedge cw_rotated_halfedge(Halfedge h) const
Definition: gsSurfMesh.h:1251
Definition: gsSurfMesh.h:144
Halfedge ccw_rotated_halfedge(Halfedge h) const
Definition: gsSurfMesh.h:1244
Vertex operator*() const
get the vertex the circulator refers to
Definition: gsSurfMesh.h:672
Face_iterator faces_begin() const
returns start iterator for faces
Definition: gsSurfMesh.h:1606
gsProperty< T >::reference operator[](Vertex v)
access the data stored for vertex v
Definition: gsSurfMesh.h:190
const std::type_info & get_face_property_type(const std::string &name)
Definition: gsSurfMesh.h:1500
Face(int _idx=-1)
default constructor (with invalid index)
Definition: gsSurfMesh.h:134
Definition: gsSurfMesh.h:700
Vertex_iterator & operator--()
pre-decrement iterator
Definition: gsSurfMesh.h:363
unsigned int n_halfedges() const
returns number of halfedge in the mesh
Definition: gsSurfMesh.h:1061
bool operator==(const Vertex_iterator &rhs) const
are two iterators equal?
Definition: gsSurfMesh.h:336
bool garbage() const
are there deleted vertices, edges or faces?
Definition: gsSurfMesh.h:1931
Halfedge_property< T > halfedge_property(const std::string &name, T t=T())
Definition: gsSurfMesh.h:1415
Halfedge_iterator & operator--()
pre-decrement iterator
Definition: gsSurfMesh.h:417
Vertex_around_face_circulator & operator--()
pre-decrement (rotates clockwise)
Definition: gsSurfMesh.h:875
unsigned int n_vertices() const
returns number of vertices in the mesh
Definition: gsSurfMesh.h:1059
std::vector< Point > & points()
vector of vertex positions
Definition: gsSurfMesh.h:1833
Vertex_around_face_circulator vertices(Face f) const
returns circulator for vertices of face f
Definition: gsSurfMesh.h:1642
Halfedge_container halfedges() const
returns halfedge container for C++11 range-based for-loops
Definition: gsSurfMesh.h:1582
Definition: gsSurfMesh.h:488
Vertex_iterator(Vertex v=Vertex(), const gsSurfMesh *m=NULL)
Default constructor.
Definition: gsSurfMesh.h:310
bool operator==(const Halfedge_iterator &rhs) const
are two iterators equal?
Definition: gsSurfMesh.h:396
Halfedge_around_face_circulator & operator--()
pre-decrement (rotates clockwise)
Definition: gsSurfMesh.h:946
Halfedge halfedge(Edge e, unsigned int i) const
returns the i'th halfedge of edge e. i has to be 0 or 1.
Definition: gsSurfMesh.h:1275
Definition: gsSurfMesh.h:122
void remove_halfedge_property(Halfedge_property< T > &p)
remove the halfedge property p
Definition: gsSurfMesh.h:1459
bool operator!=(const Halfedge_around_face_circulator &rhs) const
are two circulators different?
Definition: gsSurfMesh.h:931
Halfedge he() const
get the halfedge the circulator refers to
Definition: gsSurfMesh.h:890
Halfedge halfedge(Vertex v) const
Definition: gsSurfMesh.h:1147
void remove_vertex_property(Vertex_property< T > &p)
remove the vertex property p
Definition: gsSurfMesh.h:1454
bool operator!=(const Vertex_iterator &rhs) const
are two iterators different?
Definition: gsSurfMesh.h:348
Edge edge(Halfedge h) const
return the edge that contains halfedge h as one of its two halfedges.
Definition: gsSurfMesh.h:1257
Vertex_property< T > get_vertex_property(const std::string &name) const
Definition: gsSurfMesh.h:1377
void remove_edge_property(Edge_property< T > &p)
remove the edge property p
Definition: gsSurfMesh.h:1464
gsProperty< T >::const_reference operator[](Face f) const
access the data stored for face f
Definition: gsSurfMesh.h:268
Vertex vertex(Edge e, unsigned int i) const
returns the i'th vertex of edge e. i has to be 0 or 1.
Definition: gsSurfMesh.h:1282
gsProperty< T >::const_reference operator[](size_t idx) const
access the data stored for the mesh
Definition: gsSurfMesh.h:292
Halfedge_property< T > get_halfedge_property(const std::string &name) const
Definition: gsSurfMesh.h:1383
Definition: gsSurfMesh.h:912
Face_property< T > face_property(const std::string &name, const T t=T())
Definition: gsSurfMesh.h:1427
Face_property< T > get_face_property(const std::string &name) const
Definition: gsSurfMesh.h:1395
Edge_iterator edges_begin() const
returns start iterator for edges
Definition: gsSurfMesh.h:1588
Halfedge_property< T > add_halfedge_property(const std::string &name, T t=T())
Definition: gsSurfMesh.h:1349
Halfedge next_halfedge_
next halfedge within a face (or along a boundary)
Definition: gsSurfMesh.h:160
Definition: gsSurfMesh.h:229
void set_vertex(Halfedge h, Vertex v)
sets the vertex the halfedge h points to to v
Definition: gsSurfMesh.h:1200
bool is_deleted(Halfedge h) const
Definition: gsSurfMesh.h:1096
Edge_iterator & operator--()
pre-decrement iterator
Definition: gsSurfMesh.h:471
Halfedge_around_face_circulator halfedges(Face f) const
returns circulator for halfedges of face f
Definition: gsSurfMesh.h:1648
Definition: gsSurfMesh.h:765
Mesh_property()
default constructor
Definition: gsSurfMesh.h:282
Vertex split(Face f, const Point &p)
Definition: gsSurfMesh.h:1704
Vertex operator*() const
get the vertex the circulator refers to
Definition: gsSurfMesh.h:883
bool operator!=(const Base_handle &_rhs) const
are two handles different?
Definition: gsSurfMesh.h:82
Face operator*() const
get the face the circulator refers to
Definition: gsSurfMesh.h:816
void remove_face_property(Face_property< T > &p)
remove the face property p
Definition: gsSurfMesh.h:1469
Halfedge halfedge(Face f) const
returns a halfedge of face f
Definition: gsSurfMesh.h:1303
Halfedge new_edge(Vertex start, Vertex end)
allocate a new edge, resize edge and halfedge properties accordingly.
Definition: gsSurfMesh.h:1865
const std::type_info & get_halfedge_property_type(const std::string &name)
Definition: gsSurfMesh.h:1488
Halfedge prev_halfedge_
previous halfedge within a face (or along a boundary)
Definition: gsSurfMesh.h:162
gsProperty< T >::reference operator[](Face f)
access the data stored for face f
Definition: gsSurfMesh.h:262
Halfedge_iterator(Halfedge h=Halfedge(), const gsSurfMesh *m=NULL)
Default constructor.
Definition: gsSurfMesh.h:385
Definition: gsSurfMesh.h:611
gsEigen::Vector< Scalar, 3 > Vec3
3D vector type
Definition: gsSurfMesh.h:54
void set_face(Halfedge h, Face f)
sets the incident face to halfedge h to f
Definition: gsSurfMesh.h:1212
bool operator!=(const Face_iterator &rhs) const
are two iterators different?
Definition: gsSurfMesh.h:531
gsSurfMesh(const gsSurfMesh &rhs)
copy constructor: copies rhs to *this. performs a deep copy of all properties.
Definition: gsSurfMesh.h:987
const Point & position(Vertex v) const
position of a vertex (read only)
Definition: gsSurfMesh.h:1827
gsProperty< T >::reference operator[](Edge e)
access the data stored for edge e
Definition: gsSurfMesh.h:238
Vertex_property< T > add_vertex_property(const std::string &name, T t=T())
Definition: gsSurfMesh.h:1342
Face_property()
default constructor
Definition: gsSurfMesh.h:258
bool is_manifold(Vertex v) const
returns whether v is a manifold vertex (not incident to several patches)
Definition: gsSurfMesh.h:1172
unsigned int faces_size() const
returns number of (deleted and valid)faces in the mesh
Definition: gsSurfMesh.h:1055
bool touches_boundary(Halfedge h) const
returns whether h touches the boundary, i.e., its opposite is a boundary halfedge.
Definition: gsSurfMesh.h:1269
unsigned int vertices_size() const
returns number of (deleted and valid) vertices in the mesh
Definition: gsSurfMesh.h:1049
Halfedge(int _idx=-1)
default constructor (with invalid index)
Definition: gsSurfMesh.h:116
Face face(Edge e, unsigned int i) const
returns the face incident to the i'th halfedge of edge e. i has to be 0 or 1.
Definition: gsSurfMesh.h:1289
unsigned int halfedges_size() const
returns number of (deleted and valid)halfedge in the mesh
Definition: gsSurfMesh.h:1051
Halfedge_around_vertex_circulator & operator--()
pre-decrement (rotate clockwise)
Definition: gsSurfMesh.h:734
void set_halfedge(Vertex v, Halfedge h)
set the outgoing halfedge of vertex v to h
Definition: gsSurfMesh.h:1153
Face_around_vertex_circulator & operator--()
pre-decrement (rotate clockwise)
Definition: gsSurfMesh.h:806
bool operator!=(const Vertex_around_vertex_circulator &rhs) const
are two circulators different?
Definition: gsSurfMesh.h:649
Halfedge operator*() const
get the halfedge the circulator refers to
Definition: gsSurfMesh.h:954
bool is_valid(Face f) const
return whether face f is valid, i.e. the index it stores is within the array bounds.
Definition: gsSurfMesh.h:1130
This is the main header file that collects wrappers of Eigen for linear algebra.
Halfedge operator*() const
get the halfedge the iterator refers to
Definition: gsSurfMesh.h:391
bool is_boundary(Edge e) const
Definition: gsSurfMesh.h:1297
bool is_valid(Edge e) const
return whether edge e is valid, i.e. the index it stores is within the array bounds.
Definition: gsSurfMesh.h:1125
Vertex_iterator & operator++()
pre-increment iterator
Definition: gsSurfMesh.h:354
Definition: gsSurfMesh.h:277
Face face(Halfedge h) const
returns the face incident to halfedge h
Definition: gsSurfMesh.h:1206
Definition: gsSurfMesh.h:630
Halfedge_property()
default constructor
Definition: gsSurfMesh.h:210
gsProperty< T >::const_reference operator[](Edge e) const
access the data stored for edge e
Definition: gsSurfMesh.h:244
gsProperty< T >::const_reference operator[](Halfedge h) const
access the data stored for halfedge h
Definition: gsSurfMesh.h:220
Edge_property< T > get_edge_property(const std::string &name) const
Definition: gsSurfMesh.h:1389
bool is_boundary(Halfedge h) const
returns whether h is a boundary halfege, i.e., if its face does not exist.
Definition: gsSurfMesh.h:1263
Edge_iterator edges_end() const
returns end iterator for edges
Definition: gsSurfMesh.h:1594
Vertex new_vertex()
allocate a new vertex, resize vertex properties accordingly.
Definition: gsSurfMesh.h:1858
Face_container faces() const
returns face container for C++11 range-based for-loops
Definition: gsSurfMesh.h:1618
Halfedge_around_vertex_circulator & operator++()
pre-increment (rotate couter-clockwise)
Definition: gsSurfMesh.h:725
Halfedge next_halfedge(Halfedge h) const
returns the next halfedge within the incident face
Definition: gsSurfMesh.h:1218
Definition: gsSurfMesh.h:153
Vertex_around_face_circulator & operator++()
pre-increment (rotates counter-clockwise)
Definition: gsSurfMesh.h:866
Vertex_around_vertex_circulator & operator++()
pre-increment (rotate couter-clockwise)
Definition: gsSurfMesh.h:655
bool operator!=(const Halfedge_iterator &rhs) const
are two iterators different?
Definition: gsSurfMesh.h:402
Vertex_property()
default constructor
Definition: gsSurfMesh.h:186
Vertex vertex_
vertex the halfedge points to
Definition: gsSurfMesh.h:158
Definition: gsSurfMesh.h:113
unsigned int edges_size() const
returns number of (deleted and valid)edges in the mesh
Definition: gsSurfMesh.h:1053
Face_iterator & operator--()
pre-decrement iterator
Definition: gsSurfMesh.h:546
int idx() const
Get the underlying index of this handle.
Definition: gsSurfMesh.h:68
Face_iterator faces_end() const
returns end iterator for faces
Definition: gsSurfMesh.h:1612
Vertex_iterator vertices_end() const
returns end iterator for vertices
Definition: gsSurfMesh.h:1558
Vertex to_vertex(Halfedge h) const
returns the vertex the halfedge h points to
Definition: gsSurfMesh.h:1188
Mesh_property< T > add_mesh_property(const std::string &name, const T t=T())
Definition: gsSurfMesh.h:1370
bool is_deleted(Edge e) const
Definition: gsSurfMesh.h:1102
Edge_property< T > edge_property(const std::string &name, const T t=T())
Definition: gsSurfMesh.h:1421
Provides declaration of input/output XML utilities struct.
Definition: gsSurfMesh.h:103
bool is_valid(Halfedge h) const
return whether halfedge h is valid, i.e. the index it stores is within the array bounds.
Definition: gsSurfMesh.h:1120
Point Color
Color type.
Definition: gsSurfMesh.h:26
Definition: gsSurfMesh.h:380
Edge_property()
default constructor
Definition: gsSurfMesh.h:234
bool is_boundary(Face f) const
returns whether f is a boundary face, i.e., it one of its edges is a boundary edge.
Definition: gsSurfMesh.h:1315
bool is_deleted(Vertex v) const
Definition: gsSurfMesh.h:1090
unsigned int n_edges() const
returns number of edges in the mesh
Definition: gsSurfMesh.h:1063
std::vector< std::string > face_properties() const
returns the names of all face properties
Definition: gsSurfMesh.h:1528