58 std::deque<TriType> triStore;
59 std::vector<TriType*> tris;
64 triStore.emplace_back(c0, c1, c2);
65 TriType* newTri = &triStore.back();
74 std::vector<TriType*>& getTris()
79 void remove(TriType* tri)
83 for (
auto it = tris.begin(); it != tris.end(); ++it) {
93 auto* newTri = create(c0, c1, c2);
94 tris.push_back(newTri);
97 void add(std::array<Coordinate, 3>& corner)
99 add(corner[0], corner[1], corner[2]);
105 for (
const auto* tri : tris) {
106 dArea += tri->getArea();
113 double dLength = 0.0;
114 for (
const auto* tri : tris) {
115 dLength += tri->getLength();
122 degree(
const TriType* tri, TriIndex index)
124 const Coordinate& v = tri->getCoordinate(index);
125 std::size_t szDegree = 0;
126 for (
auto* t : *
this) {
127 for (TriIndex i = 0; i < 3; i++) {
128 if (v.equals2D(t->getCoordinate(i)))
137 for (
auto* tri : *
this) {
142 std::unique_ptr<Geometry> toGeometry(
145 std::vector<std::unique_ptr<Geometry>> geoms;
146 for (
auto* tri: tris) {
147 std::unique_ptr<Geometry> geom = tri->toPolygon(geomFact);
148 geoms.emplace_back(geom.release());
153 friend std::ostream& operator << (std::ostream& os,
TriList& triList)
156 os <<
"[" << triList.size() <<
"] (";
157 for (
auto* tri: triList) {
158 os <<
" " << *tri <<
"," << std::endl;
165 typedef typename std::vector<TriType*>::iterator iterator;
166 typedef typename std::vector<TriType*>::const_iterator const_iterator;
167 size_t size()
const {
return tris.size(); }
168 bool empty()
const {
return tris.empty(); }
169 iterator begin() {
return tris.begin(); }
170 iterator end() {
return tris.end(); }
171 const_iterator begin()
const {
return tris.begin(); }
172 const_iterator end()
const {
return tris.end(); }
173 TriType* operator [] (std::size_t index) {
return tris[index]; }