Put maximum length on layerset wall end point intersection

This commit is contained in:
Thomas Krijnen
2019-08-21 11:59:30 +02:00
parent 16ce1f0823
commit 75b24c2352
+16 -13
View File
@@ -26,6 +26,7 @@
#include <set> #include <set>
#include <cassert> #include <cassert>
#include <algorithm> #include <algorithm>
#include <numeric>
#include <Standard_Version.hxx> #include <Standard_Version.hxx>
@@ -2433,17 +2434,14 @@ bool IfcGeom::Kernel::fold_layers(const IfcSchema::IfcWall* wall, const IfcRepre
++it; ++it;
} }
} }
/*
Additionally one could check whether the end points are of the wall are really ~1 LayerThickness away from each other
for (endpoint_connections_t::const_iterator it = endpoint_connections.begin(); it != endpoint_connections.end(); ++it) {
IfcSchema::IfcConnectionTypeEnum::Value relating_connection_type = it->first.first;
IfcSchema::IfcConnectionTypeEnum::Value related_connection_type = it->first.second;
if (connection_type != relating_connection_type) {
continue;
} }
// Check whether the end points are of the wall are really ~1 LayerThickness away from each other
/*
for (endpoint_connections_t::const_iterator it = endpoint_connections.begin(); it != endpoint_connections.end(); ++it) {
IfcSchema::IfcConnectionTypeEnum::Value own_type = it->first.first;
IfcSchema::IfcConnectionTypeEnum::Value other_type = it->first.second;
gp_Pnt other_axis_start, other_axis_end; gp_Pnt other_axis_start, other_axis_end;
find_wall_end_points(it->second->as<IfcSchema::IfcWall>(), other_axis_start, other_axis_end); find_wall_end_points(it->second->as<IfcSchema::IfcWall>(), other_axis_start, other_axis_end);
@@ -2457,18 +2455,17 @@ bool IfcGeom::Kernel::fold_layers(const IfcSchema::IfcWall* wall, const IfcRepre
other.Transforms(other_axis_end.ChangeCoord()); other.Transforms(other_axis_end.ChangeCoord());
local.Transforms(other_axis_end.ChangeCoord()); local.Transforms(other_axis_end.ChangeCoord());
const gp_Pnt& a = relating_connection_type == IfcSchema::IfcConnectionTypeEnum::IfcConnectionType_ATSTART const gp_Pnt& a = own_type == IfcSchema::IfcConnectionTypeEnum::IfcConnectionType_ATSTART
? own_axis_start ? own_axis_start
: own_axis_end; : own_axis_end;
const gp_Pnt& b = related_connection_type == IfcSchema::IfcConnectionTypeEnum::IfcConnectionType_ATSTART const gp_Pnt& b = other_type == IfcSchema::IfcConnectionTypeEnum::IfcConnectionType_ATSTART
? other_axis_start ? other_axis_start
: other_axis_end; : other_axis_end;
const double d = a.Distance(b); const double d = a.Distance(b);
} }
*/ */
}
for (endpoint_connections_t::const_iterator it = endpoint_connections.begin(); it != endpoint_connections.end(); ++it) { for (endpoint_connections_t::const_iterator it = endpoint_connections.begin(); it != endpoint_connections.end(); ++it) {
IfcSchema::IfcConnectionTypeEnum::Value connection_type = it->first.first; IfcSchema::IfcConnectionTypeEnum::Value connection_type = it->first.first;
@@ -2555,6 +2552,8 @@ bool IfcGeom::Kernel::fold_layers(const IfcSchema::IfcWall* wall, const IfcRepre
double layer_offset = 0; double layer_offset = 0;
const double total_thickness = std::accumulate(thicknesses.begin(), thicknesses.end(), 0);
std::vector<double>::const_iterator thickness = thicknesses.begin(); std::vector<double>::const_iterator thickness = thicknesses.begin();
result_t::iterator result_vector = result.begin() + 1; result_t::iterator result_vector = result.begin() + 1;
@@ -2620,7 +2619,11 @@ bool IfcGeom::Kernel::fold_layers(const IfcSchema::IfcWall* wall, const IfcRepre
} }
// Find vertical wall end point edge closest to end point associated with semantic connection // Find vertical wall end point edge closest to end point associated with semantic connection
if (project(kt->second, own_end_point, p, u, d)) { if (project(kt->second, own_end_point, p, u, d)) {
if (d < mind) { // In addition to closest, there is a length threshold based on thickness.
// @todo ideally, first, the point closest to end-point is selected, and
// after that the parallel check is performed. But threshold probably
// functions good enough.
if (d < total_thickness * 3 && d < mind) {
GeomAdaptor_Curve GAC(other_axis_curve); GeomAdaptor_Curve GAC(other_axis_curve);
GeomAdaptor_Surface GAS(kt->first); GeomAdaptor_Surface GAS(kt->first);