This commit is contained in:
aothms
2021-02-21 16:38:53 +01:00
4 changed files with 16 additions and 10 deletions
+4 -2
View File
@@ -834,14 +834,12 @@ bool CgalKernel::process_extrusion(const cgal_face_t& bottom_face, const taxonom
// Mark as internal before erasure in external // Mark as internal before erasure in external
// This is {i,j} at the time the edge use was inserted. // This is {i,j} at the time the edge use was inserted.
internal_edges.insert(p.first->second); internal_edges.insert(p.first->second);
// not inserted, remove // not inserted, remove
external_edges.erase(p.first); external_edges.erase(p.first);
// @nb note the difference here in indices, {i0, i1} is point indices in // @nb note the difference here in indices, {i0, i1} is point indices in
// point_map. i is index in faces_to_extrude, j is segment index in wire. // point_map. i is index in faces_to_extrude, j is segment index in wire.
internal_edges.insert({ i, j }); internal_edges.insert({ i, j });
} }
} }
i++; i++;
@@ -1080,6 +1078,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) { 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. // @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 a_nonconst = a;
auto ax = CGAL::minkowski_sum_3(a_nonconst, precision_cube_); auto ax = CGAL::minkowski_sum_3(a_nonconst, precision_cube_);
auto x = ax - a; auto x = ax - a;
@@ -1137,6 +1137,8 @@ bool CgalKernel::preprocess_boolean_operand(const IfcUtil::IfcBaseClass* log_ref
return false; return false;
} }
auto precision_cube_ = precision_cube();
if (dilate) { if (dilate) {
try { try {
// @todo don't dilate in 3 dimensions but only in the XY plane, orthogonal to wall axis. // @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: private:
double precision_; double precision_;
size_t circle_segments_; 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 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); 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: public:
CgalKernel() CgalKernel()
@@ -82,8 +87,7 @@ namespace kernels {
, precision_(1.e-5) , precision_(1.e-5)
, circle_segments_(16) , 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); 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::extrusion*, ifcopenshell::geometry::ConversionResults&);
virtual bool convert_impl(const taxonomy::boolean_result*, 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_(); }
}; };
} }
+1 -1
View File
@@ -346,7 +346,7 @@ struct collection : public geom_item {
collection() {} collection() {}
collection(const collection& other) { collection(const collection& other) {
std::transform(other.children.begin(), other.children.end(), std::back_inserter(children), std::mem_fun(&item::clone)); std::transform(other.children.begin(), other.children.end(), std::back_inserter(children), std::mem_fn(&item::clone));
} }
template <typename T> template <typename T>
+3 -3
View File
@@ -243,7 +243,7 @@ namespace IfcParse {
std::vector<const inverse_attribute*> inverse_attributes_; std::vector<const inverse_attribute*> inverse_attributes_;
class attribute_by_name_cmp : public std::unary_function<const attribute*, bool> { class attribute_by_name_cmp {
private: private:
std::string name_; std::string name_;
public: public:
@@ -399,14 +399,14 @@ namespace IfcParse {
std::vector<const enumeration_type*> enumeration_types_; std::vector<const enumeration_type*> enumeration_types_;
std::vector<const entity*> entities_; std::vector<const entity*> entities_;
class declaration_by_name_cmp : public std::binary_function<const declaration*, const std::string&, bool> { class declaration_by_name_cmp {
public: public:
bool operator()(const declaration* decl, const std::string& name) { bool operator()(const declaration* decl, const std::string& name) {
return decl->name_lc() < name; return decl->name_lc() < name;
} }
}; };
class declaration_by_index_sort : public std::binary_function<const declaration*, const declaration*, bool> { class declaration_by_index_sort {
public: public:
bool operator()(const declaration* a, const declaration* b) { bool operator()(const declaration* a, const declaration* b) {
return a->index_in_schema() < b->index_in_schema(); return a->index_in_schema() < b->index_in_schema();