mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
Merge branch 'v0.8.0' into feat/IfcFixedReferenceSweptAreaSolid
This commit is contained in:
@@ -593,6 +593,24 @@ typedef item const* ptr;
|
||||
}
|
||||
};
|
||||
|
||||
struct equal_functor {
|
||||
bool operator()(taxonomy::item::ptr const& a,
|
||||
taxonomy::item::ptr const& b) const
|
||||
{
|
||||
if (a == b) {
|
||||
return true;
|
||||
}
|
||||
return !less(a, b) && !less(b, a);
|
||||
}
|
||||
};
|
||||
|
||||
struct hash_functor {
|
||||
size_t operator()(taxonomy::item::ptr const& a) const
|
||||
{
|
||||
return a->hash();
|
||||
}
|
||||
};
|
||||
|
||||
// @todo make 4d for easier multiplication
|
||||
template <size_t N>
|
||||
struct cartesian_base : public item, public eigen_base<Eigen::Vector3d> {
|
||||
@@ -934,6 +952,21 @@ typedef item const* ptr;
|
||||
auto v = std::make_tuple(static_cast<size_t>(LOOP), hash_elements(), external ? *external ? 2 : 1 : 0, closed ? *closed ? 2 : 1 : 0);
|
||||
return boost::hash<decltype(v)>{}(v);
|
||||
}
|
||||
|
||||
// nb only takes into account explicit points
|
||||
taxonomy::point3::ptr centroid() const {
|
||||
Eigen::Vector3d c(0, 0, 0);
|
||||
for (auto& e : children) {
|
||||
if (e->start.which() == 1) {
|
||||
c += boost::get<point3::ptr>(e->start)->ccomponents();
|
||||
}
|
||||
if (e->end.which() == 1) {
|
||||
c += boost::get<point3::ptr>(e->end)->ccomponents();
|
||||
}
|
||||
}
|
||||
c /= static_cast<double>(children.size());
|
||||
return make<taxonomy::point3>(c);
|
||||
}
|
||||
};
|
||||
|
||||
struct face : public collection_base<loop> {
|
||||
@@ -974,6 +1007,25 @@ typedef item const* ptr;
|
||||
auto v = std::make_tuple(static_cast<size_t>(SHELL), hash_elements(), closed ? *closed ? 2 : 1 : 0);
|
||||
return boost::hash<decltype(v)>{}(v);
|
||||
}
|
||||
|
||||
// nb only takes into account explicit points
|
||||
taxonomy::point3::ptr centroid() const {
|
||||
Eigen::Vector3d c(0, 0, 0);
|
||||
for (auto& f : children) {
|
||||
for (auto& l : f->children) {
|
||||
for (auto& e : l->children) {
|
||||
if (e->start.which() == 1) {
|
||||
c += boost::get<point3::ptr>(e->start)->ccomponents();
|
||||
}
|
||||
if (e->end.which() == 1) {
|
||||
c += boost::get<point3::ptr>(e->end)->ccomponents();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
c /= static_cast<double>(children.size());
|
||||
return make<taxonomy::point3>(c);
|
||||
}
|
||||
};
|
||||
|
||||
struct solid : public collection_base<shell> {
|
||||
|
||||
Reference in New Issue
Block a user