mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
#1287 Don't wel accross different rep items
This commit is contained in:
@@ -117,6 +117,7 @@ namespace IfcGeom {
|
|||||||
std::vector<P> uvs_;
|
std::vector<P> uvs_;
|
||||||
std::vector<int> _material_ids;
|
std::vector<int> _material_ids;
|
||||||
std::vector<Material> _materials;
|
std::vector<Material> _materials;
|
||||||
|
size_t weld_offset_;
|
||||||
VertexKeyMap welds;
|
VertexKeyMap welds;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -130,10 +131,15 @@ namespace IfcGeom {
|
|||||||
const std::vector<Material>& materials() const { return _materials; }
|
const std::vector<Material>& materials() const { return _materials; }
|
||||||
|
|
||||||
Triangulation(const BRep& shape_model)
|
Triangulation(const BRep& shape_model)
|
||||||
: Representation(shape_model.settings())
|
: Representation(shape_model.settings())
|
||||||
, id_(shape_model.id())
|
, id_(shape_model.id())
|
||||||
|
, weld_offset_(0)
|
||||||
{
|
{
|
||||||
for ( IfcGeom::IfcRepresentationShapeItems::const_iterator iit = shape_model.begin(); iit != shape_model.end(); ++ iit ) {
|
for ( IfcGeom::IfcRepresentationShapeItems::const_iterator iit = shape_model.begin(); iit != shape_model.end(); ++ iit ) {
|
||||||
|
|
||||||
|
// Don't weld vertices that belong to different items to prevent non-manifold situations.
|
||||||
|
weld_offset_ += welds.size();
|
||||||
|
welds.clear();
|
||||||
|
|
||||||
int surface_style_id = -1;
|
int surface_style_id = -1;
|
||||||
if (iit->hasStyle()) {
|
if (iit->hasStyle()) {
|
||||||
@@ -386,7 +392,7 @@ namespace IfcGeom {
|
|||||||
const VertexKey key = std::make_pair(material_index, std::make_pair(X, std::make_pair(Y, Z)));
|
const VertexKey key = std::make_pair(material_index, std::make_pair(X, std::make_pair(Y, Z)));
|
||||||
typename VertexKeyMap::const_iterator it = welds.find(key);
|
typename VertexKeyMap::const_iterator it = welds.find(key);
|
||||||
if ( it != welds.end() ) return it->second;
|
if ( it != welds.end() ) return it->second;
|
||||||
i = (int) welds.size();
|
i = (int) welds.size() + weld_offset_;
|
||||||
welds[key] = i;
|
welds[key] = i;
|
||||||
}
|
}
|
||||||
_verts.push_back(X);
|
_verts.push_back(X);
|
||||||
|
|||||||
Reference in New Issue
Block a user