------------------------------------------------------------------------------------------------
| 719 | |
| 720 | // ------------------------------------------------------------------------------------------------ |
| 721 | void ProcessBoolean(const Schema_2x3::IfcBooleanResult &boolean, TempMesh &result, ConversionData &conv) { |
| 722 | // supported CSG operations: |
| 723 | // DIFFERENCE |
| 724 | if (const Schema_2x3::IfcBooleanResult *const clip = boolean.ToPtr<Schema_2x3::IfcBooleanResult>()) { |
| 725 | if (clip->Operator != "DIFFERENCE") { |
| 726 | IFCImporter::LogWarn("encountered unsupported boolean operator: ", (std::string)clip->Operator); |
| 727 | return; |
| 728 | } |
| 729 | |
| 730 | // supported cases (1st operand): |
| 731 | // IfcBooleanResult -- call ProcessBoolean recursively |
| 732 | // IfcSweptAreaSolid -- obtain polygonal geometry first |
| 733 | |
| 734 | // supported cases (2nd operand): |
| 735 | // IfcHalfSpaceSolid -- easy, clip against plane |
| 736 | // IfcExtrudedAreaSolid -- reduce to an instance of the quadrify() algorithm |
| 737 | |
| 738 | const Schema_2x3::IfcHalfSpaceSolid *const hs = clip->SecondOperand->ResolveSelectPtr<Schema_2x3::IfcHalfSpaceSolid>(conv.db); |
| 739 | const Schema_2x3::IfcExtrudedAreaSolid *const as = clip->SecondOperand->ResolveSelectPtr<Schema_2x3::IfcExtrudedAreaSolid>(conv.db); |
| 740 | if (!hs && !as) { |
| 741 | IFCImporter::LogError("expected IfcHalfSpaceSolid or IfcExtrudedAreaSolid as second clipping operand"); |
| 742 | return; |
| 743 | } |
| 744 | |
| 745 | TempMesh first_operand; |
| 746 | if (const Schema_2x3::IfcBooleanResult *const op0 = clip->FirstOperand->ResolveSelectPtr<Schema_2x3::IfcBooleanResult>(conv.db)) { |
| 747 | ProcessBoolean(*op0, first_operand, conv); |
| 748 | } else if (const Schema_2x3::IfcSweptAreaSolid *const swept = clip->FirstOperand->ResolveSelectPtr<Schema_2x3::IfcSweptAreaSolid>(conv.db)) { |
| 749 | ProcessSweptAreaSolid(*swept, first_operand, conv); |
| 750 | } else { |
| 751 | IFCImporter::LogError("expected IfcSweptAreaSolid or IfcBooleanResult as first clipping operand"); |
| 752 | return; |
| 753 | } |
| 754 | |
| 755 | if (hs) { |
| 756 | |
| 757 | const Schema_2x3::IfcPolygonalBoundedHalfSpace *const hs_bounded = clip->SecondOperand->ResolveSelectPtr<Schema_2x3::IfcPolygonalBoundedHalfSpace>(conv.db); |
| 758 | if (hs_bounded) { |
| 759 | ProcessPolygonalBoundedBooleanHalfSpaceDifference(hs_bounded, result, first_operand, conv); |
| 760 | } else { |
| 761 | ProcessBooleanHalfSpaceDifference(hs, result, first_operand, conv); |
| 762 | } |
| 763 | } else { |
| 764 | ProcessBooleanExtrudedAreaSolidDifference(as, result, first_operand, conv); |
| 765 | } |
| 766 | } else { |
| 767 | IFCImporter::LogWarn("skipping unknown IfcBooleanResult entity, type is ", boolean.GetClassName()); |
| 768 | } |
| 769 | } |
| 770 | |
| 771 | } // namespace IFC |
| 772 | } // namespace Assimp |
no test coverage detected