mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 14:07:43 +00:00
Merge branch 'IfcOpenShell:v0.7.0' into v0.7.0
This commit is contained in:
@@ -268,6 +268,10 @@ IfcGeom::Representation::Triangulation::Triangulation(const BRep& shape_model)
|
|||||||
weld_offset_ += welds.size();
|
weld_offset_ += welds.size();
|
||||||
welds.clear();
|
welds.clear();
|
||||||
|
|
||||||
|
// When welding vertices, vertex coords will be shared among faces so we need to per-shape set
|
||||||
|
// to keep track of which edges were already emitted.
|
||||||
|
std::set<std::pair<int, int>> emitted_edges;
|
||||||
|
|
||||||
int surface_style_id = -1;
|
int surface_style_id = -1;
|
||||||
if (iit->hasStyle()) {
|
if (iit->hasStyle()) {
|
||||||
Material adapter(iit->StylePtr());
|
Material adapter(iit->StylePtr());
|
||||||
@@ -319,7 +323,6 @@ IfcGeom::Representation::Triangulation::Triangulation(const BRep& shape_model)
|
|||||||
// Keep track of the number of times an edge is used
|
// Keep track of the number of times an edge is used
|
||||||
// Manifold edges (i.e. edges used twice) are deemed invisible
|
// Manifold edges (i.e. edges used twice) are deemed invisible
|
||||||
std::map<std::pair<int, int>, int> edgecount;
|
std::map<std::pair<int, int>, int> edgecount;
|
||||||
std::vector<std::pair<int, int> > edges_temp;
|
|
||||||
|
|
||||||
std::vector<gp_XYZ> coords;
|
std::vector<gp_XYZ> coords;
|
||||||
BRepGProp_Face prop(face);
|
BRepGProp_Face prop(face);
|
||||||
@@ -389,15 +392,20 @@ IfcGeom::Representation::Triangulation::Triangulation(const BRep& shape_model)
|
|||||||
_material_ids.push_back(surface_style_id);
|
_material_ids.push_back(surface_style_id);
|
||||||
_item_ids.push_back(iit->ItemId());
|
_item_ids.push_back(iit->ItemId());
|
||||||
|
|
||||||
addEdge(dict[n1], dict[n2], edgecount, edges_temp);
|
addEdge(dict[n1], dict[n2], edgecount);
|
||||||
addEdge(dict[n2], dict[n3], edgecount, edges_temp);
|
addEdge(dict[n2], dict[n3], edgecount);
|
||||||
addEdge(dict[n3], dict[n1], edgecount, edges_temp);
|
addEdge(dict[n3], dict[n1], edgecount);
|
||||||
}
|
}
|
||||||
for (std::vector<std::pair<int, int> >::const_iterator jt = edges_temp.begin(); jt != edges_temp.end(); ++jt) {
|
for (auto& p : edgecount) {
|
||||||
if (edgecount[*jt] == 1) {
|
// @todo should be != 2?
|
||||||
|
if (p.second == 1 && emitted_edges.find(p.first) == emitted_edges.end()) {
|
||||||
// non manifold edge, face boundary
|
// non manifold edge, face boundary
|
||||||
_edges.push_back(jt->first);
|
_edges.push_back(p.first.first);
|
||||||
_edges.push_back(jt->second);
|
_edges.push_back(p.first.second);
|
||||||
|
if (settings().get(IteratorSettings::WELD_VERTICES)) {
|
||||||
|
// only relevant while welding, because otherwise vertices are not shared among distinct faces
|
||||||
|
emitted_edges.insert(p.first);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -526,9 +534,7 @@ int IfcGeom::Representation::Triangulation::addVertex(int item_index, int materi
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IfcGeom::Representation::Triangulation::addEdge(int n1, int n2, std::map<std::pair<int, int>, int>& edgecount, std::vector<std::pair<int, int>>& edges_temp) {
|
void IfcGeom::Representation::Triangulation::addEdge(int n1, int n2, std::map<std::pair<int, int>, int>& edgecount) {
|
||||||
const Edge e = Edge((std::min)(n1, n2), (std::max)(n1, n2));
|
const Edge e = Edge((std::min)(n1, n2), (std::max)(n1, n2));
|
||||||
if (edgecount.find(e) == edgecount.end()) edgecount[e] = 1;
|
edgecount[e] ++;
|
||||||
else edgecount[e] ++;
|
|
||||||
edges_temp.push_back(e);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ namespace IfcGeom {
|
|||||||
private:
|
private:
|
||||||
/// Welds vertices that belong to different faces
|
/// Welds vertices that belong to different faces
|
||||||
int addVertex(int item_index, int material_index, const gp_XYZ& p);
|
int addVertex(int item_index, int material_index, const gp_XYZ& p);
|
||||||
void addEdge(int n1, int n2, std::map<std::pair<int, int>, int>& edgecount, std::vector<std::pair<int, int> >& edges_temp);
|
void addEdge(int n1, int n2, std::map<std::pair<int, int>, int>& edgecount);
|
||||||
|
|
||||||
Triangulation();
|
Triangulation();
|
||||||
Triangulation(const Triangulation&);
|
Triangulation(const Triangulation&);
|
||||||
|
|||||||
Reference in New Issue
Block a user