mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
Silence remaining compiler warnings
Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -6,46 +6,6 @@
|
||||
using namespace ifcopenshell::geom;
|
||||
using namespace ifcopenshell::geom::kernels;
|
||||
|
||||
// @todo should we reapply the technique to apply openings in batches?
|
||||
namespace {
|
||||
struct opening_sorter {
|
||||
bool operator()(const std::pair<double, TopoDS_Shape>& a, const std::pair<double, TopoDS_Shape>& b) const {
|
||||
return a.first > b.first;
|
||||
}
|
||||
};
|
||||
|
||||
bool apply_in_batches(ifcopenshell::geom::util::boolean_settings bst, const TopoDS_Shape& first_operand, std::vector< std::pair<double, TopoDS_Shape> >& opening_vector, BOPAlgo_Operation occ_op, TopoDS_Shape& result) {
|
||||
auto it = opening_vector.begin();
|
||||
auto jt = it;
|
||||
|
||||
result = first_operand;
|
||||
for (;; ++it) {
|
||||
if (it == opening_vector.end() || jt->first / it->first > 10.) {
|
||||
|
||||
NCollection_List<TopoDS_Shape> opening_list;
|
||||
for (auto kt = jt; kt < it; ++kt) {
|
||||
opening_list.Append(kt->second);
|
||||
}
|
||||
|
||||
TopoDS_Shape intermediate_result;
|
||||
if (ifcopenshell::geom::util::boolean_operation(bst, result, opening_list, occ_op, intermediate_result)) {
|
||||
result = intermediate_result;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
jt = it;
|
||||
}
|
||||
|
||||
if (it == opening_vector.end()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
BOPAlgo_Operation op_to_occt(taxonomy::boolean_result::operation_type t) {
|
||||
switch (t) {
|
||||
@@ -53,6 +13,7 @@ namespace {
|
||||
case taxonomy::boolean_result::INTERSECTION: return BOPAlgo_COMMON;
|
||||
case taxonomy::boolean_result::SUBTRACTION: return BOPAlgo_CUT;
|
||||
}
|
||||
throw std::invalid_argument("Unsupported boolean operation");
|
||||
}
|
||||
|
||||
bool get_single_child(const TopoDS_Shape& s, TopoDS_Shape& child) {
|
||||
|
||||
@@ -310,13 +310,13 @@ bool ifcopenshell::geom::util::is_extrusion(const gp_Vec & v, const TopoDS_Shape
|
||||
// top face. When neither of these categories the shape is not a extrusion
|
||||
// or the extrusion direction is not orthogonal to its basis.
|
||||
for (int i = 1; i < mapping.Extent(); ++i) {
|
||||
auto& s = mapping.FindKey(i);
|
||||
if (s.ShapeType() != TopAbs_EDGE) {
|
||||
auto& shape = mapping.FindKey(i);
|
||||
if (shape.ShapeType() != TopAbs_EDGE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// @todo use a linear tolernace and the face extrimities, see #2218
|
||||
const TopoDS_Edge& e = TopoDS::Edge(s);
|
||||
const TopoDS_Edge& e = TopoDS::Edge(shape);
|
||||
if (!get_edge_axis(e, ax)) {
|
||||
// curved
|
||||
curved_orthogonal.Add(e);
|
||||
@@ -585,7 +585,7 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
|
||||
std::map<int, int> edge_index_to_shape_index;
|
||||
|
||||
std::vector<TopoDS_Shape> shapes;
|
||||
std::vector<std::pair<size_t, TopoDS_Edge>> edges;
|
||||
std::vector<std::pair<int, TopoDS_Edge>> edges;
|
||||
// First is the outer wire
|
||||
std::vector<TopoDS_Wire> wires;
|
||||
|
||||
@@ -646,19 +646,19 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
|
||||
BRepBndLib::Add(exp.Current(), b);
|
||||
b.Enlarge(eps);
|
||||
|
||||
for (auto& i : edge_tree.select_box(b)) {
|
||||
if (i == edge_index) {
|
||||
for (auto& candidate_index : edge_tree.select_box(b)) {
|
||||
if (candidate_index == edge_index) {
|
||||
// Skip self-selection
|
||||
continue;
|
||||
}
|
||||
|
||||
if (edges[i].first == shape_index) {
|
||||
if (edges[candidate_index].first == shape_index) {
|
||||
// Skip edges of the same operand
|
||||
continue;
|
||||
}
|
||||
|
||||
const TopoDS_Edge& e0 = TopoDS::Edge(exp.Current());
|
||||
const TopoDS_Edge& e1 = edges[i].second;
|
||||
const TopoDS_Edge& e1 = edges[candidate_index].second;
|
||||
|
||||
double u11, u12, u21, u22, U1, U2;
|
||||
|
||||
@@ -670,9 +670,9 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
|
||||
if (!ecc.Extrema().IsParallel() && ecc.NbExtrema() >= 1) {
|
||||
// @todo: extend this to work in case of multiple extrema and curved segments.
|
||||
|
||||
for (int i = 1; i <= ecc.NbExtrema(); ++i) {
|
||||
for (int extrema_index = 1; extrema_index <= ecc.NbExtrema(); ++extrema_index) {
|
||||
gp_Pnt p1, p2;
|
||||
ecc.Points(i, p1, p2);
|
||||
ecc.Points(extrema_index, p1, p2);
|
||||
|
||||
// #3616 Only take into account orthogonal distance between closest points on curve
|
||||
// to see whether inside tolerance. Current DY is hardcoded. The sensible default
|
||||
@@ -685,7 +685,7 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
|
||||
|
||||
const bool unbounded_intersects = ortho_distance < eps;
|
||||
if (unbounded_intersects) {
|
||||
ecc.Parameters(i, U1, U2);
|
||||
ecc.Parameters(extrema_index, U1, U2);
|
||||
|
||||
if (u11 > u12) {
|
||||
std::swap(u11, u12);
|
||||
@@ -734,10 +734,10 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
|
||||
}
|
||||
|
||||
// First check for containment in outer wire
|
||||
for (auto it = ++wires.begin(); it != wires.end(); ++it) {
|
||||
for (auto wire_it = ++wires.begin(); wire_it != wires.end(); ++wire_it) {
|
||||
// Considering a single vertex is sufficient because we have already
|
||||
// guaranteed that the edges of different operands do not cross.
|
||||
TopoDS_Iterator it_ed(*it);
|
||||
TopoDS_Iterator it_ed(*wire_it);
|
||||
auto& ed = it_ed.Value();
|
||||
|
||||
TopoDS_Iterator it_v(ed);
|
||||
@@ -749,7 +749,7 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
|
||||
// A wire is not contained in the outer wire, it's a subtraction without
|
||||
// any effect and marked as redundant. Feeding it to the builder algo
|
||||
// will likely cause problems.
|
||||
redundant[std::distance(wires.begin(), it)] = true;
|
||||
redundant[std::distance(wires.begin(), wire_it)] = true;
|
||||
logger.notice("GEO", 124, "Subtraction operand outside of outer bound");
|
||||
}
|
||||
}
|
||||
@@ -758,7 +758,7 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
|
||||
// NB first wire is *not* in this tree
|
||||
ifcopenshell::geom::impl::tree<int> wire_tree;
|
||||
for (size_t wire_index = 1; wire_index < wires.size(); ++wire_index) {
|
||||
wire_tree.add(wire_index, wires[wire_index]);
|
||||
wire_tree.add(static_cast<int>(wire_index), wires[wire_index]);
|
||||
}
|
||||
|
||||
for (size_t wire_index = 1; wire_index < wires.size(); ++wire_index) {
|
||||
@@ -775,7 +775,7 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
|
||||
// than the second element.
|
||||
for (auto& other_index : wire_tree.select_box(b, true)) {
|
||||
// other_index is fully contained in wire_index
|
||||
if (wire_index == other_index) {
|
||||
if (wire_index == static_cast<size_t>(other_index)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1144,21 +1144,7 @@ bool ifcopenshell::geom::util::boolean_operation(const boolean_settings& setting
|
||||
builder->Build();
|
||||
}
|
||||
if (builder->IsDone()) {
|
||||
if (false && builder->DSFiller()->HasWarning(STANDARD_TYPE(BOPAlgo_AlertAcquiredSelfIntersection))) {
|
||||
settings.log().notice("GEO", 144, "Builder reports self-intersection in output");
|
||||
success = false;
|
||||
|
||||
/*
|
||||
const auto& ws = builder->DSFiller()->GetReport()->GetAlerts(Message_Warning);
|
||||
for (const auto& w : ws) {
|
||||
if (w->DynamicType() == STANDARD_TYPE(BOPAlgo_AlertAcquiredSelfIntersection)) {
|
||||
const auto& x = Handle(BOPAlgo_AlertAcquiredSelfIntersection)::DownCast(w)->GetShape();
|
||||
BRepTools::Write(x, "debug_x.brep");
|
||||
BRepTools::Write(*builder, "debug_r.brep");
|
||||
}
|
||||
}
|
||||
*/
|
||||
} else if(builder->DSFiller()->HasWarning(STANDARD_TYPE(BOPAlgo_AlertBadPositioning)) && !TopoDS_Iterator(*builder).More()) {
|
||||
if (builder->DSFiller()->HasWarning(STANDARD_TYPE(BOPAlgo_AlertBadPositioning)) && !TopoDS_Iterator(*builder).More()) {
|
||||
settings.log().notice("GEO", 145, "Builder reports bad positioning and result is empty");
|
||||
success = false;
|
||||
} else {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS_iterator.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <ShapeFix_Shape.hxx>
|
||||
#include <ShapeFix_ShapeTolerance.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <TopoDS.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopoDS_iterator.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
|
||||
/* Returns whether wire conforms to a polyhedron, i.e. only edges with linear curves*/
|
||||
bool ifcopenshell::geom::util::is_polyhedron(const TopoDS_Wire & wire) {
|
||||
|
||||
@@ -65,7 +65,7 @@ ifcopenshell::geom::open_cascade_kernel::faceset_helper::faceset_helper(
|
||||
gp_Pnt* p = new gp_Pnt(convert_xyz<gp_Pnt>(*points[i]));
|
||||
pnts[i].reset(p);
|
||||
B.MakeVertex(vertices[i], *p, ::Precision::Confusion());
|
||||
tree.add(i, vertices[i]);
|
||||
tree.add(static_cast<int>(i), vertices[i]);
|
||||
box.Add(*p);
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ ifcopenshell::geom::open_cascade_kernel::faceset_helper::faceset_helper(
|
||||
|
||||
auto num_retained = std::count(retained.begin(), retained.end(), true);
|
||||
|
||||
if (unique.size() != num_retained) {
|
||||
if (unique.size() != static_cast<size_t>(num_retained)) {
|
||||
ifcopenshell::logger::root().notice("GEO", 168, "Collapsed vertices from " + std::to_string(pnts.size()) + " (" + std::to_string(unique.size()) + " unique) to " + std::to_string(num_retained));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Shell.hxx>
|
||||
#include <TopoDS_iterator.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
@@ -151,9 +151,9 @@ namespace ifcopenshell::geom {
|
||||
bool should_check_again = false
|
||||
) const {
|
||||
ray v_ray;
|
||||
v_ray.origin[0] = v.X();
|
||||
v_ray.origin[1] = v.Y();
|
||||
v_ray.origin[2] = v.Z();
|
||||
v_ray.origin[0] = static_cast<float>(v.X());
|
||||
v_ray.origin[1] = static_cast<float>(v.Y());
|
||||
v_ray.origin[2] = static_cast<float>(v.Z());
|
||||
|
||||
if (should_check_again) {
|
||||
// The first check may be incorrect if it intersects
|
||||
@@ -194,12 +194,12 @@ namespace ifcopenshell::geom {
|
||||
|
||||
box box;
|
||||
// + 1e-5 for tolerance
|
||||
box.corners[0][0] = min_point[0] - 1e-5;
|
||||
box.corners[0][1] = min_point[1] - 1e-5;
|
||||
box.corners[0][2] = min_point[2] - 1e-5;
|
||||
box.corners[1][0] = max_point[0] + 1e-5;
|
||||
box.corners[1][1] = max_point[1] + 1e-5;
|
||||
box.corners[1][2] = max_point[2] + 1e-5;
|
||||
box.corners[0][0] = static_cast<float>(min_point[0] - 1e-5);
|
||||
box.corners[0][1] = static_cast<float>(min_point[1] - 1e-5);
|
||||
box.corners[0][2] = static_cast<float>(min_point[2] - 1e-5);
|
||||
box.corners[1][0] = static_cast<float>(max_point[0] + 1e-5);
|
||||
box.corners[1][1] = static_cast<float>(max_point[1] + 1e-5);
|
||||
box.corners[1][2] = static_cast<float>(max_point[2] + 1e-5);
|
||||
/*
|
||||
std::cout << "Ray "
|
||||
<< v_ray.origin[0] << " "
|
||||
@@ -273,22 +273,22 @@ namespace ifcopenshell::geom {
|
||||
gp_Vec ray_vector = e2 - e1;
|
||||
double edge_length = ray_vector.Magnitude();
|
||||
|
||||
std::array<double, 3> min_int;
|
||||
std::array<double, 3> max_int;
|
||||
std::array<double, 3> min_int{};
|
||||
std::array<double, 3> max_int{};
|
||||
|
||||
ray_vector.Normalize();
|
||||
|
||||
ray v_ray;
|
||||
v_ray.origin[0] = ray_origin.X();
|
||||
v_ray.origin[1] = ray_origin.Y();
|
||||
v_ray.origin[2] = ray_origin.Z();
|
||||
v_ray.origin[0] = static_cast<float>(ray_origin.X());
|
||||
v_ray.origin[1] = static_cast<float>(ray_origin.Y());
|
||||
v_ray.origin[2] = static_cast<float>(ray_origin.Z());
|
||||
|
||||
v_ray.dir[0] = ray_vector.X();
|
||||
v_ray.dir[1] = ray_vector.Y();
|
||||
v_ray.dir[2] = ray_vector.Z();
|
||||
v_ray.dir_inv[0] = 1.0f / ray_vector.X();
|
||||
v_ray.dir_inv[1] = 1.0f / ray_vector.Y();
|
||||
v_ray.dir_inv[2] = 1.0f / ray_vector.Z();
|
||||
v_ray.dir[0] = static_cast<float>(ray_vector.X());
|
||||
v_ray.dir[1] = static_cast<float>(ray_vector.Y());
|
||||
v_ray.dir[2] = static_cast<float>(ray_vector.Z());
|
||||
v_ray.dir_inv[0] = static_cast<float>(1.0 / ray_vector.X());
|
||||
v_ray.dir_inv[1] = static_cast<float>(1.0 / ray_vector.Y());
|
||||
v_ray.dir_inv[2] = static_cast<float>(1.0 / ray_vector.Z());
|
||||
|
||||
double min_distance = std::numeric_limits<double>::infinity();
|
||||
double max_distance = -std::numeric_limits<double>::infinity();
|
||||
@@ -305,12 +305,12 @@ namespace ifcopenshell::geom {
|
||||
|
||||
box box;
|
||||
// + 1e-5 for tolerance
|
||||
box.corners[0][0] = min_point[0] - 1e-5;
|
||||
box.corners[0][1] = min_point[1] - 1e-5;
|
||||
box.corners[0][2] = min_point[2] - 1e-5;
|
||||
box.corners[1][0] = max_point[0] + 1e-5;
|
||||
box.corners[1][1] = max_point[1] + 1e-5;
|
||||
box.corners[1][2] = max_point[2] + 1e-5;
|
||||
box.corners[0][0] = static_cast<float>(min_point[0] - 1e-5);
|
||||
box.corners[0][1] = static_cast<float>(min_point[1] - 1e-5);
|
||||
box.corners[0][2] = static_cast<float>(min_point[2] - 1e-5);
|
||||
box.corners[1][0] = static_cast<float>(max_point[0] + 1e-5);
|
||||
box.corners[1][1] = static_cast<float>(max_point[1] + 1e-5);
|
||||
box.corners[1][2] = static_cast<float>(max_point[2] + 1e-5);
|
||||
|
||||
if ( ! is_intersect_ray_box(&v_ray, &box)) {
|
||||
continue;
|
||||
@@ -491,12 +491,12 @@ namespace ifcopenshell::geom {
|
||||
std::unordered_set<int> points_not_in_b_cache;
|
||||
|
||||
double protrusion = -std::numeric_limits<double>::infinity();
|
||||
std::array<double, 3> protrusion_point;
|
||||
std::array<double, 3> surface_point;
|
||||
std::array<double, 3> protrusion_point{};
|
||||
std::array<double, 3> surface_point{};
|
||||
|
||||
double pierce = -std::numeric_limits<double>::infinity();
|
||||
std::array<double, 3> pierce_point1;
|
||||
std::array<double, 3> pierce_point2;
|
||||
std::array<double, 3> pierce_point1{};
|
||||
std::array<double, 3> pierce_point2{};
|
||||
|
||||
for (const auto& pair : bvh_clashes) {
|
||||
const int bvh_a_i = pair.first;
|
||||
@@ -573,14 +573,14 @@ namespace ifcopenshell::geom {
|
||||
|
||||
const gp_Vec& normal_a = normals_a[i];
|
||||
double v_protrusion = std::numeric_limits<double>::infinity();
|
||||
std::array<double, 3> v_protrusion_point;
|
||||
std::array<double, 3> v_surface_point;
|
||||
std::array<double, 3> v_protrusion_point{};
|
||||
std::array<double, 3> v_surface_point{};
|
||||
|
||||
// Check for protrusions.
|
||||
for (const auto& bvh_b_i : bvh_b_is) {
|
||||
for (int j=bvh_b->BegPrimitive(bvh_b_i); j<=bvh_b->EndPrimitive(bvh_b_i); ++j) {
|
||||
const std::array<int, 3>& tri = tris_b[j];
|
||||
const gp_Vec& normal_b = normals_b[j];
|
||||
const std::array<int, 3>& tri_b = tris_b[j];
|
||||
const gp_Vec& normal_b = normals_b[j];
|
||||
|
||||
tri_count_++;
|
||||
|
||||
@@ -591,9 +591,9 @@ namespace ifcopenshell::geom {
|
||||
continue;
|
||||
}
|
||||
|
||||
gp_Vec ta(verts_b[tri[0]].XYZ());
|
||||
gp_Vec tb(verts_b[tri[1]].XYZ());
|
||||
gp_Vec tc(verts_b[tri[2]].XYZ());
|
||||
gp_Vec ta(verts_b[tri_b[0]].XYZ());
|
||||
gp_Vec tb(verts_b[tri_b[1]].XYZ());
|
||||
gp_Vec tc(verts_b[tri_b[2]].XYZ());
|
||||
|
||||
for (const auto& v : points_in_b) {
|
||||
gp_Vec ray_origin(v.XYZ());
|
||||
@@ -688,10 +688,10 @@ namespace ifcopenshell::geom {
|
||||
|
||||
for (const auto& bvh_b_i : bvh_b_is) {
|
||||
for (int j=bvh_b->BegPrimitive(bvh_b_i); j<=bvh_b->EndPrimitive(bvh_b_i); ++j) {
|
||||
const std::array<int, 3>& tri = tris_b[j];
|
||||
const gp_Pnt& v1_b_pnt = verts_b[tri[0]];
|
||||
const gp_Pnt& v2_b_pnt = verts_b[tri[1]];
|
||||
const gp_Pnt& v3_b_pnt = verts_b[tri[2]];
|
||||
const std::array<int, 3>& tri_b = tris_b[j];
|
||||
const gp_Pnt& v1_b_pnt = verts_b[tri_b[0]];
|
||||
const gp_Pnt& v2_b_pnt = verts_b[tri_b[1]];
|
||||
const gp_Pnt& v3_b_pnt = verts_b[tri_b[2]];
|
||||
const gp_Vec& normal_b = normals_b[j];
|
||||
|
||||
tri_count_++;
|
||||
@@ -795,8 +795,8 @@ namespace ifcopenshell::geom {
|
||||
const std::vector<gp_Pnt>& verts_b = verts_.find(tB)->second;
|
||||
|
||||
double min_clearance = std::numeric_limits<double>::infinity();
|
||||
std::array<double, 3> clearance_point1;
|
||||
std::array<double, 3> clearance_point2;
|
||||
std::array<double, 3> clearance_point1{};
|
||||
std::array<double, 3> clearance_point2{};
|
||||
|
||||
for (const auto& pair : bvh_clashes) {
|
||||
const int bvh_a_i = pair.first;
|
||||
@@ -816,10 +816,10 @@ namespace ifcopenshell::geom {
|
||||
|
||||
for (const auto& bvh_b_i : bvh_b_is) {
|
||||
for (int j=bvh_b->BegPrimitive(bvh_b_i); j<=bvh_b->EndPrimitive(bvh_b_i); ++j) {
|
||||
const std::array<int, 3>& tri = tris_b[j];
|
||||
const gp_Pnt& v1_b_pnt = verts_b[tri[0]];
|
||||
const gp_Pnt& v2_b_pnt = verts_b[tri[1]];
|
||||
const gp_Pnt& v3_b_pnt = verts_b[tri[2]];
|
||||
const std::array<int, 3>& tri_b = tris_b[j];
|
||||
const gp_Pnt& v1_b_pnt = verts_b[tri_b[0]];
|
||||
const gp_Pnt& v2_b_pnt = verts_b[tri_b[1]];
|
||||
const gp_Pnt& v3_b_pnt = verts_b[tri_b[2]];
|
||||
|
||||
tri_count_++;
|
||||
|
||||
@@ -1690,7 +1690,7 @@ namespace ifcopenshell::geom {
|
||||
const auto builder = new BVH_LinearBuilder<double, 3>(BVH_Constants_LeafNodeSizeDefault, BVH_Constants_MaxTreeDepth);
|
||||
BVH_Triangulation<double, 3> triangulation(builder);
|
||||
|
||||
for (int i = 0; i < elem_verts.size(); i += 3) {
|
||||
for (size_t i = 0; i < elem_verts.size(); i += 3) {
|
||||
#if OCC_VERSION_HEX >= 0x80000
|
||||
triangulation.Vertices.Append(BVH_Vec3d(elem_verts[i], elem_verts[i + 1], elem_verts[i + 2]));
|
||||
#else
|
||||
@@ -1699,7 +1699,7 @@ namespace ifcopenshell::geom {
|
||||
verts.push_back(gp_Pnt(elem_verts[i], elem_verts[i + 1], elem_verts[i + 2]));
|
||||
}
|
||||
|
||||
for (int i = 0; i < elem_faces.size(); i += 3) {
|
||||
for (size_t i = 0; i < elem_faces.size(); i += 3) {
|
||||
const auto& v1_pnt = verts[elem_faces[i]];
|
||||
const auto& v2_pnt = verts[elem_faces[i + 1]];
|
||||
const auto& v3_pnt = verts[elem_faces[i + 2]];
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <TopExp.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_iterator.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <ShapeFix_Wire.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
@@ -218,11 +218,11 @@ ifcopenshell::geom::util::triangulate_wire_result ifcopenshell::geom::util::tria
|
||||
|
||||
if (!tri.IsNull()) {
|
||||
|
||||
const NCollection_Array1<Poly_Triangle>& triangles = tri->Triangles();
|
||||
for (int i = 1; i <= triangles.Length(); ++i) {
|
||||
for (int i = 1; i <= tri->NbTriangles(); ++i) {
|
||||
const Poly_Triangle& triangle = tri->Triangle(i);
|
||||
if (face.Orientation() == TopAbs_REVERSED)
|
||||
triangles(i).Get(n123[2], n123[1], n123[0]);
|
||||
else triangles(i).Get(n123[0], n123[1], n123[2]);
|
||||
triangle.Get(n123[2], n123[1], n123[0]);
|
||||
else triangle.Get(n123[0], n123[1], n123[2]);
|
||||
|
||||
// Create polygons from the mesh vertices
|
||||
BRepBuilderAPI_MakeWire mp2;
|
||||
|
||||
@@ -77,13 +77,6 @@ namespace {
|
||||
return a < b ? edge_key{ a, b } : edge_key{ b, a };
|
||||
}
|
||||
|
||||
Eigen::Matrix4d item_matrix(const taxonomy::geom_item::ptr& item) {
|
||||
if (item && item->matrix) {
|
||||
return item->matrix->ccomponents();
|
||||
}
|
||||
return Eigen::Matrix4d::Identity();
|
||||
}
|
||||
|
||||
Eigen::Vector3d transform_point(const Eigen::Matrix4d& m, const Eigen::Vector3d& p) {
|
||||
Eigen::Vector4d v(p(0), p(1), p(2), 1.);
|
||||
return (m * v).head<3>();
|
||||
@@ -155,7 +148,7 @@ namespace {
|
||||
if (!face_points(face, points)) {
|
||||
continue;
|
||||
}
|
||||
auto total = external * part_matrix; // *item_matrix(face) * item_matrix(face->children.front());
|
||||
auto total = external * part_matrix;
|
||||
std::vector<int> indices;
|
||||
indices.reserve(points.size());
|
||||
for (const auto& point : points) {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#define mapping POSTFIX_SCHEMA(mapping)
|
||||
using namespace ifcopenshell::geom;
|
||||
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangularTrimmedSurface& inst) {
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangularTrimmedSurface&) {
|
||||
// @todo we'll need to add support for p-curves at some point, but not now.
|
||||
return nullptr;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#define mapping POSTFIX_SCHEMA(mapping)
|
||||
using namespace ifcopenshell::geom;
|
||||
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRightCircularCone& inst) {
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRightCircularCone&) {
|
||||
// @todo
|
||||
return nullptr;
|
||||
/*
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#define mapping POSTFIX_SCHEMA(mapping)
|
||||
using namespace ifcopenshell::geom;
|
||||
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRightCircularCylinder& inst) {
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRightCircularCylinder&) {
|
||||
// @todo
|
||||
return nullptr;
|
||||
/*
|
||||
|
||||
@@ -23,7 +23,7 @@ using namespace ifcopenshell::geom;
|
||||
|
||||
#ifdef SCHEMA_HAS_IfcSphericalSurface
|
||||
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSphericalSurface& inst) {
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSphericalSurface&) {
|
||||
return nullptr;
|
||||
|
||||
/*
|
||||
|
||||
@@ -52,23 +52,8 @@ namespace {
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
|
||||
auto loop = taxonomy::cast<taxonomy::loop>(map(inst.Directrix()));
|
||||
|
||||
// Start- EndParam became optional in IFC4
|
||||
#ifdef SCHEMA_IfcSweptDiskSolid_StartParam_IS_OPTIONAL
|
||||
auto sp = inst.StartParam();
|
||||
auto ep = inst.EndParam();
|
||||
#else
|
||||
std::optional<double> sp, ep;
|
||||
try {
|
||||
sp = inst.StartParam();
|
||||
ep = inst.EndParam();
|
||||
} catch (const ifcopenshell::exception& e) {
|
||||
logger_.warning("GEO", 293, e);
|
||||
}
|
||||
#endif
|
||||
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
#ifdef SCHEMA_HAS_IfcSweptDiskSolidPolygonal
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
if (inst.as<IfcSchema::IfcSweptDiskSolidPolygonal>()) {
|
||||
auto fr = inst.as<IfcSchema::IfcSweptDiskSolidPolygonal>().FilletRadius();
|
||||
if (fr && *fr > tol) {
|
||||
|
||||
@@ -73,7 +73,6 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve& inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
trim_cartesian &= has_pnts[0] && has_pnts[1];
|
||||
bool trim_cartesian_failed = !trim_cartesian;
|
||||
if (trim_cartesian) {
|
||||
if ((pnts[0]->ccomponents() - pnts[1]->ccomponents()).norm() < (2 * tol)) {
|
||||
logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 295, "Skipping segment with length below tolerance level:", inst);
|
||||
|
||||
@@ -665,7 +665,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceStyle& style) {
|
||||
auto styles = style.Styles();
|
||||
IfcSchema::IfcSurfaceStyleShading shading;
|
||||
for (auto& s : styles) {
|
||||
if (shading = s.as<IfcSchema::IfcSurfaceStyleShading>()) {
|
||||
if ((shading = s.as<IfcSchema::IfcSurfaceStyleShading>())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -989,7 +989,7 @@ void mapping::initialize_settings() {
|
||||
bool selected_sub_context = false;
|
||||
auto subs = context.HasSubContexts();
|
||||
for (auto& sub : subs) {
|
||||
if (cids.find(context.id()) != cids.end()) {
|
||||
if (cids.find(sub.id()) != cids.end()) {
|
||||
selected_sub_context = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user