| 244 | } |
| 245 | |
| 246 | bool IfcGeom::OpenCascadeKernel::faceset_helper::wires(const ifcopenshell::geometry::taxonomy::loop::ptr loop, TopTools_ListOfShape& wires) { |
| 247 | if (duplicates_.find(loop->identity()) != duplicates_.end()) { |
| 248 | return false; |
| 249 | } |
| 250 | TopoDS_Wire wire; |
| 251 | BRep_Builder builder; |
| 252 | builder.MakeWire(wire); |
| 253 | int count = 0; |
| 254 | loop_(loop, [this, &builder, &wire, &count](int A, int B, bool fwd) { |
| 255 | TopoDS_Edge e; |
| 256 | if (edge(A, B, e)) { |
| 257 | if (!fwd) { |
| 258 | e.Reverse(); |
| 259 | } |
| 260 | builder.Add(wire, e); |
| 261 | count += 1; |
| 262 | } |
| 263 | }); |
| 264 | if (count >= 3) { |
| 265 | wire.Closed(true); |
| 266 | |
| 267 | TopTools_ListOfShape results; |
| 268 | if (!kernel_->settings().get<ifcopenshell::geometry::settings::NoWireIntersectionCheck>().get() && util::wire_intersections(wire, results, { |
| 269 | !kernel_->settings().get<ifcopenshell::geometry::settings::NoWireIntersectionCheck>().get(), |
| 270 | !kernel_->settings().get<ifcopenshell::geometry::settings::NoWireIntersectionTolerance>().get(), 0., |
| 271 | kernel_->settings().get<ifcopenshell::geometry::settings::Precision>().get()})) |
| 272 | { |
| 273 | Logger::Warning("Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected"); |
| 274 | non_manifold_ = true; |
| 275 | wires = results; |
| 276 | } else { |
| 277 | wires.Append(wire); |
| 278 | } |
| 279 | |
| 280 | return true; |
| 281 | } else { |
| 282 | return false; |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | IfcGeom::OpenCascadeKernel::faceset_helper::~faceset_helper() { |
| 287 | // @todo this is super ugly, but how else can we be notified that the unique_ptr goes out of scope? |