Don't store precision cube (multi-threading)

This commit is contained in:
Thomas Krijnen
2021-02-21 16:34:51 +01:00
parent 7812ecb189
commit 4ec24e93a6
2 changed files with 12 additions and 4 deletions
+4
View File
@@ -1079,6 +1079,8 @@ CGAL::Polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_cube(const Ker
bool CgalKernel::thin_solid(const CGAL::Nef_polyhedron_3<Kernel_>& a, CGAL::Nef_polyhedron_3<Kernel_>& result) {
// @todo this should be possible as a minkowski sum of facet & cube. rather than a set of boolean ops.
auto precision_cube_ = precision_cube();
auto a_nonconst = a;
auto ax = CGAL::minkowski_sum_3(a_nonconst, precision_cube_);
auto x = ax - a;
@@ -1136,6 +1138,8 @@ bool CgalKernel::preprocess_boolean_operand(const IfcUtil::IfcBaseClass* log_ref
return false;
}
auto precision_cube_ = precision_cube();
if (dilate) {
try {
// @todo don't dilate in 3 dimensions but only in the XY plane, orthogonal to wall axis.
+8 -4
View File
@@ -70,10 +70,15 @@ namespace kernels {
private:
double precision_;
size_t circle_segments_;
CGAL::Nef_polyhedron_3<Kernel_> precision_cube_;
// CGAL::Nef_polyhedron_3<Kernel_> precision_cube_;
bool preprocess_boolean_operand(const IfcUtil::IfcBaseClass* log_reference, const cgal_shape_t& shape_const, CGAL::Nef_polyhedron_3<Kernel_>& result, bool dilate);
bool thin_solid(const CGAL::Nef_polyhedron_3<Kernel_>& a, CGAL::Nef_polyhedron_3<Kernel_>& result);
CGAL::Nef_polyhedron_3<Kernel_> create_precision_cube_() const {
auto cc = utils::create_cube(precision_);
return CGAL::Nef_polyhedron_3<Kernel_>(cc);
}
public:
CgalKernel()
@@ -82,8 +87,7 @@ namespace kernels {
, precision_(1.e-5)
, circle_segments_(16)
{
auto cc = utils::create_cube(precision_);
precision_cube_ = CGAL::Nef_polyhedron_3<Kernel_>(cc);
}
void remove_duplicate_points_from_loop(cgal_wire_t& polygon);
@@ -102,7 +106,7 @@ namespace kernels {
virtual bool convert_impl(const taxonomy::extrusion*, ifcopenshell::geometry::ConversionResults&);
virtual bool convert_impl(const taxonomy::boolean_result*, ifcopenshell::geometry::ConversionResults&);
const CGAL::Nef_polyhedron_3<Kernel_>& precision_cube() const { return precision_cube_; }
CGAL::Nef_polyhedron_3<Kernel_> precision_cube() const { return create_precision_cube_(); }
};
}