#1368 fix layerset folding: check length thichkness ratio

This commit is contained in:
Thomas Krijnen
2021-03-13 10:05:33 +01:00
parent 6ad605fbeb
commit 624e296d24
+14 -3
View File
@@ -2600,6 +2600,8 @@ bool IfcGeom::Kernel::fold_layers(const IfcSchema::IfcWall* wall, const IfcRepre
}
}
const double total_thickness = std::accumulate(thicknesses.begin(), thicknesses.end(), 0.);
gp_Pnt own_axis_start, own_axis_end;
find_wall_end_points(wall, own_axis_start, own_axis_end);
@@ -2661,6 +2663,16 @@ bool IfcGeom::Kernel::fold_layers(const IfcSchema::IfcWall* wall, const IfcRepre
}
*/
const double length_required = endpoint_connections.size() * total_thickness;
// @todo this is not precisely the distance in case of curved walls. Also, it's safer
// to first reproject the body onto the axis to get the precise curve parametrization
// range. It's only a safeguard though, so can probably be approximated.
const double axis_length = own_axis_start.Distance(own_axis_end);
if (length_required > axis_length) {
Logger::Warning("The wall axis is not long enough to accomodate the fold points");
return false;
}
for (endpoint_connections_t::const_iterator it = endpoint_connections.begin(); it != endpoint_connections.end(); ++it) {
IfcSchema::IfcConnectionTypeEnum::Value connection_type = it->first.first;
@@ -2746,8 +2758,6 @@ bool IfcGeom::Kernel::fold_layers(const IfcSchema::IfcWall* wall, const IfcRepre
double layer_offset = 0;
const double total_thickness = std::accumulate(thicknesses.begin(), thicknesses.end(), 0.);
std::vector<double>::const_iterator thickness = thicknesses.begin();
result_t::iterator result_vector = result.begin() + 1;
@@ -2778,7 +2788,8 @@ bool IfcGeom::Kernel::fold_layers(const IfcSchema::IfcWall* wall, const IfcRepre
surface->D1(u, v, Ps, Vs1, Vs2);
Vs1.Cross(Vs2);
if (Vs1.IsParallel(Vc, 1.e-5)) {
if (Vs1.IsNormal(Vc, 1.e-5)) {
int a = 1;
Logger::Warning("Connected walls are parallel");
parallel = true;
} else if (w < axis_u1 || w > axis_u2) {