diff --git a/src/ifcgeom/ConversionResult.h b/src/ifcgeom/ConversionResult.h index 1577eb369d..d9f172e2de 100644 --- a/src/ifcgeom/ConversionResult.h +++ b/src/ifcgeom/ConversionResult.h @@ -220,6 +220,7 @@ namespace IfcGeom { virtual ConversionResultShape* intersect(ConversionResultShape*) = 0; virtual void map(OpaqueCoordinate<4>& from, OpaqueCoordinate<4>& to) = 0; + virtual void map(const std::vector>& from, const std::vector>& to) = 0; virtual ConversionResultShape* moved(ifcopenshell::geometry::taxonomy::matrix4::ptr) const = 0; virtual ~ConversionResultShape() {} diff --git a/src/ifcgeom/kernels/cgal/CgalConversionResult.cpp b/src/ifcgeom/kernels/cgal/CgalConversionResult.cpp index 28a0bdf77d..a53c92f70b 100644 --- a/src/ifcgeom/kernels/cgal/CgalConversionResult.cpp +++ b/src/ifcgeom/kernels/cgal/CgalConversionResult.cpp @@ -470,6 +470,10 @@ void ifcopenshell::geometry::CgalShape::map(OpaqueCoordinate<4>& from, OpaqueCoo throw std::runtime_error("Not implemented"); } +void ifcopenshell::geometry::CgalShape::map(const std::vector>& from, const std::vector>& to) { + throw std::runtime_error("Not implemented"); +} + #ifndef IFOPSH_SIMPLE_KERNEL void ifcopenshell::geometry::CgalShapeHalfSpaceDecomposition::Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int surface_style_id) const { @@ -653,4 +657,33 @@ void ifcopenshell::geometry::CgalShapeHalfSpaceDecomposition::map(OpaqueCoordina shape_ = std::move(nw); } +void ifcopenshell::geometry::CgalShapeHalfSpaceDecomposition::map(const std::vector>& froms, const std::vector>& tos) { + plane_map mp; + if (froms.size() != tos.size()) { + throw std::runtime_error("Expected equal size"); + } + auto it = froms.begin(); + auto jt = tos.begin(); + for (; it < froms.end(); ++it, ++jt) { + auto& from = *it; + auto& to = *jt; + mp.insert({ + CGAL::Plane_3( + std::static_pointer_cast(from.values[0])->value(), + std::static_pointer_cast(from.values[1])->value(), + std::static_pointer_cast(from.values[2])->value(), + std::static_pointer_cast(from.values[3])->value() + ), + CGAL::Plane_3( + std::static_pointer_cast(to.values[0])->value(), + std::static_pointer_cast(to.values[1])->value(), + std::static_pointer_cast(to.values[2])->value(), + std::static_pointer_cast(to.values[3])->value() + ) + }); + } + auto nw = shape_->map(mp); + shape_ = std::move(nw); +} + #endif \ No newline at end of file diff --git a/src/ifcgeom/kernels/cgal/CgalConversionResult.h b/src/ifcgeom/kernels/cgal/CgalConversionResult.h index 0811b1968d..2764ba5230 100644 --- a/src/ifcgeom/kernels/cgal/CgalConversionResult.h +++ b/src/ifcgeom/kernels/cgal/CgalConversionResult.h @@ -237,6 +237,7 @@ namespace ifcopenshell { namespace geometry { virtual ConversionResultShape* intersect(ConversionResultShape*); virtual void map(OpaqueCoordinate<4>& from, OpaqueCoordinate<4>& to); + virtual void map(const std::vector>& from, const std::vector>& to); virtual ConversionResultShape* moved(ifcopenshell::geometry::taxonomy::matrix4::ptr) const; }; @@ -293,6 +294,7 @@ namespace ifcopenshell { namespace geometry { virtual ConversionResultShape* intersect(ConversionResultShape*); virtual void map(OpaqueCoordinate<4>& from, OpaqueCoordinate<4>& to); + virtual void map(const std::vector>& from, const std::vector>& to); virtual ConversionResultShape* moved(ifcopenshell::geometry::taxonomy::matrix4::ptr) const; }; #endif diff --git a/src/ifcgeom/kernels/opencascade/OpenCascadeConversionResult.cpp b/src/ifcgeom/kernels/opencascade/OpenCascadeConversionResult.cpp index 723ecc585a..02edc17a4f 100644 --- a/src/ifcgeom/kernels/opencascade/OpenCascadeConversionResult.cpp +++ b/src/ifcgeom/kernels/opencascade/OpenCascadeConversionResult.cpp @@ -422,3 +422,7 @@ ConversionResultShape* ifcopenshell::geometry::OpenCascadeShape::moved(ifcopensh void ifcopenshell::geometry::OpenCascadeShape::map(OpaqueCoordinate<4>& from, OpaqueCoordinate<4>& to) { throw std::runtime_error("Not implemented"); } + +void ifcopenshell::geometry::OpenCascadeShape::map(const std::vector>& from, const std::vector>& to) { + throw std::runtime_error("Not implemented"); +} diff --git a/src/ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h b/src/ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h index 2046852255..a113573599 100644 --- a/src/ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h +++ b/src/ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h @@ -95,6 +95,7 @@ namespace ifcopenshell { virtual ConversionResultShape* intersect(ConversionResultShape*); virtual void map(OpaqueCoordinate<4>& from, OpaqueCoordinate<4>& to); + virtual void map(const std::vector>& from, const std::vector>& to); virtual ConversionResultShape* moved(ifcopenshell::geometry::taxonomy::matrix4::ptr) const; private: TopoDS_Shape shape_;