Merge remote-tracking branch 'origin/v0.7.0' into v0.8.0

This commit is contained in:
Thomas Krijnen
2023-03-29 12:55:05 +02:00
977 changed files with 317352 additions and 64693 deletions
+10 -3
View File
@@ -130,7 +130,11 @@ namespace IfcGeom {
bool owns_ifc_file;
int num_threads_;
// When single-threaded
Converter* converter_;
// When multi-threaded
std::vector<Converter*> kernel_pool;
// The object is fetched beforehand to be sure that get() returns a valid element
TriangulationElement* current_triangulation;
@@ -270,7 +274,6 @@ namespace IfcGeom {
conc_threads = tasks_.size();
}
std::vector<Converter*> kernel_pool;
kernel_pool.reserve(conc_threads);
for (unsigned i = 0; i < conc_threads; ++i) {
kernel_pool.push_back(new Converter(geometry_library_, ifc_file, settings_));
@@ -768,8 +771,12 @@ namespace IfcGeom {
delete p;
}
}
for (auto& p : all_processed_elements_) {
for (auto& k : kernel_pool) {
delete k;
}
for (auto& p : all_processed_elements_) {
delete p;
}
}
+2 -1
View File
@@ -124,7 +124,8 @@ namespace IfcGeom
IteratorSettings()
: settings_(WELD_VERTICES | BOOLEAN_ATTEMPT_2D) // OR options that default to true here
, deflection_tolerance_(1.e-3)
, angular_tolerance_(0.5)
, angular_tolerance_(0.5)
, force_space_transparency_(-1.0)
{
}
+2 -2
View File
@@ -45,8 +45,8 @@ void InitDefaultMaterials() {
default_materials["IfcPlate"].diffuse = ifcopenshell::geometry::taxonomy::colour(0.8, 0.8, 0.8);
default_materials.insert(std::make_pair("IfcSpace", ifcopenshell::geometry::taxonomy::style("IfcSpace")));
default_materials["IfcWindow"].diffuse = ifcopenshell::geometry::taxonomy::colour(0.65, 0.75, 0.8);
default_materials["IfcWindow"].transparency = 0.8;
default_materials["IfcSpace"].diffuse = ifcopenshell::geometry::taxonomy::colour(0.65, 0.75, 0.8);
default_materials["IfcSpace"].transparency = 0.8;
default_material = ifcopenshell::geometry::taxonomy::style("DefaultMaterial");
default_material.diffuse = ifcopenshell::geometry::taxonomy::colour(0.7, 0.7, 0.7);
+7 -2
View File
@@ -3,9 +3,14 @@
#include "../../../ifcgeom/ConversionResult.h"
#include <gp_Ax3.hxx>
#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <gp_Ax3.hxx>
#include <gp_Ax2d.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_GTrsf2d.hxx>
#include <gp_Trsf.hxx>
#include <gp_GTrsf.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopoDS_Wire.hxx>
@@ -72,4 +77,4 @@ namespace IfcGeom {
}
}
#endif
#endif
@@ -620,18 +620,6 @@ bool IfcGeom::util::boolean_subtraction_2d_using_builder(const TopoDS_Shape & a_
}
}
{
TopoDS_Compound C;
BRep_Builder BB;
BB.MakeCompound(C);
for (auto& w : wires) {
BB.Add(C, w);
}
BRepTools::Write(C, "debug.brep");
}
shape_index = 0;
edge_index = 0;
@@ -1105,6 +1093,9 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
if (builder->DSFiller()->HasWarning(STANDARD_TYPE(BOPAlgo_AlertAcquiredSelfIntersection))) {
Logger::Notice("Builder reports self-intersection in output");
success = false;
} else if(builder->DSFiller()->HasWarning(STANDARD_TYPE(BOPAlgo_AlertBadPositioning)) && !TopoDS_Iterator(*builder).More()) {
Logger::Notice("Builder reports bad positioning and result is empty");
success = false;
} else {
TopoDS_Shape r = *builder;
@@ -1388,4 +1379,4 @@ const TopoDS_Shape& IfcGeom::util::ensure_fit_for_subtraction(const TopoDS_Shape
}
return solid;
}
}
@@ -81,7 +81,11 @@ bool IfcGeom::util::approximate_plane_through_wire(const TopoDS_Wire& wire, gp_P
}
gp_Vec v(x, y, z);
if (v.SquareMagnitude() < eps_ * eps_) {
// @todo the epsilon passed to us here is the maximum allowed deviation of
// the given points to the constructed plane. When doing triangulation and
// obtaining a 2d points for the Delaunay, infinity is passed here, so this
// can't for assessing degenerativeness.
if (v.SquareMagnitude() < 1.e-7) {
Logger::Warning("Degenerate face boundary in normal estimation");
return false;
}
+41 -14
View File
@@ -24,19 +24,43 @@ using namespace ifcopenshell::geometry;
#include "../profile_helper.h"
taxonomy::item* mapping::map_impl(const IfcSchema::IfcIShapeProfileDef* inst) {
const bool doFillet1 = !!l->FilletRadius();
#ifdef SCHEMA_IfcIShapeProfileDef_HAS_FlangeEdgeRadius
const bool doFlangeEdgeRadius = !!l->FlangeEdgeRadius();
const bool hasSlope = !!l->FlangeSlope();
#else
const bool doFlangeEdgeRadius = false;
#endif
const double x1 = inst->OverallWidth() / 2.0f * length_unit_;
const double y = inst->OverallDepth() / 2.0f * length_unit_;
const double d1 = inst->WebThickness() / 2.0f * length_unit_;
const double dy1 = inst->FlangeThickness() * length_unit_;
const double ft1 = inst->FlangeThickness() * length_unit_;
#ifdef SCHEMA_IfcIShapeProfileDef_HAS_FlangeEdgeRadius
const double slope = l->FlangeSlope().get_value_or(0.) * angle_unit_;
#endif
bool doFillet1 = !!inst->FilletRadius();
double dy = 0.;
double f1 = 0.;
if ( doFillet1 ) {
double f2 = 0.;
double fe1 = 0.;
double fe2 = 0.;
double x2 = x1;
double ft2 = ft1;
if (doFillet1) {
f1 = *inst->FilletRadius() * length_unit_;
}
#ifdef SCHEMA_IfcIShapeProfileDef_HAS_FlangeEdgeRadius
if (doFlangeEdgeRadius) {
fe1 = *l->FlangeEdgeRadius() * getValue(GV_LENGTH_UNIT);
}
if (hasSlope) {
dy = (x1 - d1) * tan(slope);
}
#endif
bool doFillet2 = doFillet1;
double x2 = x1, dy2 = dy1, f2 = f1;
// @todo in IFC4 a IfcAsymmetricIShapeProfileDef is not a subtype anymore of IfcIShapeProfileDef!
if (inst->declaration().is(IfcSchema::IfcAsymmetricIShapeProfileDef::Class())) {
@@ -47,13 +71,16 @@ taxonomy::item* mapping::map_impl(const IfcSchema::IfcIShapeProfileDef* inst) {
f2 = *assym->TopFlangeFilletRadius() * length_unit_;
}
if (assym->TopFlangeThickness()) {
dy2 = *assym->TopFlangeThickness() * length_unit_;
ft2 = *assym->TopFlangeThickness() * length_unit_;
}
} else {
f2 = f1;
fe2 = fe1;
}
const double tol = conv_settings_.getValue(ConversionSettings::GV_PRECISION);
if ( x1 < tol || x2 < tol || y < tol || d1 < tol || dy1 < tol || dy2 < tol) {
if (x1 < tol || x2 < tol || y < tol || d1 < tol || ft1 < tol || ft2 < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
return nullptr;
}
@@ -71,15 +98,15 @@ taxonomy::item* mapping::map_impl(const IfcSchema::IfcIShapeProfileDef* inst) {
return profile_helper(m4, {
{{-x1,-y}},
{{x1,-y}},
{{x1,-y + dy1}},
{{d1,-y + dy1},{ f1} },
{{d1,y - dy2},{f2} },
{{x2,y - dy2}},
{{x1,-y + ft1}, {fe1}},
{{d1,-y + ft1 + dy},{ f1} },
{{d1,y - ft2 - dy},{f2} },
{{x2,y - ft2}, {fe2}},
{{x2,y}},
{{-x2,y}},
{{-x2,y - dy2}},
{{-d1,y - dy2},{f2} },
{{-d1,-y + dy1},{f1} },
{{-x1,-y + dy1}}
{{-x2,y - ft2}, {fe2}},
{{-d1,y - ft2 - dy},{f2} },
{{-d1,-y + ft1 + dy},{f1} },
{{-x1,-y + ft1}, {fe1}}
});
}