mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-02 04:59:52 +00:00
Remove _t suffixes from public types
Rename header-scope aliases, enums, and helper types while retaining descriptive names where dropping the suffix would create a collision. Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -31,15 +31,15 @@ typedef polyhedron::Facet_const_handle facet_const_handle;
|
||||
typedef polyhedron::Halfedge_around_facet_const_circulator halfedge_around_facet_circulator;
|
||||
|
||||
namespace {
|
||||
cgal_placement_t make_transform(const ifcopenshell::geom::taxonomy::matrix4& place) {
|
||||
cgal_placement make_transform(const ifcopenshell::geom::taxonomy::matrix4& place) {
|
||||
const auto& m = place.ccomponents();
|
||||
return cgal_placement_t(
|
||||
return cgal_placement(
|
||||
m(0, 0), m(0, 1), m(0, 2), m(0, 3),
|
||||
m(1, 0), m(1, 1), m(1, 2), m(1, 3),
|
||||
m(2, 0), m(2, 1), m(2, 2), m(2, 3));
|
||||
}
|
||||
|
||||
opaque_coordinate<3> opaque_point(const cgal_point_t& p) {
|
||||
opaque_coordinate<3> opaque_point(const cgal_point& p) {
|
||||
return opaque_coordinate<3>(
|
||||
NumberType(p.cartesian(0)),
|
||||
NumberType(p.cartesian(1)),
|
||||
@@ -54,7 +54,7 @@ namespace {
|
||||
return ((-*minel) > *maxel) ? (-*minel) : *maxel;
|
||||
}
|
||||
|
||||
opaque_coordinate<3> opaque_axis(const cgal_vector_t& v) {
|
||||
opaque_coordinate<3> opaque_axis(const cgal_vector& v) {
|
||||
auto maxval = max_abs3(v.x(), v.y(), v.z());
|
||||
if (maxval == 0) {
|
||||
throw std::runtime_error("Invalid shape type");
|
||||
@@ -66,7 +66,7 @@ namespace {
|
||||
);
|
||||
}
|
||||
|
||||
opaque_coordinate<4> opaque_plane(const cgal_plane_t& p) {
|
||||
opaque_coordinate<4> opaque_plane(const cgal_plane& p) {
|
||||
auto maxval = max_abs3(p.a(), p.b(), p.c());
|
||||
if (maxval == 0) {
|
||||
throw std::runtime_error("Invalid shape type");
|
||||
@@ -79,16 +79,16 @@ namespace {
|
||||
);
|
||||
}
|
||||
|
||||
cgal_plane_t plane_from_opaque(const opaque_coordinate<4>& p) {
|
||||
cgal_plane plane_from_opaque(const opaque_coordinate<4>& p) {
|
||||
#ifdef IFOPSH_SIMPLE_KERNEL
|
||||
return cgal_plane_t(
|
||||
return cgal_plane(
|
||||
p.get(0).to_double(),
|
||||
p.get(1).to_double(),
|
||||
p.get(2).to_double(),
|
||||
p.get(3).to_double()
|
||||
);
|
||||
#else
|
||||
return cgal_plane_t(
|
||||
return cgal_plane(
|
||||
p.get(0).value_as<CGAL::Epeck::FT>(),
|
||||
p.get(1).value_as<CGAL::Epeck::FT>(),
|
||||
p.get(2).value_as<CGAL::Epeck::FT>(),
|
||||
@@ -104,7 +104,7 @@ namespace {
|
||||
});
|
||||
}
|
||||
|
||||
void apply_normalized_plane_map(const plane_map<kernel_>& mp, std::list<cgal_plane_t>& planes) {
|
||||
void apply_normalized_plane_map(const plane_map<kernel_>& mp, std::list<cgal_plane>& planes) {
|
||||
for (auto& plane : planes) {
|
||||
auto it = mp.find(normalized_plane_for_map<kernel_>(plane));
|
||||
if (it != mp.end()) {
|
||||
@@ -113,10 +113,10 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
cgal_vector_t wire_normal(const cgal_wire_t& wire) {
|
||||
cgal_vector wire_normal(const cgal_wire& wire) {
|
||||
typename kernel_::FT a(0), b(0), c(0);
|
||||
if (wire.size() < 3) {
|
||||
return cgal_vector_t(a, b, c);
|
||||
return cgal_vector(a, b, c);
|
||||
}
|
||||
for (std::size_t i = 0; i < wire.size(); ++i) {
|
||||
const auto& curr = wire[i];
|
||||
@@ -125,10 +125,10 @@ namespace {
|
||||
b += (curr.z() - next.z()) * (curr.x() + next.x());
|
||||
c += (curr.x() - next.x()) * (curr.y() + next.y());
|
||||
}
|
||||
return cgal_vector_t(a, b, c);
|
||||
return cgal_vector(a, b, c);
|
||||
}
|
||||
|
||||
cgal_point_t wire_centroid(const cgal_wire_t& wire) {
|
||||
cgal_point wire_centroid(const cgal_wire& wire) {
|
||||
if (wire.empty()) {
|
||||
throw std::runtime_error("Invalid shape type");
|
||||
}
|
||||
@@ -139,10 +139,10 @@ namespace {
|
||||
}
|
||||
}
|
||||
kernel_::FT n(wire.size());
|
||||
return cgal_point_t(p[0] / n, p[1] / n, p[2] / n);
|
||||
return cgal_point(p[0] / n, p[1] / n, p[2] / n);
|
||||
}
|
||||
|
||||
kernel_::FT wire_length(const cgal_wire_t& wire) {
|
||||
kernel_::FT wire_length(const cgal_wire& wire) {
|
||||
kernel_::FT len(0);
|
||||
if (wire.size() < 2) {
|
||||
return len;
|
||||
@@ -156,7 +156,7 @@ namespace {
|
||||
return len;
|
||||
}
|
||||
|
||||
kernel_::FT wire_area(const cgal_wire_t& wire) {
|
||||
kernel_::FT wire_area(const cgal_wire& wire) {
|
||||
kernel_::FT area(0);
|
||||
if (wire.size() < 3) {
|
||||
return area;
|
||||
@@ -170,8 +170,8 @@ namespace {
|
||||
return area;
|
||||
}
|
||||
|
||||
cgal_wire_t moved_wire(const cgal_wire_t& wire, const cgal_placement_t& trsf) {
|
||||
cgal_wire_t result;
|
||||
cgal_wire moved_wire(const cgal_wire& wire, const cgal_placement& trsf) {
|
||||
cgal_wire result;
|
||||
result.reserve(wire.size());
|
||||
for (const auto& point : wire) {
|
||||
result.push_back(point.transform(trsf));
|
||||
@@ -179,12 +179,12 @@ namespace {
|
||||
return result;
|
||||
}
|
||||
|
||||
void write_off_point(std::stringstream& sstream, const cgal_point_t& point) {
|
||||
void write_off_point(std::stringstream& sstream, const cgal_point& point) {
|
||||
sstream << "OFF\n1 0 0\n";
|
||||
sstream << point.x() << " " << point.y() << " " << point.z() << "\n";
|
||||
}
|
||||
|
||||
void write_off_wire(std::stringstream& sstream, const cgal_wire_t& wire) {
|
||||
void write_off_wire(std::stringstream& sstream, const cgal_wire& wire) {
|
||||
const bool face = wire.size() >= 3;
|
||||
sstream << "OFF\n" << wire.size() << " " << (face ? 1 : 0) << " 0\n";
|
||||
for (const auto& point : wire) {
|
||||
@@ -268,12 +268,12 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_shape_t& shape, bool convex, ifcopenshell::logger& logger) {
|
||||
ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_polyhedron& shape, bool convex, ifcopenshell::logger& logger) {
|
||||
shape_ = shape;
|
||||
convex_tag_ = convex;
|
||||
auto& poly = std::get<cgal_shape_t>(*shape_);
|
||||
auto& poly = std::get<cgal_polyhedron>(*shape_);
|
||||
|
||||
std::set<cgal_shape_t::Facet_handle> faces_to_remove;
|
||||
std::set<cgal_polyhedron::Facet_handle> faces_to_remove;
|
||||
|
||||
for (const auto& face : CGAL::faces(poly)) {
|
||||
auto V = newell(*face).to_vector();
|
||||
@@ -315,30 +315,30 @@ ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_shape_t& shape, bool conve
|
||||
}
|
||||
}
|
||||
|
||||
ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_point_t& point, bool convex) {
|
||||
ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_point& point, bool convex) {
|
||||
shape_ = point;
|
||||
convex_tag_ = convex;
|
||||
}
|
||||
|
||||
ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_wire_t& wire, bool convex) {
|
||||
ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_wire& wire, bool convex) {
|
||||
shape_ = wire;
|
||||
convex_tag_ = convex;
|
||||
}
|
||||
|
||||
const cgal_shape_t& ifcopenshell::geom::cgal_shape::poly() const {
|
||||
const cgal_polyhedron& ifcopenshell::geom::cgal_shape::poly() const {
|
||||
#ifndef IFOPSH_SIMPLE_KERNEL
|
||||
to_poly();
|
||||
#endif
|
||||
if (!shape_ || !std::holds_alternative<cgal_shape_t>(*shape_)) {
|
||||
if (!shape_ || !std::holds_alternative<cgal_polyhedron>(*shape_)) {
|
||||
throw std::runtime_error("Invalid shape type");
|
||||
}
|
||||
return std::get<cgal_shape_t>(*shape_);
|
||||
return std::get<cgal_polyhedron>(*shape_);
|
||||
}
|
||||
|
||||
#ifndef IFOPSH_SIMPLE_KERNEL
|
||||
void ifcopenshell::geom::cgal_shape::to_poly() const {
|
||||
if (!shape_) {
|
||||
cgal_shape_t poly;
|
||||
cgal_polyhedron poly;
|
||||
convert_to_polyhedron(*nef_, poly, std::numeric_limits<std::size_t>::max());
|
||||
if (poly.size_of_vertices() > 0) {
|
||||
// @todo why is this necessary? we have the mark of the volumes?
|
||||
@@ -372,15 +372,15 @@ void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings se
|
||||
const bool all_triangles = std::all_of(base_shape.facets_begin(), base_shape.facets_end(), [](auto f) { return f.is_triangle(); });
|
||||
const bool has_iden_transform = place.is_identity();
|
||||
|
||||
std::unique_ptr<cgal_shape_t> shape_copy_holder;
|
||||
cgal_shape_t* shape_to_use;
|
||||
std::unique_ptr<cgal_polyhedron> shape_copy_holder;
|
||||
cgal_polyhedron* shape_to_use;
|
||||
|
||||
if (!all_triangles || !has_iden_transform) {
|
||||
// A copy is made when triangulate_faces() is required or when vertex positions need be transformed
|
||||
shape_copy_holder.reset(new cgal_shape_t(base_shape));
|
||||
shape_copy_holder.reset(new cgal_polyhedron(base_shape));
|
||||
shape_to_use = shape_copy_holder.get();
|
||||
} else {
|
||||
shape_to_use = const_cast<cgal_shape_t*>(&base_shape);
|
||||
shape_to_use = const_cast<cgal_polyhedron*>(&base_shape);
|
||||
}
|
||||
|
||||
const bool setting_use_original_edges = settings.get<ifcopenshell::geom::settings::CgalEmitOriginalEdges>().get();
|
||||
@@ -396,7 +396,7 @@ void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings se
|
||||
const auto& m = place.ccomponents();
|
||||
|
||||
// @todo check
|
||||
const cgal_placement_t trsf(
|
||||
const cgal_placement trsf(
|
||||
m(0, 0), m(0, 1), m(0, 2), m(0, 3),
|
||||
m(1, 0), m(1, 1), m(1, 2), m(1, 3),
|
||||
m(2, 0), m(2, 1), m(2, 2), m(2, 3));
|
||||
@@ -455,8 +455,8 @@ void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings se
|
||||
}
|
||||
}
|
||||
|
||||
// std::map<cgal_vertex_descriptor_t, kernel_::Vector_3> vertex_normals;
|
||||
// boost::associative_property_map<std::map<cgal_vertex_descriptor_t, kernel_::Vector_3>> vertex_normals_map(vertex_normals);
|
||||
// std::map<cgal_vertex_descriptor, kernel_::Vector_3> vertex_normals;
|
||||
// boost::associative_property_map<std::map<cgal_vertex_descriptor, kernel_::Vector_3>> vertex_normals_map(vertex_normals);
|
||||
|
||||
// Triangulate the shape and compute the normals
|
||||
std::map<facet_const_handle, kernel_::Vector_3> face_normals;
|
||||
@@ -601,7 +601,7 @@ void ifcopenshell::geom::cgal_shape::Serialize(const ifcopenshell::geom::taxonom
|
||||
}
|
||||
write_off_wire(sstream, w);
|
||||
} else {
|
||||
cgal_shape_t s = poly();
|
||||
cgal_polyhedron s = poly();
|
||||
|
||||
if (!place.is_identity()) {
|
||||
const auto trsf = make_transform(place);
|
||||
@@ -794,7 +794,7 @@ opaque_coordinate<3> ifcopenshell::geom::cgal_shape::axis()
|
||||
auto shp = poly();
|
||||
if (shp.size_of_facets() == 1) {
|
||||
auto pl = facet_plane_equation()(*shp.facets_begin());
|
||||
return opaque_axis(cgal_vector_t(pl.a(), pl.b(), pl.c()));
|
||||
return opaque_axis(cgal_vector(pl.a(), pl.b(), pl.c()));
|
||||
} else {
|
||||
throw std::runtime_error("Invalid shape type");
|
||||
}
|
||||
@@ -804,7 +804,7 @@ opaque_coordinate<4> ifcopenshell::geom::cgal_shape::plane_equation()
|
||||
{
|
||||
if (is_wire() && wire().size() >= 3) {
|
||||
auto normal = wire_normal(wire());
|
||||
return opaque_plane(cgal_plane_t(wire().front(), CGAL::Direction_3<kernel_>(normal)));
|
||||
return opaque_plane(cgal_plane(wire().front(), CGAL::Direction_3<kernel_>(normal)));
|
||||
}
|
||||
auto shp = poly();
|
||||
if (shp.size_of_facets() == 1) {
|
||||
@@ -891,15 +891,15 @@ std::vector<conversion_result_shape*> ifcopenshell::geom::cgal_shape::edges()
|
||||
if (is_wire()) {
|
||||
const auto& w = wire();
|
||||
for (std::size_t i = 1; i < w.size(); ++i) {
|
||||
result.push_back(new cgal_shape(cgal_wire_t{ w[i - 1], w[i] }));
|
||||
result.push_back(new cgal_shape(cgal_wire{ w[i - 1], w[i] }));
|
||||
}
|
||||
if (w.size() > 2) {
|
||||
result.push_back(new cgal_shape(cgal_wire_t{ w.back(), w.front() }));
|
||||
result.push_back(new cgal_shape(cgal_wire{ w.back(), w.front() }));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
for (auto ed : poly().edges()) {
|
||||
result.push_back(new cgal_shape(cgal_wire_t{ ed.vertex()->point(), ed.opposite()->vertex()->point() }));
|
||||
result.push_back(new cgal_shape(cgal_wire{ ed.vertex()->point(), ed.opposite()->vertex()->point() }));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -917,7 +917,7 @@ std::vector<conversion_result_shape*> ifcopenshell::geom::cgal_shape::facets()
|
||||
return result;
|
||||
}
|
||||
for (auto face : faces(poly())) {
|
||||
std::vector<cgal_point_t> ps;
|
||||
std::vector<cgal_point> ps;
|
||||
|
||||
auto it = face->facet_begin();
|
||||
do {
|
||||
@@ -959,7 +959,7 @@ conversion_result_shape* ifcopenshell::geom::cgal_shape::intersect(conversion_re
|
||||
namespace {
|
||||
template <typename polyhedron_type>
|
||||
void concatenate_polyhedra(polyhedron_type& p1, const polyhedron_type& p2) {
|
||||
std::vector<cgal_point_t> points1, points2;
|
||||
std::vector<cgal_point> points1, points2;
|
||||
std::vector<std::vector<std::size_t>> faces1, faces2;
|
||||
|
||||
// Extract soups
|
||||
@@ -1012,7 +1012,7 @@ conversion_result_shape* ifcopenshell::geom::cgal_shape::moved(ifcopenshell::geo
|
||||
return new cgal_shape(moved_wire(wire(), trsf), convex_tag_);
|
||||
}
|
||||
|
||||
cgal_shape_t s = poly();
|
||||
cgal_polyhedron s = poly();
|
||||
for (auto &vertex : s.vertex_handles()) {
|
||||
vertex->point() = vertex->point().transform(trsf);
|
||||
}
|
||||
|
||||
@@ -47,17 +47,17 @@
|
||||
|
||||
#define kernel_ Simplekernel_
|
||||
#define cgal_shape SimpleCgalShape
|
||||
#define cgal_placement_t cgal_simple_placement_t
|
||||
#define cgal_point_t cgal_simple_point_t
|
||||
#define cgal_direction_t cgal_simple_direction_t
|
||||
#define cgal_vector_t cgal_simple_vector_t
|
||||
#define cgal_plane_t cgal_simple_plane_t
|
||||
#define cgal_curve_t cgal_simple_curve_t
|
||||
#define cgal_wire_t cgal_simple_wire_t
|
||||
#define cgal_face_t cgal_simple_face_t
|
||||
#define cgal_shape_t cgal_simple_shape_t
|
||||
#define cgal_vertex_descriptor_t cgal_simple_vertex_descriptor_t
|
||||
#define cgal_face_descriptor_t cgal_simple_face_descriptor_t
|
||||
#define cgal_placement cgal_simple_placement
|
||||
#define cgal_point cgal_simple_point
|
||||
#define cgal_direction cgal_simple_direction
|
||||
#define cgal_vector cgal_simple_vector
|
||||
#define cgal_plane cgal_simple_plane
|
||||
#define cgal_curve cgal_simple_curve
|
||||
#define cgal_wire cgal_simple_wire
|
||||
#define cgal_face cgal_simple_face
|
||||
#define cgal_polyhedron cgal_simple_polyhedron
|
||||
#define cgal_vertex_descriptor cgal_simple_vertex_descriptor
|
||||
#define cgal_face_descriptor cgal_simple_face_descriptor
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel kernel_;
|
||||
|
||||
@@ -69,24 +69,24 @@ typedef CGAL::Exact_predicates_exact_constructions_kernel kernel_;
|
||||
|
||||
#endif
|
||||
|
||||
typedef kernel_::Aff_transformation_3 cgal_placement_t;
|
||||
typedef kernel_::Point_3 cgal_point_t;
|
||||
typedef kernel_::Vector_3 cgal_direction_t;
|
||||
typedef kernel_::Vector_3 cgal_vector_t;
|
||||
typedef kernel_::Plane_3 cgal_plane_t;
|
||||
typedef std::vector<kernel_::Point_3> cgal_curve_t;
|
||||
typedef std::vector<kernel_::Point_3> cgal_wire_t;
|
||||
typedef kernel_::Aff_transformation_3 cgal_placement;
|
||||
typedef kernel_::Point_3 cgal_point;
|
||||
typedef kernel_::Vector_3 cgal_direction;
|
||||
typedef kernel_::Vector_3 cgal_vector;
|
||||
typedef kernel_::Plane_3 cgal_plane;
|
||||
typedef std::vector<kernel_::Point_3> cgal_curve;
|
||||
typedef std::vector<kernel_::Point_3> cgal_wire;
|
||||
|
||||
namespace {
|
||||
struct cgal_face_t {
|
||||
cgal_wire_t outer;
|
||||
std::vector<cgal_wire_t> inner;
|
||||
struct cgal_face {
|
||||
cgal_wire outer;
|
||||
std::vector<cgal_wire> inner;
|
||||
};
|
||||
}
|
||||
|
||||
typedef CGAL::Polyhedron_3<kernel_> cgal_shape_t;
|
||||
typedef boost::graph_traits<CGAL::Polyhedron_3<kernel_>>::vertex_descriptor cgal_vertex_descriptor_t;
|
||||
typedef boost::graph_traits<CGAL::Polyhedron_3<kernel_>>::face_descriptor cgal_face_descriptor_t;
|
||||
typedef CGAL::Polyhedron_3<kernel_> cgal_polyhedron;
|
||||
typedef boost::graph_traits<CGAL::Polyhedron_3<kernel_>>::vertex_descriptor cgal_vertex_descriptor;
|
||||
typedef boost::graph_traits<CGAL::Polyhedron_3<kernel_>>::face_descriptor cgal_face_descriptor;
|
||||
|
||||
#include "../../../ifcgeom/conversion_result.h"
|
||||
|
||||
@@ -179,18 +179,18 @@ namespace ifcopenshell { namespace geom {
|
||||
|
||||
class IFC_GEOMLIBRARY_API cgal_shape : public ifcopenshell::geom::conversion_result_shape {
|
||||
private:
|
||||
typedef std::variant<cgal_shape_t, cgal_point_t, cgal_wire_t> cgal_shape_storage_t;
|
||||
typedef std::variant<cgal_polyhedron, cgal_point, cgal_wire> cgal_shape_storage;
|
||||
|
||||
bool convex_tag_ = false;
|
||||
mutable std::optional<cgal_shape_storage_t> shape_;
|
||||
mutable std::optional<cgal_shape_storage> shape_;
|
||||
#ifndef IFOPSH_SIMPLE_KERNEL
|
||||
mutable std::optional<CGAL::Nef_polyhedron_3<kernel_>> nef_;
|
||||
#endif
|
||||
public:
|
||||
|
||||
cgal_shape(const cgal_shape_t& shape, bool convex = false, ifcopenshell::logger& logger = ifcopenshell::logger::root());
|
||||
cgal_shape(const cgal_point_t& point, bool convex = false);
|
||||
cgal_shape(const cgal_wire_t& wire, bool convex = false);
|
||||
cgal_shape(const cgal_polyhedron& shape, bool convex = false, ifcopenshell::logger& logger = ifcopenshell::logger::root());
|
||||
cgal_shape(const cgal_point& point, bool convex = false);
|
||||
cgal_shape(const cgal_wire& wire, bool convex = false);
|
||||
|
||||
#ifndef IFOPSH_SIMPLE_KERNEL
|
||||
cgal_shape(const CGAL::Nef_polyhedron_3<kernel_>& shape, bool convex = false) {
|
||||
@@ -218,13 +218,13 @@ namespace ifcopenshell { namespace geom {
|
||||
return "cgal";
|
||||
#endif
|
||||
}
|
||||
operator const cgal_shape_t& () const { return poly(); }
|
||||
const cgal_shape_t& poly() const;
|
||||
bool is_poly() const { return shape_ && std::holds_alternative<cgal_shape_t>(*shape_); }
|
||||
bool is_point() const { return shape_ && std::holds_alternative<cgal_point_t>(*shape_); }
|
||||
bool is_wire() const { return shape_ && std::holds_alternative<cgal_wire_t>(*shape_); }
|
||||
const cgal_point_t& point() const { return std::get<cgal_point_t>(*shape_); }
|
||||
const cgal_wire_t& wire() const { return std::get<cgal_wire_t>(*shape_); }
|
||||
operator const cgal_polyhedron& () const { return poly(); }
|
||||
const cgal_polyhedron& poly() const;
|
||||
bool is_poly() const { return shape_ && std::holds_alternative<cgal_polyhedron>(*shape_); }
|
||||
bool is_point() const { return shape_ && std::holds_alternative<cgal_point>(*shape_); }
|
||||
bool is_wire() const { return shape_ && std::holds_alternative<cgal_wire>(*shape_); }
|
||||
const cgal_point& point() const { return std::get<cgal_point>(*shape_); }
|
||||
const cgal_wire& wire() const { return std::get<cgal_wire>(*shape_); }
|
||||
|
||||
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, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const;
|
||||
virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const;
|
||||
|
||||
@@ -45,16 +45,16 @@ using ifcopenshell::logger;
|
||||
namespace {
|
||||
struct polyhedron_builder : public CGAL::Modifier_base<CGAL::Polyhedron_3<kernel_>::HalfedgeDS> {
|
||||
private:
|
||||
std::list<cgal_face_t> *face_list;
|
||||
std::list<cgal_face> *face_list;
|
||||
logger& logger_;
|
||||
public:
|
||||
std::optional<cgal_shape_t> from_soup;
|
||||
polyhedron_builder(std::list<cgal_face_t> *face_list, logger& logger = ifcopenshell::logger::root());
|
||||
std::optional<cgal_polyhedron> from_soup;
|
||||
polyhedron_builder(std::list<cgal_face> *face_list, logger& logger = ifcopenshell::logger::root());
|
||||
void operator()(CGAL::Polyhedron_3<kernel_>::HalfedgeDS &hds);
|
||||
};
|
||||
}
|
||||
|
||||
CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_polyhedron(std::list<cgal_face_t> &face_list, bool stitch_borders, logger& logger) {
|
||||
CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_polyhedron(std::list<cgal_face> &face_list, bool stitch_borders, logger& logger) {
|
||||
|
||||
// Naive creation
|
||||
CGAL::Polyhedron_3<kernel_> polyhedron;
|
||||
@@ -107,7 +107,7 @@ CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_polyhedron(const C
|
||||
}
|
||||
}
|
||||
|
||||
CGAL::Nef_polyhedron_3<kernel_> ifcopenshell::geom::utils::create_nef_polyhedron(std::list<cgal_face_t> &face_list, logger& logger) {
|
||||
CGAL::Nef_polyhedron_3<kernel_> ifcopenshell::geom::utils::create_nef_polyhedron(std::list<cgal_face> &face_list, logger& logger) {
|
||||
CGAL::Polyhedron_3<kernel_> polyhedron = create_polyhedron(face_list, true, logger);
|
||||
if (polyhedron.is_closed()) {
|
||||
try {
|
||||
@@ -159,7 +159,7 @@ CGAL::Nef_polyhedron_3<kernel_> ifcopenshell::geom::utils::create_nef_polyhedron
|
||||
}
|
||||
#endif
|
||||
|
||||
bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) {
|
||||
bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_polyhedron& shape) {
|
||||
for (auto& f : l->children) {
|
||||
if (f->basis && f->basis->kind() != taxonomy::PLANE) {
|
||||
logger().error("UNS", 3, "CGAL Kernel: Non-planar faces not supported at the moment");
|
||||
@@ -207,7 +207,7 @@ bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) {
|
||||
}
|
||||
}
|
||||
|
||||
std::list<cgal_face_t> face_list;
|
||||
std::list<cgal_face> face_list;
|
||||
for (auto& f : l->children) {
|
||||
bool success = false;
|
||||
try {
|
||||
@@ -234,7 +234,7 @@ bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) {
|
||||
return shape.size_of_facets();
|
||||
}
|
||||
|
||||
bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list<cgal_face_t>& result) {
|
||||
bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list<cgal_face>& result) {
|
||||
int num_outer_bounds = 0;
|
||||
|
||||
for (auto& bound : face->children) {
|
||||
@@ -246,14 +246,14 @@ bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list<cgal_face_t>
|
||||
return false;
|
||||
}
|
||||
|
||||
cgal_face_t mf;
|
||||
cgal_face mf;
|
||||
|
||||
for (auto& bound : face->children) {
|
||||
|
||||
const bool is_interior = !(bound->external.value_or(false) || face->children.size() == 1);
|
||||
// single face bound is always external... even if not marked as such
|
||||
|
||||
cgal_wire_t wire;
|
||||
cgal_wire wire;
|
||||
if (!convert(bound, wire)) {
|
||||
logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 81, "Failed to process face boundary loop", bound->instance);
|
||||
return false;
|
||||
@@ -267,7 +267,7 @@ bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list<cgal_face_t>
|
||||
|
||||
if (num_outer_bounds > 1) {
|
||||
result.push_back(mf);
|
||||
mf = cgal_face_t{};
|
||||
mf = cgal_face{};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,16 +286,16 @@ bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list<cgal_face_t>
|
||||
namespace {
|
||||
// @todo obsolete?
|
||||
/*
|
||||
bool convert_curve(cgal_kernel* kernel, const taxonomy::ptr curve, cgal_wire_t& builder) {
|
||||
bool convert_curve(cgal_kernel* kernel, const taxonomy::ptr curve, cgal_wire& builder) {
|
||||
if (auto e = taxonomy::dcast<taxonomy::edge>(curve)) {
|
||||
if (true || e->basis == nullptr) {
|
||||
if (builder.empty()) {
|
||||
const auto& p = std::get<taxonomy::point3::ptr>(e->start);
|
||||
cgal_point_t pnt(p->ccomponents()(0), p->ccomponents()(1), p->ccomponents()(2));
|
||||
cgal_point pnt(p->ccomponents()(0), p->ccomponents()(1), p->ccomponents()(2));
|
||||
builder.push_back(pnt);
|
||||
}
|
||||
const auto& p = std::get<taxonomy::point3::ptr>(e->end);
|
||||
cgal_point_t pnt(p->ccomponents()(0), p->ccomponents()(1), p->ccomponents()(2));
|
||||
cgal_point pnt(p->ccomponents()(0), p->ccomponents()(1), p->ccomponents()(2));
|
||||
builder.push_back(pnt);
|
||||
} else if (e->basis->kind() == taxonomy::CIRCLE) {
|
||||
// @todo
|
||||
@@ -552,7 +552,7 @@ namespace {
|
||||
typedef CGAL::Box_intersection_d::Box_with_handle_d<double, 3, int*> box;
|
||||
|
||||
namespace {
|
||||
void loop_to_segments(const cgal_wire_t& wire, std::vector<kernel_::Segment_3>& segments) {
|
||||
void loop_to_segments(const cgal_wire& wire, std::vector<kernel_::Segment_3>& segments) {
|
||||
for (int i = 0; i < wire.size(); ++i) {
|
||||
int j = (i + 1) % wire.size();
|
||||
segments.emplace_back(wire[i], wire[j]);
|
||||
@@ -604,7 +604,7 @@ namespace {
|
||||
}
|
||||
|
||||
namespace {
|
||||
cgal_direction_t newell(const std::vector<cgal_point_t> & loop) {
|
||||
cgal_direction newell(const std::vector<cgal_point> & loop) {
|
||||
kernel_::FT a(0.0), b(0.0), c(0.0);
|
||||
for (size_t i = 0; i < loop.size(); ++i) {
|
||||
auto & curr = loop[i];
|
||||
@@ -613,7 +613,7 @@ namespace {
|
||||
b += (curr.z() - next.z()) * (curr.x() + next.x());
|
||||
c += (curr.x() - next.x()) * (curr.y() + next.y());
|
||||
}
|
||||
return cgal_direction_t(a, b, c);
|
||||
return cgal_direction(a, b, c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ namespace {
|
||||
return polygon;
|
||||
}
|
||||
|
||||
CGAL::Polygon_2<kernel_> wire_to_polygon_2(const cgal_wire_t& w) {
|
||||
CGAL::Polygon_2<kernel_> wire_to_polygon_2(const cgal_wire& w) {
|
||||
CGAL::Polygon_2<kernel_> polygon;
|
||||
for (auto& p : w) {
|
||||
CGAL::Point_2<kernel_> pnt(p.cartesian(0), p.cartesian(1));
|
||||
@@ -637,8 +637,8 @@ namespace {
|
||||
return polygon;
|
||||
}
|
||||
|
||||
cgal_face_t wire_to_face(const cgal_wire_t& w) {
|
||||
cgal_face_t f;
|
||||
cgal_face wire_to_face(const cgal_wire& w) {
|
||||
cgal_face f;
|
||||
f.outer = w;
|
||||
return f;
|
||||
}
|
||||
@@ -651,10 +651,10 @@ namespace {
|
||||
polygon_2_to_wire(const CGAL::Aff_transformation_3<kernel_>& t)
|
||||
: t_(t) {}
|
||||
|
||||
cgal_wire_t operator()(const CGAL::Polygon_2<kernel_>& p) {
|
||||
cgal_wire_t w;
|
||||
cgal_wire operator()(const CGAL::Polygon_2<kernel_>& p) {
|
||||
cgal_wire w;
|
||||
for (auto it = p.vertices_begin(); it != p.vertices_end(); ++it) {
|
||||
cgal_point_t P(it->cartesian(0), it->cartesian(1), 0);
|
||||
cgal_point P(it->cartesian(0), it->cartesian(1), 0);
|
||||
P = t_.transform(P);
|
||||
w.push_back(P);
|
||||
}
|
||||
@@ -662,7 +662,7 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
void transform_in_place(cgal_wire_t& w, const CGAL::Aff_transformation_3<kernel_>& t) {
|
||||
void transform_in_place(cgal_wire& w, const CGAL::Aff_transformation_3<kernel_>& t) {
|
||||
for (auto& p : w) {
|
||||
p = p.transform(t);
|
||||
}
|
||||
@@ -670,7 +670,7 @@ namespace {
|
||||
}
|
||||
|
||||
namespace {
|
||||
void face_to_poly_with_holes(const cgal_face_t& face, CGAL::Polygon_with_holes_2<kernel_>& pwh, CGAL::Aff_transformation_3<kernel_>& place) {
|
||||
void face_to_poly_with_holes(const cgal_face& face, CGAL::Polygon_with_holes_2<kernel_>& pwh, CGAL::Aff_transformation_3<kernel_>& place) {
|
||||
// static
|
||||
kernel_::Vector_3 Z(0, 0, 1);
|
||||
// static
|
||||
@@ -714,7 +714,7 @@ namespace {
|
||||
}
|
||||
|
||||
|
||||
bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
|
||||
bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire& result) {
|
||||
// @todo only implement polygonal loops
|
||||
|
||||
std::vector<taxonomy::point3> points;
|
||||
@@ -748,9 +748,9 @@ bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
|
||||
}
|
||||
|
||||
// Parse and store the points in a sequence
|
||||
cgal_wire_t polygon = std::vector<kernel_::Point_3>();
|
||||
cgal_wire polygon = std::vector<kernel_::Point_3>();
|
||||
for (auto& p : points) {
|
||||
cgal_point_t pnt(p.ccomponents()(0), p.ccomponents()(1), p.ccomponents()(2));
|
||||
cgal_point pnt(p.ccomponents()(0), p.ccomponents()(1), p.ccomponents()(2));
|
||||
polygon.push_back(pnt);
|
||||
}
|
||||
|
||||
@@ -772,7 +772,7 @@ bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
|
||||
}
|
||||
|
||||
{
|
||||
std::set<cgal_point_t> visited_points;
|
||||
std::set<cgal_point> visited_points;
|
||||
for (auto& p : polygon) {
|
||||
if (visited_points.find(p) != visited_points.end()) {
|
||||
logger().error("GEO", 85, "Skipping self-intersecting loop", loop->instance);
|
||||
@@ -841,7 +841,7 @@ bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
|
||||
|
||||
|
||||
bool cgal_kernel::convert_impl(const taxonomy::shell::ptr shell, conversion_results& results) {
|
||||
cgal_shape_t shape;
|
||||
cgal_polyhedron shape;
|
||||
if (!convert(shell, shape)) {
|
||||
return false;
|
||||
}
|
||||
@@ -862,7 +862,7 @@ bool cgal_kernel::convert_impl(const taxonomy::solid::ptr solid, conversion_resu
|
||||
logger().error("UNS", 5, "Multiple shells in solid not supported at the moment");
|
||||
return false;
|
||||
}
|
||||
cgal_shape_t shape;
|
||||
cgal_polyhedron shape;
|
||||
if (solid->children.empty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -883,16 +883,16 @@ bool cgal_kernel::convert_impl(const taxonomy::solid::ptr solid, conversion_resu
|
||||
}
|
||||
|
||||
namespace {
|
||||
bool convert_placement(const Eigen::Matrix4d& m, cgal_placement_t& trsf) {
|
||||
bool convert_placement(const Eigen::Matrix4d& m, cgal_placement& trsf) {
|
||||
// @todo check
|
||||
trsf = cgal_placement_t(
|
||||
trsf = cgal_placement(
|
||||
m(0, 0), m(0, 1), m(0, 2), m(0, 3),
|
||||
m(1, 0), m(1, 1), m(1, 2), m(1, 3),
|
||||
m(2, 0), m(2, 1), m(2, 2), m(2, 3));
|
||||
|
||||
return true;
|
||||
}
|
||||
bool convert_placement(ifcopenshell::geom::taxonomy::matrix4::ptr place, cgal_placement_t& trsf) {
|
||||
bool convert_placement(ifcopenshell::geom::taxonomy::matrix4::ptr place, cgal_placement& trsf) {
|
||||
return convert_placement(place->ccomponents(), trsf);
|
||||
}
|
||||
}
|
||||
@@ -905,17 +905,17 @@ bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::b
|
||||
CGAL::Nef_nary_union_3<CGAL::Nef_polyhedron_3<kernel_>> second_operand_collector;
|
||||
size_t second_operand_collector_size = 0;
|
||||
|
||||
std::list<std::pair<express::base, std::list<cgal_shape_t>>> operands;
|
||||
std::list<std::pair<express::base, std::list<cgal_polyhedron>>> operands;
|
||||
|
||||
std::list<express::base> second_operand_instances;
|
||||
std::list<cgal_shape_t> first_operands, second_operands;
|
||||
std::list<cgal_polyhedron> first_operands, second_operands;
|
||||
std::list<CGAL::Nef_polyhedron_3<kernel_>> first_operands_nef, second_operands_nef;
|
||||
|
||||
for (auto& shp : entity_shapes) {
|
||||
cgal_shape_t entity_shape = *std::static_pointer_cast<cgal_shape>(shp.Shape());
|
||||
cgal_polyhedron entity_shape = *std::static_pointer_cast<cgal_shape>(shp.Shape());
|
||||
const auto& m = shp.Placement()->ccomponents();
|
||||
if (!m.isIdentity()) {
|
||||
cgal_placement_t trsf;
|
||||
cgal_placement trsf;
|
||||
convert_placement(m, trsf);
|
||||
for (auto &vertex : vertices(entity_shape)) {
|
||||
vertex->point() = vertex->point().transform(trsf);
|
||||
@@ -943,13 +943,13 @@ bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::b
|
||||
abstract_kernel::convert(op.first, opening_shapes);
|
||||
|
||||
for (unsigned int i = 0; i < opening_shapes.size(); ++i) {
|
||||
cgal_shape_t entity_shape_unlocated = *std::static_pointer_cast<cgal_shape>(opening_shapes[i].Shape());
|
||||
cgal_shape_t entity_shape(entity_shape_unlocated);
|
||||
cgal_polyhedron entity_shape_unlocated = *std::static_pointer_cast<cgal_shape>(opening_shapes[i].Shape());
|
||||
cgal_polyhedron entity_shape(entity_shape_unlocated);
|
||||
auto gtrsf = opening_shapes[i].Placement();
|
||||
// @todo check
|
||||
Eigen::Matrix4d m = opening_trsf.ccomponents() * gtrsf->ccomponents();
|
||||
if (!m.isIdentity()) {
|
||||
cgal_placement_t trsf;
|
||||
cgal_placement trsf;
|
||||
convert_placement(m, trsf);
|
||||
for (auto &vertex : vertices(entity_shape)) {
|
||||
vertex->point() = vertex->point().transform(trsf);
|
||||
@@ -999,7 +999,7 @@ bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::b
|
||||
}
|
||||
|
||||
a -= opening_union;
|
||||
cgal_shape_t a_poly;
|
||||
cgal_polyhedron a_poly;
|
||||
|
||||
try {
|
||||
a.convert_to_polyhedron(a_poly);
|
||||
@@ -1019,7 +1019,7 @@ bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::b
|
||||
|
||||
|
||||
bool cgal_kernel::convert_impl(const taxonomy::extrusion::ptr extrusion, conversion_results& results) {
|
||||
cgal_shape_t shape;
|
||||
cgal_polyhedron shape;
|
||||
if (!convert(extrusion, shape)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1032,11 +1032,11 @@ bool cgal_kernel::convert_impl(const taxonomy::extrusion::ptr extrusion, convers
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::direction3::ptr direction, double height, cgal_shape_t& shape) {
|
||||
bool cgal_kernel::process_extrusion(const cgal_face& bottom_face, taxonomy::direction3::ptr direction, double height, cgal_polyhedron& shape) {
|
||||
|
||||
bool has_inner_bounds = !bottom_face.inner.empty();
|
||||
|
||||
std::list<cgal_wire_t> faces_to_extrude;
|
||||
std::list<cgal_wire> faces_to_extrude;
|
||||
std::set<std::pair<size_t, size_t>> internal_edges;
|
||||
|
||||
// CGAL::Cartesian_converter<CGAL::Epeck, CGAL::Simple_cartesian<double>> C;
|
||||
@@ -1097,10 +1097,10 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
|
||||
faces_to_extrude.push_front(bottom_face.outer);
|
||||
}
|
||||
|
||||
std::list<cgal_face_t> face_list;
|
||||
std::list<cgal_face> face_list;
|
||||
|
||||
auto& fs = direction->ccomponents();
|
||||
cgal_direction_t dir(fs(0), fs(1), fs(2));
|
||||
cgal_direction dir(fs(0), fs(1), fs(2));
|
||||
|
||||
int wi = 0;
|
||||
for (auto& w : faces_to_extrude) {
|
||||
@@ -1109,13 +1109,13 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
|
||||
const bool reverse = fnorm * dir > 0;
|
||||
|
||||
if (reverse) {
|
||||
cgal_face_t bottom_face;
|
||||
cgal_face bottom_face;
|
||||
for (auto vertex = w.rbegin(); vertex != w.rend(); ++vertex) {
|
||||
bottom_face.outer.push_back(*vertex);
|
||||
}
|
||||
face_list.push_back(bottom_face);
|
||||
} else {
|
||||
face_list.push_back(cgal_face_t{ w });
|
||||
face_list.push_back(cgal_face{ w });
|
||||
}
|
||||
|
||||
int si = 0;
|
||||
@@ -1131,7 +1131,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
|
||||
next_vertex = w.begin();
|
||||
}
|
||||
|
||||
cgal_face_t side_face;
|
||||
cgal_face side_face;
|
||||
if (reverse) {
|
||||
side_face.outer.push_back(*current_vertex + height * dir);
|
||||
side_face.outer.push_back(*next_vertex + height * dir);
|
||||
@@ -1146,7 +1146,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
|
||||
face_list.push_back(side_face);
|
||||
}
|
||||
|
||||
cgal_face_t top_face;
|
||||
cgal_face top_face;
|
||||
if (reverse) {
|
||||
for (auto vertex = w.begin(); vertex != w.end(); ++vertex) {
|
||||
top_face.outer.push_back(*vertex + height * dir);
|
||||
@@ -1173,7 +1173,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
|
||||
// std::cout << "Inner wire" << std::endl;
|
||||
face_list.clear();
|
||||
|
||||
cgal_face_t hole_bottom_face;
|
||||
cgal_face hole_bottom_face;
|
||||
hole_bottom_face.outer = inner;
|
||||
remove_duplicate_points_from_loop(hole_bottom_face.outer);
|
||||
face_list.push_back(hole_bottom_face);
|
||||
@@ -1185,7 +1185,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
|
||||
++next_vertex;
|
||||
if (next_vertex == inner.end()) {
|
||||
next_vertex = inner.begin();
|
||||
} cgal_face_t hole_side_face;
|
||||
} cgal_face hole_side_face;
|
||||
hole_side_face.outer.push_back(*next_vertex);
|
||||
hole_side_face.outer.push_back(*current_vertex);
|
||||
hole_side_face.outer.push_back(*current_vertex + height * dir);
|
||||
@@ -1193,7 +1193,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
|
||||
face_list.push_back(hole_side_face);
|
||||
}
|
||||
|
||||
cgal_face_t hole_top_face;
|
||||
cgal_face hole_top_face;
|
||||
for (std::vector<kernel_::Point_3>::const_reverse_iterator vertex = inner.rbegin();
|
||||
vertex != inner.rend();
|
||||
++vertex) {
|
||||
@@ -1226,14 +1226,14 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
|
||||
*/
|
||||
}
|
||||
|
||||
bool cgal_kernel::convert(const taxonomy::extrusion::ptr extrusion, cgal_shape_t &shape) {
|
||||
bool cgal_kernel::convert(const taxonomy::extrusion::ptr extrusion, cgal_polyhedron &shape) {
|
||||
const double& height = extrusion->depth;
|
||||
if (height < settings_.get<settings::Precision>().get()) {
|
||||
logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", extrusion->instance);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::list<cgal_face_t> bottom_face;
|
||||
std::list<cgal_face> bottom_face;
|
||||
if (!convert(taxonomy::cast<taxonomy::face>(taxonomy::cast<taxonomy::face>(extrusion->basis)), bottom_face) || bottom_face.size() != 1) {
|
||||
return false;
|
||||
}
|
||||
@@ -1242,15 +1242,15 @@ bool cgal_kernel::convert(const taxonomy::extrusion::ptr extrusion, cgal_shape_t
|
||||
}
|
||||
|
||||
CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(double d) {
|
||||
cgal_face_t bottom_face;
|
||||
cgal_face bottom_face;
|
||||
bottom_face.outer.push_back(kernel_::Point_3(-d, -d, -d));
|
||||
bottom_face.outer.push_back(kernel_::Point_3(+d, -d, -d));
|
||||
bottom_face.outer.push_back(kernel_::Point_3(+d, +d, -d));
|
||||
bottom_face.outer.push_back(kernel_::Point_3(-d, +d, -d));
|
||||
|
||||
cgal_direction_t dir(0, 0, 2 * d);
|
||||
cgal_direction dir(0, 0, 2 * d);
|
||||
|
||||
std::list<cgal_face_t> face_list = { bottom_face };
|
||||
std::list<cgal_face> face_list = { bottom_face };
|
||||
|
||||
for (std::vector<kernel_::Point_3>::const_iterator current_vertex = bottom_face.outer.begin();
|
||||
current_vertex != bottom_face.outer.end();
|
||||
@@ -1262,7 +1262,7 @@ CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(double d) {
|
||||
next_vertex = bottom_face.outer.begin();
|
||||
}
|
||||
|
||||
cgal_face_t side_face;
|
||||
cgal_face side_face;
|
||||
|
||||
side_face.outer.push_back(*next_vertex);
|
||||
side_face.outer.push_back(*current_vertex);
|
||||
@@ -1272,7 +1272,7 @@ CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(double d) {
|
||||
face_list.push_back(side_face);
|
||||
}
|
||||
|
||||
cgal_face_t top_face;
|
||||
cgal_face top_face;
|
||||
|
||||
for (std::vector<kernel_::Point_3>::const_reverse_iterator vertex = bottom_face.outer.rbegin();
|
||||
vertex != bottom_face.outer.rend();
|
||||
@@ -1287,7 +1287,7 @@ CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(double d) {
|
||||
|
||||
|
||||
CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(const kernel_::Point_3& lower, const kernel_::Point_3& upper) {
|
||||
cgal_face_t bottom_face;
|
||||
cgal_face bottom_face;
|
||||
|
||||
auto a0 = lower.cartesian(0);
|
||||
auto a1 = lower.cartesian(1);
|
||||
@@ -1302,9 +1302,9 @@ CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(const kernel_
|
||||
bottom_face.outer.push_back(kernel_::Point_3(b0, b1, a2));
|
||||
bottom_face.outer.push_back(kernel_::Point_3(a0, b1, a2));
|
||||
|
||||
cgal_direction_t dir(0, 0, b2 - a2);
|
||||
cgal_direction dir(0, 0, b2 - a2);
|
||||
|
||||
std::list<cgal_face_t> face_list = { bottom_face };
|
||||
std::list<cgal_face> face_list = { bottom_face };
|
||||
|
||||
for (std::vector<kernel_::Point_3>::const_iterator current_vertex = bottom_face.outer.begin();
|
||||
current_vertex != bottom_face.outer.end();
|
||||
@@ -1316,7 +1316,7 @@ CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(const kernel_
|
||||
next_vertex = bottom_face.outer.begin();
|
||||
}
|
||||
|
||||
cgal_face_t side_face;
|
||||
cgal_face side_face;
|
||||
|
||||
side_face.outer.push_back(*next_vertex);
|
||||
side_face.outer.push_back(*current_vertex);
|
||||
@@ -1326,7 +1326,7 @@ CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(const kernel_
|
||||
face_list.push_back(side_face);
|
||||
}
|
||||
|
||||
cgal_face_t top_face;
|
||||
cgal_face top_face;
|
||||
|
||||
for (std::vector<kernel_::Point_3>::const_reverse_iterator vertex = bottom_face.outer.rbegin();
|
||||
vertex != bottom_face.outer.rend();
|
||||
@@ -1361,8 +1361,8 @@ bool cgal_kernel::thin_solid(const CGAL::Nef_polyhedron_3<kernel_>& a, CGAL::Nef
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, const std::list<cgal_shape_t>& first_operands, const std::list<CGAL::Nef_polyhedron_3<kernel_>>& first_operands_nef, const std::list<kernel_::Plane_3>& all_operand_planes, const cgal_shape_t& shape_const, CGAL::Nef_polyhedron_3<kernel_>& result, boolean_operand_preprocess proc) {
|
||||
cgal_shape_t shape = shape_const;
|
||||
bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, const std::list<cgal_polyhedron>& first_operands, const std::list<CGAL::Nef_polyhedron_3<kernel_>>& first_operands_nef, const std::list<kernel_::Plane_3>& all_operand_planes, const cgal_polyhedron& shape_const, CGAL::Nef_polyhedron_3<kernel_>& result, boolean_operand_preprocess proc) {
|
||||
cgal_polyhedron shape = shape_const;
|
||||
|
||||
if (!shape.is_valid()) {
|
||||
logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 90, "Conversion to Nef will fail. Invalid geometry:", log_reference);
|
||||
@@ -1397,7 +1397,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference,
|
||||
|
||||
if (proc == PP_SNAP_POINTS_TO_FIRST_OPERAND) {
|
||||
static int NN = 0;
|
||||
typedef CGAL::AABB_face_graph_triangle_primitive<cgal_shape_t> aabb_face_graph_primitive;
|
||||
typedef CGAL::AABB_face_graph_triangle_primitive<cgal_polyhedron> aabb_face_graph_primitive;
|
||||
#if CGAL_VERSION_NR >= 1060000000
|
||||
typedef CGAL::AABB_traits_3<kernel_, aabb_face_graph_primitive> aabb_face_graph_traits;
|
||||
#else
|
||||
@@ -1506,7 +1506,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference,
|
||||
int j = 0;
|
||||
for (auto& a : x->operands_) {
|
||||
auto A = a->evaluate();
|
||||
cgal_shape_t p;
|
||||
cgal_polyhedron p;
|
||||
A.convert_to_Polyhedron(p);
|
||||
std::string fn = "debug-orig-" + std::to_string(i) + "-" + std::to_string(j++) + ".off";
|
||||
std::ofstream(fn.c_str()) << p;
|
||||
@@ -1519,7 +1519,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference,
|
||||
int j = 0;
|
||||
for (auto& a : x->operands_) {
|
||||
auto A = a->evaluate();
|
||||
cgal_shape_t p;
|
||||
cgal_polyhedron p;
|
||||
A.convert_to_Polyhedron(p);
|
||||
std::string fn = "debug-mapped-" + std::to_string(i) + "-" + std::to_string(j++) + ".off";
|
||||
std::ofstream(fn.c_str()) << p;
|
||||
@@ -1559,7 +1559,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference,
|
||||
*/
|
||||
|
||||
try {
|
||||
cgal_shape_t convert_back;
|
||||
cgal_polyhedron convert_back;
|
||||
result.convert_to_polyhedron(convert_back);
|
||||
} catch (CGAL::Failure_exception& e) {
|
||||
logger().notice("GEO", 99, e);
|
||||
@@ -1655,18 +1655,18 @@ bool cgal_kernel::process_as_2d_polygon(const taxonomy::boolean_result::ptr br,
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<cgal_wire_t> wires;
|
||||
std::vector<cgal_wire> wires;
|
||||
try {
|
||||
std::transform(extrusions.begin(), extrusions.end(), std::back_inserter(wires), [this](extrusion_pair& p) {
|
||||
auto ex = p.second;
|
||||
auto ex_basis = taxonomy::cast<taxonomy::face>(ex->basis);
|
||||
if (ex_basis->children.size() == 1 && ex_basis->children[0]->kind() == taxonomy::LOOP) {
|
||||
auto l = (taxonomy::loop::ptr) ex_basis->children[0];
|
||||
cgal_wire_t w;
|
||||
cgal_placement_t trsf;
|
||||
cgal_wire w;
|
||||
cgal_placement trsf;
|
||||
convert_placement(ex->matrix, trsf);
|
||||
|
||||
cgal_placement_t trsf2;
|
||||
cgal_placement trsf2;
|
||||
if (p.first) {
|
||||
convert_placement(*p.first, trsf2);
|
||||
}
|
||||
@@ -1717,7 +1717,7 @@ bool cgal_kernel::process_as_2d_polygon(const taxonomy::boolean_result::ptr br,
|
||||
#include <CGAL/Polygon_mesh_processing/measure.h>
|
||||
|
||||
namespace {
|
||||
bool orthogonal_edge_length(const cgal_shape_t& shape, const cgal_direction_t& face_normal, std::pair<kernel_::FT, kernel_::FT>& distances) {
|
||||
bool orthogonal_edge_length(const cgal_polyhedron& shape, const cgal_direction& face_normal, std::pair<kernel_::FT, kernel_::FT>& distances) {
|
||||
static double inf = 1.e9; // std::numeric_limits<double>::infinity();
|
||||
|
||||
std::vector<double> lengths;
|
||||
@@ -1767,13 +1767,13 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
bool cgal_kernel::process_as_2d_polygon(const std::list<std::list<std::pair<express::base, cgal_shape_t>>>& operands, std::list<CGAL::Polygon_2<kernel_>>& loops, double& z0, double& z1) {
|
||||
bool cgal_kernel::process_as_2d_polygon(const std::list<std::list<std::pair<express::base, cgal_polyhedron>>>& operands, std::list<CGAL::Polygon_2<kernel_>>& loops, double& z0, double& z1) {
|
||||
if (operands.front().size() != 1) {
|
||||
return false;
|
||||
}
|
||||
auto& first_op = operands.front().front().second;
|
||||
|
||||
cgal_shape_t::Facet_handle largest_face;
|
||||
cgal_polyhedron::Facet_handle largest_face;
|
||||
kernel_::FT largest_area = 0;
|
||||
|
||||
for (auto& f : faces(first_op)) {
|
||||
@@ -1785,7 +1785,7 @@ bool cgal_kernel::process_as_2d_polygon(const std::list<std::list<std::pair<expr
|
||||
}
|
||||
|
||||
// @todo adapt newell() to work on facet circulator as well
|
||||
std::vector<cgal_point_t> f_points;
|
||||
std::vector<cgal_point> f_points;
|
||||
CGAL::Polyhedron_3<kernel_>::Halfedge_around_facet_const_circulator current_halfedge = largest_face->facet_begin();
|
||||
do {
|
||||
f_points.push_back(current_halfedge->vertex()->point());
|
||||
@@ -1831,7 +1831,7 @@ namespace {
|
||||
void project_onto_plane(const taxonomy::plane& p, It i, It j, Fn fn) {
|
||||
auto mi = p.matrix->ccomponents().inverse();
|
||||
Eigen::Vector4d v;
|
||||
std::for_each(i, j, [&mi, &v, &fn](const cgal_shape_t& shp) {
|
||||
std::for_each(i, j, [&mi, &v, &fn](const cgal_polyhedron& shp) {
|
||||
for (auto& vv : vertices(shp)) {
|
||||
auto& p = vv->point();
|
||||
v = Eigen::Vector4d(CGAL::to_double(p.cartesian(0)),
|
||||
@@ -1911,7 +1911,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
|
||||
}
|
||||
|
||||
std::transform(decom_polies.begin(), decom_polies.end(), std::back_inserter(results), [this, &br, &z0, &z1, &first_item_style](const CGAL::Polygon_2<kernel_>& p2) {
|
||||
cgal_face_t f;
|
||||
cgal_face f;
|
||||
std::transform(
|
||||
p2.vertices_begin(),
|
||||
p2.vertices_end(),
|
||||
@@ -1921,13 +1921,13 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
|
||||
}
|
||||
);
|
||||
|
||||
cgal_shape_t shp;
|
||||
cgal_polyhedron shp;
|
||||
auto d = taxonomy::make<taxonomy::direction3>(0, 0, 1);
|
||||
process_extrusion(f, d, z1 - z0, shp);
|
||||
|
||||
for (auto it = shp.vertices_begin(); it != shp.vertices_end(); ++it) {
|
||||
auto p = it->point();
|
||||
it->point() = cgal_point_t(p.cartesian(0), p.cartesian(1), p.cartesian(2) + z0);
|
||||
it->point() = cgal_point(p.cartesian(0), p.cartesian(1), p.cartesian(2) + z0);
|
||||
}
|
||||
|
||||
return conversion_result(
|
||||
@@ -1956,7 +1956,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
|
||||
|
||||
taxonomy::style::ptr first_item_style = nullptr;
|
||||
|
||||
std::list<std::pair<express::base, std::list<cgal_shape_t>>> operands;
|
||||
std::list<std::pair<express::base, std::list<cgal_polyhedron>>> operands;
|
||||
|
||||
for (auto& c : br->children) {
|
||||
// abstract_kernel::convert(c, results);
|
||||
@@ -2005,15 +2005,15 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
|
||||
|
||||
kernel_::Point_3 lower(uvw_min[0] - eps, uvw_min[1] - eps, wmin);
|
||||
kernel_::Point_3 upper(uvw_max[0] + eps, uvw_max[1] + eps, wmax);
|
||||
cgal_shape_t box = utils::create_cube(lower, upper);
|
||||
cgal_placement_t pl;
|
||||
cgal_polyhedron box = utils::create_cube(lower, upper);
|
||||
cgal_placement pl;
|
||||
convert_placement(p.matrix, pl);
|
||||
for (auto& v : vertices(box)) {
|
||||
v->point() = v->point().transform(pl);
|
||||
}
|
||||
|
||||
if (!face->children.empty()) {
|
||||
std::list<cgal_face_t> fs;
|
||||
std::list<cgal_face> fs;
|
||||
if (!convert(face, fs) || fs.size() != 1) {
|
||||
return false;
|
||||
}
|
||||
@@ -2030,7 +2030,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
|
||||
|
||||
// static
|
||||
auto z = taxonomy::make<taxonomy::direction3>(0, 0, 1);
|
||||
cgal_shape_t poly;
|
||||
cgal_polyhedron poly;
|
||||
process_extrusion(fs.front(), z, 200, poly);
|
||||
for (auto& v : vertices(poly)) {
|
||||
v->point() = kernel_::Point_3(
|
||||
@@ -2039,7 +2039,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
|
||||
v->point().cartesian(2) - 100
|
||||
);
|
||||
};
|
||||
cgal_placement_t trsf;
|
||||
cgal_placement trsf;
|
||||
convert_placement(face->matrix, trsf);
|
||||
for (auto& v : vertices(poly)) {
|
||||
v->point() = v->point().transform(trsf);
|
||||
@@ -2047,7 +2047,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
|
||||
CGAL::Nef_polyhedron_3<kernel_> poly_nef(poly);
|
||||
CGAL::Nef_polyhedron_3<kernel_> box_nef(box);
|
||||
auto intersection = poly_nef * box_nef;
|
||||
cgal_shape_t intersection_poly;
|
||||
cgal_polyhedron intersection_poly;
|
||||
intersection.convert_to_polyhedron(intersection_poly);
|
||||
operands.back().second.push_back(intersection_poly);
|
||||
} else {
|
||||
@@ -2068,10 +2068,10 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
|
||||
}
|
||||
|
||||
for (auto it = cr.begin(); it != cr.end(); ++it) {
|
||||
cgal_shape_t entity_shape_unlocated = *std::static_pointer_cast<cgal_shape>(it->Shape());
|
||||
cgal_shape_t entity_shape(entity_shape_unlocated);
|
||||
cgal_polyhedron entity_shape_unlocated = *std::static_pointer_cast<cgal_shape>(it->Shape());
|
||||
cgal_polyhedron entity_shape(entity_shape_unlocated);
|
||||
if (!it->Placement()->is_identity()) {
|
||||
cgal_placement_t trsf;
|
||||
cgal_placement trsf;
|
||||
convert_placement(it->Placement(), trsf);
|
||||
for (auto &vertex : vertices(entity_shape)) {
|
||||
vertex->point() = vertex->point().transform(trsf);
|
||||
@@ -2121,7 +2121,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
|
||||
|
||||
first = true;
|
||||
|
||||
std::list<cgal_shape_t> ops;
|
||||
std::list<cgal_polyhedron> ops;
|
||||
std::list<CGAL::Nef_polyhedron_3<kernel_>> nefops;
|
||||
std::list<kernel_::Plane_3> all_operand_planes;
|
||||
|
||||
@@ -2162,7 +2162,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
|
||||
a -= second_operand_collector.get_union();
|
||||
}
|
||||
|
||||
cgal_shape_t a_poly;
|
||||
cgal_polyhedron a_poly;
|
||||
|
||||
// CGAL::Nef_polyhedron_3<kernel_> b;
|
||||
// thin_solid(a, b);
|
||||
@@ -2185,7 +2185,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
|
||||
#endif
|
||||
}
|
||||
|
||||
polyhedron_builder::polyhedron_builder(std::list<cgal_face_t>* face_list, logger& logger) : face_list(face_list), logger_(logger) {
|
||||
polyhedron_builder::polyhedron_builder(std::list<cgal_face>* face_list, logger& logger) : face_list(face_list), logger_(logger) {
|
||||
}
|
||||
|
||||
#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
|
||||
|
||||
@@ -60,11 +60,11 @@ namespace ifcopenshell {
|
||||
namespace utils {
|
||||
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_cube(double d);
|
||||
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_cube(const kernel_::Point_3& lower, const kernel_::Point_3& upper);
|
||||
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_polyhedron(std::list<cgal_face_t> &face_list, bool stitch_borders = false, logger& logger = ifcopenshell::logger::root());
|
||||
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_polyhedron(std::list<cgal_face> &face_list, bool stitch_borders = false, logger& logger = ifcopenshell::logger::root());
|
||||
|
||||
#ifndef IFOPSH_SIMPLE_KERNEL
|
||||
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_polyhedron(const CGAL::Nef_polyhedron_3<kernel_> &nef_polyhedron, logger& logger = ifcopenshell::logger::root());
|
||||
IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<kernel_> create_nef_polyhedron(std::list<cgal_face_t> &face_list, logger& logger = ifcopenshell::logger::root());
|
||||
IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<kernel_> create_nef_polyhedron(std::list<cgal_face> &face_list, logger& logger = ifcopenshell::logger::root());
|
||||
IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<kernel_> create_nef_polyhedron(CGAL::Polyhedron_3<kernel_> &polyhedron, logger& logger = ifcopenshell::logger::root());
|
||||
#endif
|
||||
}
|
||||
@@ -82,7 +82,7 @@ namespace ifcopenshell {
|
||||
PP_NONE
|
||||
};
|
||||
|
||||
bool preprocess_boolean_operand(const express::base& log_reference, const std::list<cgal_shape_t>& first_operands, const std::list<CGAL::Nef_polyhedron_3<kernel_>>& first_operands_nef, const std::list<kernel_::Plane_3>& all_operand_planes, const cgal_shape_t& shape_const, CGAL::Nef_polyhedron_3<kernel_>& result, boolean_operand_preprocess proc);
|
||||
bool preprocess_boolean_operand(const express::base& log_reference, const std::list<cgal_polyhedron>& first_operands, const std::list<CGAL::Nef_polyhedron_3<kernel_>>& first_operands_nef, const std::list<kernel_::Plane_3>& all_operand_planes, const cgal_polyhedron& shape_const, CGAL::Nef_polyhedron_3<kernel_>& result, boolean_operand_preprocess proc);
|
||||
|
||||
bool thin_solid(const CGAL::Nef_polyhedron_3<kernel_>& a, CGAL::Nef_polyhedron_3<kernel_>& result);
|
||||
|
||||
@@ -109,15 +109,15 @@ namespace ifcopenshell {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool convert(const taxonomy::extrusion::ptr, cgal_shape_t&);
|
||||
bool convert(const taxonomy::face::ptr, std::list<cgal_face_t>&);
|
||||
bool convert(const taxonomy::loop::ptr, cgal_wire_t&);
|
||||
// bool convert(const taxonomy::matrix4::ptr, cgal_placement_t&);
|
||||
bool convert(const taxonomy::shell::ptr, cgal_shape_t&);
|
||||
bool convert(const taxonomy::extrusion::ptr, cgal_polyhedron&);
|
||||
bool convert(const taxonomy::face::ptr, std::list<cgal_face>&);
|
||||
bool convert(const taxonomy::loop::ptr, cgal_wire&);
|
||||
// bool convert(const taxonomy::matrix4::ptr, cgal_placement&);
|
||||
bool convert(const taxonomy::shell::ptr, cgal_polyhedron&);
|
||||
|
||||
bool process_extrusion(const cgal_face_t& bottom_face, taxonomy::direction3::ptr direction, double height, cgal_shape_t& shape);
|
||||
bool process_extrusion(const cgal_face& bottom_face, taxonomy::direction3::ptr direction, double height, cgal_polyhedron& shape);
|
||||
bool process_as_2d_polygon(const taxonomy::boolean_result::ptr br, std::list<CGAL::Polygon_2<kernel_>>& loops, double& z0, double& z1);
|
||||
bool process_as_2d_polygon(const std::list<std::list<std::pair<express::base, cgal_shape_t>>>& operands, std::list<CGAL::Polygon_2<kernel_>>& loops, double& z0, double& z1);
|
||||
bool process_as_2d_polygon(const std::list<std::list<std::pair<express::base, cgal_polyhedron>>>& operands, std::list<CGAL::Polygon_2<kernel_>>& loops, double& z0, double& z1);
|
||||
|
||||
virtual bool convert_impl(const taxonomy::shell::ptr, ifcopenshell::geom::conversion_results&);
|
||||
virtual bool convert_impl(const taxonomy::extrusion::ptr, ifcopenshell::geom::conversion_results&);
|
||||
|
||||
Reference in New Issue
Block a user