Last minute refactoring

This commit is contained in:
Thomas Krijnen
2026-08-08 07:42:45 +02:00
parent 8870ffb018
commit af58eaf79f
300 changed files with 5230 additions and 5150 deletions
@@ -9,39 +9,39 @@
#include <optional>
namespace ifcopenshell {
namespace geometry {
namespace geom {
struct IFC_GEOMLIBRARY_API ManifoldPart {
struct IFC_GEOMLIBRARY_API manifold_part {
manifold::MeshGL64 mesh;
std::optional<manifold::Manifold> solid;
ManifoldPart(const manifold::Manifold& s) {
manifold_part(const manifold::Manifold& s) {
auto copy = s;
copy.CalculateNormals(3);
mesh = copy.GetMeshGL64();
solid = s;
}
ManifoldPart(const manifold::MeshGL64& s) : mesh(s) {}
manifold_part(const manifold::MeshGL64& s) : mesh(s) {}
ManifoldPart(const manifold::MeshGL64& s, const manifold::Manifold& m) : mesh(s), solid(m) {}
manifold_part(const manifold::MeshGL64& s, const manifold::Manifold& m) : mesh(s), solid(m) {}
};
class IFC_GEOMLIBRARY_API ManifoldShape : public IfcGeom::ConversionResultShape {
class IFC_GEOMLIBRARY_API manifold_shape : public ifcopenshell::geom::conversion_result_shape {
public:
ManifoldShape() = default;
explicit ManifoldShape(const manifold::Manifold& part);
explicit ManifoldShape(const ManifoldPart& part);
explicit ManifoldShape(ManifoldPart&& part);
explicit ManifoldShape(const std::vector<ManifoldPart>& parts);
explicit ManifoldShape(std::vector<ManifoldPart>&& parts);
manifold_shape() = default;
explicit manifold_shape(const manifold::Manifold& part);
explicit manifold_shape(const manifold_part& part);
explicit manifold_shape(manifold_part&& part);
explicit manifold_shape(const std::vector<manifold_part>& parts);
explicit manifold_shape(std::vector<manifold_part>&& parts);
const std::vector<ManifoldPart>& parts() const { return parts_; }
const std::vector<manifold_part>& parts() const { return parts_; }
std::optional<manifold::Manifold> as_manifold() const;
virtual std::string_view backend_id() const { return "manifold"; }
virtual void Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const;
virtual void Serialize(const ifcopenshell::geometry::taxonomy::matrix4& place, std::string&) const;
virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const;
virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const;
virtual int surface_genus() const;
virtual bool is_manifold() const;
@@ -51,40 +51,40 @@ public:
virtual int num_faces() const;
virtual double bounding_box(void*&) const;
virtual std::pair<IfcGeom::OpaqueCoordinate<3>, IfcGeom::OpaqueCoordinate<3>> bounding_box() const;
virtual std::pair<ifcopenshell::geom::opaque_coordinate<3>, ifcopenshell::geom::opaque_coordinate<3>> bounding_box() const;
virtual void set_box(void* b);
virtual IfcGeom::OpaqueNumber length();
virtual IfcGeom::OpaqueNumber area();
virtual IfcGeom::OpaqueNumber volume();
virtual ifcopenshell::geom::opaque_number length();
virtual ifcopenshell::geom::opaque_number area();
virtual ifcopenshell::geom::opaque_number volume();
virtual IfcGeom::OpaqueCoordinate<3> position();
virtual IfcGeom::OpaqueCoordinate<3> axis();
virtual IfcGeom::OpaqueCoordinate<4> plane_equation();
virtual ifcopenshell::geom::opaque_coordinate<3> position();
virtual ifcopenshell::geom::opaque_coordinate<3> axis();
virtual ifcopenshell::geom::opaque_coordinate<4> plane_equation();
virtual std::vector<IfcGeom::ConversionResultShape*> convex_decomposition();
virtual IfcGeom::ConversionResultShape* halfspaces();
virtual IfcGeom::ConversionResultShape* box();
virtual IfcGeom::ConversionResultShape* solid();
virtual IfcGeom::ConversionResultShape* wrap_in_compound();
virtual std::vector<ifcopenshell::geom::conversion_result_shape*> convex_decomposition();
virtual ifcopenshell::geom::conversion_result_shape* halfspaces();
virtual ifcopenshell::geom::conversion_result_shape* box();
virtual ifcopenshell::geom::conversion_result_shape* solid();
virtual ifcopenshell::geom::conversion_result_shape* wrap_in_compound();
virtual std::vector<IfcGeom::ConversionResultShape*> vertices();
virtual std::vector<IfcGeom::ConversionResultShape*> edges();
virtual std::vector<IfcGeom::ConversionResultShape*> facets();
virtual std::vector<ifcopenshell::geom::conversion_result_shape*> vertices();
virtual std::vector<ifcopenshell::geom::conversion_result_shape*> edges();
virtual std::vector<ifcopenshell::geom::conversion_result_shape*> facets();
virtual IfcGeom::ConversionResultShape* add(IfcGeom::ConversionResultShape*);
virtual IfcGeom::ConversionResultShape* subtract(IfcGeom::ConversionResultShape*);
virtual IfcGeom::ConversionResultShape* intersect(IfcGeom::ConversionResultShape*);
virtual IfcGeom::ConversionResultShape* concat(IfcGeom::ConversionResultShape*);
virtual ifcopenshell::geom::conversion_result_shape* add(ifcopenshell::geom::conversion_result_shape*);
virtual ifcopenshell::geom::conversion_result_shape* subtract(ifcopenshell::geom::conversion_result_shape*);
virtual ifcopenshell::geom::conversion_result_shape* intersect(ifcopenshell::geom::conversion_result_shape*);
virtual ifcopenshell::geom::conversion_result_shape* concat(ifcopenshell::geom::conversion_result_shape*);
virtual std::size_t map(IfcGeom::OpaqueCoordinate<4>& from, IfcGeom::OpaqueCoordinate<4>& to);
virtual std::size_t map(const std::vector<IfcGeom::OpaqueCoordinate<4>>& from, const std::vector<IfcGeom::OpaqueCoordinate<4>>& to);
virtual IfcGeom::ConversionResultShape* moved(ifcopenshell::geometry::taxonomy::matrix4::ptr) const;
virtual std::size_t map(ifcopenshell::geom::opaque_coordinate<4>& from, ifcopenshell::geom::opaque_coordinate<4>& to);
virtual std::size_t map(const std::vector<ifcopenshell::geom::opaque_coordinate<4>>& from, const std::vector<ifcopenshell::geom::opaque_coordinate<4>>& to);
virtual ifcopenshell::geom::conversion_result_shape* moved(ifcopenshell::geom::taxonomy::matrix4::ptr) const;
virtual bool surface_area_along_direction(double tol, const ifcopenshell::geometry::taxonomy::matrix4::ptr&, double& along_x, double& along_y, double& along_z) const;
virtual bool surface_area_along_direction(double tol, const ifcopenshell::geom::taxonomy::matrix4::ptr&, double& along_x, double& along_y, double& along_z) const;
private:
std::vector<ManifoldPart> parts_;
std::vector<manifold_part> parts_;
};
}