mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
Silence obvious compiler warnings
Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -17,24 +17,6 @@ ifcopenshell::geom::converter::~converter() {
|
||||
delete mapping_;
|
||||
}
|
||||
|
||||
namespace {
|
||||
void substitute_with_box_based_on_density(ifcopenshell::logger& logger, std::vector<ifcopenshell::geom::conversion_result>& items, double& density) {
|
||||
int nv = 0;
|
||||
void* box = nullptr;
|
||||
double volume = 0.;
|
||||
for (auto& i : items) {
|
||||
nv += i.shape()->num_vertices();
|
||||
volume = i.shape()->bounding_box(box);
|
||||
}
|
||||
density = nv / volume;
|
||||
if (density > 1e5) {
|
||||
items[0].shape()->set_box(box);
|
||||
items.erase(items.begin() + 1, items.end());
|
||||
logger.notice("GEO", 30, "Substituted element with " + boost::lexical_cast<std::string>(density) + " vertices / m3 with a bounding box");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for_representation_and_product(taxonomy::ptr representation_node, const express::base product_, const taxonomy::matrix4::ptr& place_) {
|
||||
auto product = product_.as<express::entity>();
|
||||
|
||||
@@ -179,7 +161,8 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for
|
||||
|
||||
const bool no_openings = openings.empty();
|
||||
const bool disable_opening_subtractions = settings_.get<ifcopenshell::geom::settings::DisableOpeningSubtractions>().get();
|
||||
const bool above_limit = settings_.get<ifcopenshell::geom::settings::MaxVoidsPerElement>().has() && settings_.get<ifcopenshell::geom::settings::MaxVoidsPerElement>().get() != 0 && openings.size() > settings_.get<ifcopenshell::geom::settings::MaxVoidsPerElement>().get();
|
||||
const auto max_voids = settings_.get<ifcopenshell::geom::settings::MaxVoidsPerElement>();
|
||||
const bool above_limit = max_voids.has() && max_voids.get() != 0 && openings.size() > static_cast<std::size_t>(max_voids.get());
|
||||
|
||||
if (above_limit) {
|
||||
logger_.warning("GEO", 403, "Element has more openings than the maximum allowed. Openings will not be processed for this element:", product);
|
||||
|
||||
@@ -89,9 +89,9 @@ struct piecewise_fn_evaluator : public fn_evaluator {
|
||||
struct gradient_fn_evaluator : public fn_evaluator {
|
||||
gradient_fn_evaluator(taxonomy::gradient_function::const_ptr fn, const ifcopenshell::geom::settings& settings) :
|
||||
fn_evaluator(settings),
|
||||
fn_(fn),
|
||||
horizontal_evaluator_(settings, fn->get_horizontal()),
|
||||
vertical_evaluator_(settings, fn->get_vertical())
|
||||
vertical_evaluator_(settings, fn->get_vertical()),
|
||||
fn_(fn)
|
||||
{
|
||||
start_ = fn_->get_vertical()->start();
|
||||
}
|
||||
@@ -121,9 +121,9 @@ struct gradient_fn_evaluator : public fn_evaluator {
|
||||
|
||||
struct cant_fn_evaluator : public fn_evaluator {
|
||||
cant_fn_evaluator(taxonomy::cant_function::const_ptr fn, const ifcopenshell::geom::settings& settings) : fn_evaluator(settings),
|
||||
fn_(fn),
|
||||
gradient_evaluator_(settings, fn->get_gradient()),
|
||||
cant_evaluator_(settings, fn->get_cant()) {
|
||||
cant_evaluator_(settings, fn->get_cant()),
|
||||
fn_(fn) {
|
||||
start_ = fn_->get_cant()->start();
|
||||
}
|
||||
|
||||
@@ -185,9 +185,9 @@ struct cant_fn_evaluator : public fn_evaluator {
|
||||
|
||||
struct offset_fn_evaluator : public fn_evaluator {
|
||||
offset_fn_evaluator(taxonomy::offset_function::const_ptr fn, const ifcopenshell::geom::settings& settings) : fn_evaluator(settings),
|
||||
fn_(fn),
|
||||
basis_evaluator_(settings, fn->get_basis()),
|
||||
offset_evaluator_(settings, fn->get_offset()) {
|
||||
offset_evaluator_(settings, fn->get_offset()),
|
||||
fn_(fn) {
|
||||
}
|
||||
|
||||
fn_evaluator* clone() const override { return new offset_fn_evaluator(*this); }
|
||||
|
||||
@@ -15,7 +15,7 @@ IFC_GEOM_API std::vector<double> helmert_curve_point(double A0, double A1, doubl
|
||||
/// On the C++ side, the dcast operator take care of this, but dcast is not accessible on the python side.
|
||||
/// @param loop
|
||||
/// @return
|
||||
static taxonomy::function_item::ptr convert_loop_to_function_item(taxonomy::loop::ptr loop) {
|
||||
inline taxonomy::function_item::ptr convert_loop_to_function_item(taxonomy::loop::ptr loop) {
|
||||
return ifcopenshell::geom::taxonomy::dcast<taxonomy::function_item>(loop);
|
||||
}
|
||||
|
||||
|
||||
@@ -334,10 +334,10 @@ taxonomy::loft::ptr ifcopenshell::geom::make_loft(const ifcopenshell::geom::sett
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto& p1 = tag_to_point_on_w1[t];
|
||||
const auto& p2 = tag_to_point_on_w2[t];
|
||||
const auto& tagged_point_on_w1 = tag_to_point_on_w1[t];
|
||||
const auto& tagged_point_on_w2 = tag_to_point_on_w2[t];
|
||||
|
||||
auto p3 = (lerp(p1->ccomponents(), p2->ccomponents(), relative_dist_along) + interpolated_offset).eval();
|
||||
auto p3 = (lerp(tagged_point_on_w1->ccomponents(), tagged_point_on_w2->ccomponents(), relative_dist_along) + interpolated_offset).eval();
|
||||
|
||||
std::set<std::string> tags_for_this_point_on_subsequent_profile = {t};
|
||||
|
||||
@@ -432,18 +432,6 @@ taxonomy::loft::ptr ifcopenshell::geom::make_loft(const ifcopenshell::geom::sett
|
||||
loft->children.back()->matrix->components() = m;
|
||||
}
|
||||
|
||||
auto find_closest = [](const std::vector<double>& v, double target) -> std::vector<double>::const_iterator {
|
||||
auto it = std::lower_bound(v.begin(), v.end(), target);
|
||||
|
||||
if (it == v.begin()) {
|
||||
return it;
|
||||
}
|
||||
|
||||
double after = *it;
|
||||
double before = *(it - 1);
|
||||
|
||||
return (std::abs(after - target) < std::abs(target - before)) ? it : (it - 1);
|
||||
};
|
||||
}
|
||||
|
||||
return loft;
|
||||
|
||||
@@ -87,7 +87,7 @@ bool ifcopenshell::geom::iterator::initialize() {
|
||||
if (folded.size() < tasks_.size()) {
|
||||
auto old_size = tasks_.size();
|
||||
tasks_.clear();
|
||||
size_t i = 0;
|
||||
int i = 0;
|
||||
for (auto& p : folded) {
|
||||
tasks_.emplace_back();
|
||||
tasks_.back().index = i++;
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace {
|
||||
p[i] += point.cartesian(i);
|
||||
}
|
||||
}
|
||||
kernel_::FT n(wire.size());
|
||||
kernel_::FT n(static_cast<double>(wire.size()));
|
||||
return cgal_point(p[0] / n, p[1] / n, p[2] / n);
|
||||
}
|
||||
|
||||
@@ -563,14 +563,14 @@ void ifcopenshell::geom::cgal_shape::triangulate(ifcopenshell::geom::settings se
|
||||
} while (current_halfedge != face->facet_begin());
|
||||
|
||||
t->addFace(item_id, surface_style_id, vertexidx[0], vertexidx[1], vertexidx[2]);
|
||||
for (size_t i = 0; i < 3; ++i) {
|
||||
if (is_face_boundary[i]) {
|
||||
for (size_t boundary_index = 0; boundary_index < 3; ++boundary_index) {
|
||||
if (is_face_boundary[boundary_index]) {
|
||||
// In CGAL, the vertex of a halfedge is the incident vertex, i.e
|
||||
// the second vertex of the edge, so in order to get corresponding
|
||||
// vertex and edge indices we need to find vertexids (i-1, i) for
|
||||
// the boundary registered in i.
|
||||
auto a = vertexidx[(i + 2) % 3];
|
||||
auto b = vertexidx[(i + 3) % 3];
|
||||
auto a = vertexidx[(boundary_index + 2) % 3];
|
||||
auto b = vertexidx[(boundary_index + 3) % 3];
|
||||
if (a > b) {
|
||||
std::swap(a, b);
|
||||
}
|
||||
@@ -766,7 +766,7 @@ opaque_coordinate<3> ifcopenshell::geom::cgal_shape::position()
|
||||
p[i] += it->cartesian(i);
|
||||
}
|
||||
}
|
||||
kernel_::FT N(std::distance(shp.points_begin(), shp.points_end()));
|
||||
kernel_::FT N(static_cast<double>(std::distance(shp.points_begin(), shp.points_end())));
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
p[i] /= N;
|
||||
}
|
||||
@@ -816,6 +816,7 @@ opaque_coordinate<4> ifcopenshell::geom::cgal_shape::plane_equation()
|
||||
std::vector<conversion_result_shape*> ifcopenshell::geom::cgal_shape::convex_decomposition()
|
||||
{
|
||||
#ifdef IFOPSH_SIMPLE_KERNEL
|
||||
(void)other;
|
||||
throw std::runtime_error("Not implemented");
|
||||
#else
|
||||
std::vector<conversion_result_shape*> result;
|
||||
@@ -842,6 +843,7 @@ std::vector<conversion_result_shape*> ifcopenshell::geom::cgal_shape::convex_dec
|
||||
conversion_result_shape* ifcopenshell::geom::cgal_shape::halfspaces()
|
||||
{
|
||||
#ifdef IFOPSH_SIMPLE_KERNEL
|
||||
(void)other;
|
||||
throw std::runtime_error("Not implemented");
|
||||
#else
|
||||
return new cgal_shape_half_space_decomposition(nef(), convex_tag_);
|
||||
@@ -932,6 +934,7 @@ std::vector<conversion_result_shape*> ifcopenshell::geom::cgal_shape::facets()
|
||||
conversion_result_shape* ifcopenshell::geom::cgal_shape::add(conversion_result_shape* other)
|
||||
{
|
||||
#ifdef IFOPSH_SIMPLE_KERNEL
|
||||
(void)other;
|
||||
throw std::runtime_error("Not implemented");
|
||||
#else
|
||||
return new cgal_shape(this->nef() + ((cgal_shape*)other)->nef());
|
||||
@@ -1028,18 +1031,18 @@ std::size_t ifcopenshell::geom::cgal_shape::map(const std::vector<opaque_coordin
|
||||
throw std::runtime_error("Not implemented");
|
||||
}
|
||||
|
||||
bool ifcopenshell::geom::cgal_shape::surface_area_along_direction(double tol, const ifcopenshell::geom::taxonomy::matrix4::ptr& place, double& along_x, double& along_y, double& along_z) const {
|
||||
bool ifcopenshell::geom::cgal_shape::surface_area_along_direction(double, const ifcopenshell::geom::taxonomy::matrix4::ptr&, double&, double&, double&) const {
|
||||
// @todo
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef IFOPSH_SIMPLE_KERNEL
|
||||
|
||||
void ifcopenshell::geom::cgal_shape_half_space_decomposition::triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger) const {
|
||||
void ifcopenshell::geom::cgal_shape_half_space_decomposition::triangulate(ifcopenshell::geom::settings, const ifcopenshell::geom::taxonomy::matrix4&, ifcopenshell::geom::triangulation*, int, int, ifcopenshell::logger&) const {
|
||||
throw std::runtime_error("Not implemented");
|
||||
}
|
||||
|
||||
void ifcopenshell::geom::cgal_shape_half_space_decomposition::serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string& r) const {
|
||||
void ifcopenshell::geom::cgal_shape_half_space_decomposition::serialize(const ifcopenshell::geom::taxonomy::matrix4&, std::string&) const {
|
||||
throw std::runtime_error("Not implemented");
|
||||
}
|
||||
|
||||
@@ -1047,7 +1050,7 @@ int ifcopenshell::geom::cgal_shape_half_space_decomposition::num_vertices() cons
|
||||
throw std::runtime_error("Not implemented");
|
||||
}
|
||||
|
||||
void ifcopenshell::geom::cgal_shape_half_space_decomposition::set_box(void * b) {
|
||||
void ifcopenshell::geom::cgal_shape_half_space_decomposition::set_box(void*) {
|
||||
throw std::runtime_error("Not implemented");
|
||||
}
|
||||
|
||||
@@ -1172,17 +1175,17 @@ std::vector<conversion_result_shape*> ifcopenshell::geom::cgal_shape_half_space_
|
||||
return res;
|
||||
}
|
||||
|
||||
conversion_result_shape* ifcopenshell::geom::cgal_shape_half_space_decomposition::add(conversion_result_shape* other)
|
||||
conversion_result_shape* ifcopenshell::geom::cgal_shape_half_space_decomposition::add(conversion_result_shape*)
|
||||
{
|
||||
throw std::runtime_error("Not implemented");
|
||||
}
|
||||
|
||||
conversion_result_shape* ifcopenshell::geom::cgal_shape_half_space_decomposition::subtract(conversion_result_shape* other)
|
||||
conversion_result_shape* ifcopenshell::geom::cgal_shape_half_space_decomposition::subtract(conversion_result_shape*)
|
||||
{
|
||||
throw std::runtime_error("Not implemented");
|
||||
}
|
||||
|
||||
conversion_result_shape* ifcopenshell::geom::cgal_shape_half_space_decomposition::intersect(conversion_result_shape* other)
|
||||
conversion_result_shape* ifcopenshell::geom::cgal_shape_half_space_decomposition::intersect(conversion_result_shape*)
|
||||
{
|
||||
throw std::runtime_error("Not implemented");
|
||||
}
|
||||
@@ -1192,7 +1195,7 @@ std::pair<opaque_coordinate<3>, opaque_coordinate<3>> ifcopenshell::geom::cgal_s
|
||||
throw std::runtime_error("Not implemented");
|
||||
}
|
||||
|
||||
double ifcopenshell::geom::cgal_shape_half_space_decomposition::bounding_box(void *& b) const {
|
||||
double ifcopenshell::geom::cgal_shape_half_space_decomposition::bounding_box(void*&) const {
|
||||
throw std::runtime_error("Not implemented");
|
||||
}
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ namespace ifcopenshell { namespace geom {
|
||||
virtual std::size_t map(const std::vector<opaque_coordinate<4>>& from, const std::vector<opaque_coordinate<4>>& to);
|
||||
virtual conversion_result_shape* moved(ifcopenshell::geom::taxonomy::matrix4::ptr) 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 {
|
||||
virtual bool surface_area_along_direction(double, const ifcopenshell::geom::taxonomy::matrix4::ptr&, double&, double&, double&) const {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -174,7 +174,8 @@ bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_polyhedron& shape)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (false && l->children.size() > 100) {
|
||||
#if 0
|
||||
if (l->children.size() > 100) {
|
||||
static double inf = 1.e9; // std::numeric_limits<double>::infinity();
|
||||
std::pair<Eigen::Vector3d, Eigen::Vector3d> minmax(
|
||||
Eigen::Vector3d(+inf, +inf, +inf),
|
||||
@@ -206,6 +207,7 @@ bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_polyhedron& shape)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
std::list<cgal_face> face_list;
|
||||
for (auto& f : l->children) {
|
||||
@@ -576,7 +578,7 @@ namespace {
|
||||
std::swap(aid, bid);
|
||||
}
|
||||
|
||||
if (((aid + 1) == bid) || ((aid == 0) && (bid = (segments.size() - 1)))) {
|
||||
if (((aid + 1) == bid) || ((aid == 0) && (static_cast<std::size_t>(bid) == segments.size() - 1))) {
|
||||
// consecutive segments.
|
||||
return;
|
||||
}
|
||||
@@ -814,6 +816,7 @@ bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire& result) {
|
||||
}
|
||||
|
||||
auto delta_dot = max_dot - min_dot;
|
||||
(void)delta_dot;
|
||||
// @todo this can be used to assess face planarity.
|
||||
|
||||
/*
|
||||
@@ -900,6 +903,11 @@ namespace {
|
||||
bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::base& entity, const std::vector<std::pair<taxonomy::ptr, ifcopenshell::geom::taxonomy::matrix4>>& openings, const std::vector<ifcopenshell::geom::conversion_result> & entity_shapes, const ifcopenshell::geom::taxonomy::matrix4 & entity_trsf, std::vector<ifcopenshell::geom::conversion_result> & cut_shapes)
|
||||
{
|
||||
#ifdef IFOPSH_SIMPLE_KERNEL
|
||||
(void)entity;
|
||||
(void)openings;
|
||||
(void)entity_shapes;
|
||||
(void)entity_trsf;
|
||||
(void)cut_shapes;
|
||||
return false;
|
||||
#else
|
||||
CGAL::Nef_nary_union_3<CGAL::Nef_polyhedron_3<kernel_>> second_operand_collector;
|
||||
@@ -1075,13 +1083,13 @@ bool cgal_kernel::process_extrusion(const cgal_face& bottom_face, taxonomy::dire
|
||||
if (i0 > i1) {
|
||||
std::swap(i0, i1);
|
||||
}
|
||||
auto p = external_edges.insert({ { i0, i1 }, { i, j} });
|
||||
if (!p.second) {
|
||||
auto insertion = external_edges.insert({ { i0, i1 }, { i, j} });
|
||||
if (!insertion.second) {
|
||||
// Mark as internal before erasure in external
|
||||
// This is {i,j} at the time the edge use was inserted.
|
||||
internal_edges.insert(p.first->second);
|
||||
internal_edges.insert(insertion.first->second);
|
||||
// not inserted, remove
|
||||
external_edges.erase(p.first);
|
||||
external_edges.erase(insertion.first);
|
||||
|
||||
// @nb note the difference here in indices, {i0, i1} is point indices in
|
||||
// point_map. i is index in faces_to_extrude, j is segment index in wire.
|
||||
@@ -1109,11 +1117,11 @@ bool cgal_kernel::process_extrusion(const cgal_face& bottom_face, taxonomy::dire
|
||||
const bool reverse = fnorm * dir > 0;
|
||||
|
||||
if (reverse) {
|
||||
cgal_face bottom_face;
|
||||
cgal_face reversed_bottom_face;
|
||||
for (auto vertex = w.rbegin(); vertex != w.rend(); ++vertex) {
|
||||
bottom_face.outer.push_back(*vertex);
|
||||
reversed_bottom_face.outer.push_back(*vertex);
|
||||
}
|
||||
face_list.push_back(bottom_face);
|
||||
face_list.push_back(reversed_bottom_face);
|
||||
} else {
|
||||
face_list.push_back(cgal_face{ w });
|
||||
}
|
||||
@@ -1421,6 +1429,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference,
|
||||
|
||||
for (auto it = shape.vertices_begin(); it != shape.vertices_end(); ++it) {
|
||||
for (auto& x : first_operands) {
|
||||
(void)x;
|
||||
// @nb snapping_tolerance 'snaps' the barycentric coords to 0 or 1
|
||||
// so that not only the point aligns to the face, but to an edge
|
||||
// as well. Snapping only to face would cause a rotation of line b:
|
||||
@@ -1767,7 +1776,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
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_>>&, double&, double&) {
|
||||
if (operands.front().size() != 1) {
|
||||
return false;
|
||||
}
|
||||
@@ -1888,10 +1897,10 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, std::vect
|
||||
logger().notice("GEO", 101, "Holes are not disjoint");
|
||||
|
||||
CGAL::Polygon_set_2<kernel_> result;
|
||||
auto it = loops.begin();
|
||||
result.insert(*it++);
|
||||
for (; it != loops.end(); ++it) {
|
||||
result.difference(*it);
|
||||
auto loop_it = loops.begin();
|
||||
result.insert(*loop_it++);
|
||||
for (; loop_it != loops.end(); ++loop_it) {
|
||||
result.difference(*loop_it);
|
||||
}
|
||||
result.polygons_with_holes(std::back_inserter(pwhs));
|
||||
#endif
|
||||
@@ -1906,8 +1915,8 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, std::vect
|
||||
#endif
|
||||
|
||||
std::list<CGAL::Polygon_2<kernel_>> decom_polies;
|
||||
for (auto& pwh : pwhs) {
|
||||
decompositor(pwh, std::back_inserter(decom_polies));
|
||||
for (auto& polygon_with_holes : pwhs) {
|
||||
decompositor(polygon_with_holes, std::back_inserter(decom_polies));
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -2020,8 +2029,8 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, std::vect
|
||||
|
||||
auto& w = fs.front().outer;
|
||||
CGAL::Polygon_2<kernel_> ps;
|
||||
for (auto& p : w) {
|
||||
ps.push_back({ p.x(), p.y() });
|
||||
for (auto& wire_point : w) {
|
||||
ps.push_back({ wire_point.x(), wire_point.y() });
|
||||
}
|
||||
if (!ps.is_simple()) {
|
||||
logger().warning("GEO", 103, "Polygonal boundary not simple", face->children[0]->instance);
|
||||
@@ -2252,10 +2261,10 @@ void polyhedron_builder::operator()(CGAL::Polyhedron_3<kernel_>::HalfedgeDS &hds
|
||||
std::list<CGAL::Polygon_2<kernel_>> decom_polies;
|
||||
decompositor(pwh, std::back_inserter(decom_polies));
|
||||
|
||||
for (auto& p : decom_polies) {
|
||||
for (auto& decomposed_polygon : decom_polies) {
|
||||
facet_vertices.emplace_back();
|
||||
for (auto it = p.vertices_begin(); it != p.vertices_end(); ++it) {
|
||||
auto pit = points_2d.find(*it);
|
||||
for (auto vertex_it = decomposed_polygon.vertices_begin(); vertex_it != decomposed_polygon.vertices_end(); ++vertex_it) {
|
||||
auto pit = points_2d.find(*vertex_it);
|
||||
if (pit == points_2d.end()) {
|
||||
// Likely there are intersections in the polygonal boundaries.
|
||||
// For now let's just skip over the triangle. We can also use
|
||||
|
||||
@@ -196,7 +196,7 @@ plane_map<Kernel> snap_halfspaces(const std::list<CGAL::Plane_3<Kernel>>& planes
|
||||
kdtree.search(std::back_inserter(results_neg), fsn);
|
||||
|
||||
auto sum = std::accumulate(++results_pos.begin(), results_pos.end(), results_pos.front(), [](point_d a, point_d b) {return point_d(a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]); });
|
||||
int N = results_pos.size();
|
||||
std::size_t N = results_pos.size();
|
||||
auto sum2 = std::accumulate(results_neg.begin(), results_neg.end(), sum, [](point_d a, point_d b) {return point_d(a[0] - b[0], a[1] - b[1], a[2] - b[2], a[3] - b[3]); });
|
||||
N += results_neg.size();
|
||||
|
||||
|
||||
@@ -40,8 +40,6 @@ namespace {
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcBooleanResult& inst) {
|
||||
IfcSchema::IfcBooleanOperand operand1 = inst.FirstOperand();
|
||||
IfcSchema::IfcBooleanOperand operand2 = inst.SecondOperand();
|
||||
bool has_halfspace_operand = false;
|
||||
|
||||
std::vector<IfcSchema::IfcBooleanOperand> operands;
|
||||
operands.push_back(operand2);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#define mapping POSTFIX_SCHEMA(mapping)
|
||||
using namespace ifcopenshell::geom;
|
||||
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCenterLineProfileDef& inst) {
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCenterLineProfileDef&) {
|
||||
return nullptr;
|
||||
|
||||
/*
|
||||
|
||||
@@ -4,8 +4,9 @@ using namespace ifcopenshell::geom;
|
||||
|
||||
taxonomy::loop::ptr ifcopenshell::geom::fillet_loop(taxonomy::loop::ptr loop, double radius) {
|
||||
std::vector<profile_point_with_edges_3d> pps(loop->children.size());
|
||||
for (int b = 0; b < loop->children.size(); ++b) {
|
||||
int c = (b - 1) % loop->children.size();
|
||||
const auto child_count = static_cast<int>(loop->children.size());
|
||||
for (int b = 0; b < child_count; ++b) {
|
||||
int c = (b + child_count - 1) % child_count;
|
||||
pps[b] = {
|
||||
std::get<taxonomy::point3::ptr>(loop->children[c]->start)->ccomponents(),
|
||||
radius, loop->children[c], loop->children[b]
|
||||
@@ -59,7 +60,7 @@ void ifcopenshell::geom::remove_duplicate_points_from_loop(std::vector<taxonomy:
|
||||
|
||||
for (;;) {
|
||||
bool removed = false;
|
||||
int n = polygon.size() - (closed ? 0 : 1);
|
||||
const std::size_t n = polygon.size() - (closed ? 0u : 1u);
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
// wrap around to the first point in case of a closed loop
|
||||
auto j = (i + 1) % polygon.size();
|
||||
@@ -153,8 +154,9 @@ taxonomy::loop::ptr ifcopenshell::geom::profile_helper(const taxonomy::matrix4::
|
||||
}
|
||||
|
||||
std::vector<profile_point_with_edges> pps(points.size());
|
||||
for (int b = 0; b < points.size(); ++b) {
|
||||
int c = (b + points.size() - 1) % points.size();
|
||||
const auto point_count = static_cast<int>(points.size());
|
||||
for (int b = 0; b < point_count; ++b) {
|
||||
int c = (b + point_count - 1) % point_count;
|
||||
pps[b] = { Eigen::Vector2d(points[b].xy[0], points[b].xy[1]), points[b].radius, loop->children[c], loop->children[b] };
|
||||
}
|
||||
|
||||
@@ -215,7 +217,7 @@ std::pair<std::vector<taxonomy::point3::ptr>, std::vector<std::set<std::string>>
|
||||
|
||||
for (;;) {
|
||||
bool removed = false;
|
||||
int n = polygon.size() - (closed ? 0 : 1);
|
||||
const std::size_t n = polygon.size() - (closed ? 0u : 1u);
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
// wrap around to the first point in case of a closed loop
|
||||
auto j = (i + 1) % polygon.size();
|
||||
|
||||
@@ -211,7 +211,7 @@ void ifcopenshell::geom::triangulation::registerEdgeCount(int n1, int n2, std::m
|
||||
}
|
||||
|
||||
const ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::brep::item(int i) const {
|
||||
if (i >= 0 && i < shapes_.size()) {
|
||||
if (i >= 0 && static_cast<std::size_t>(i) < shapes_.size()) {
|
||||
return shapes_[i].shape()->moved(shapes_[i].placement());
|
||||
} else {
|
||||
return nullptr;
|
||||
@@ -219,7 +219,7 @@ const ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::brep::ite
|
||||
}
|
||||
|
||||
int ifcopenshell::geom::brep::item_id(int i) const {
|
||||
if (i >= 0 && i < shapes_.size()) {
|
||||
if (i >= 0 && static_cast<std::size_t>(i) < shapes_.size()) {
|
||||
return shapes_[i].ItemId();
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
@@ -187,19 +187,6 @@ namespace {
|
||||
throw std::runtime_error("not implemented");
|
||||
}
|
||||
|
||||
bool compare(const style& a, const style& b) {
|
||||
const int order[5] = {
|
||||
less_to_order(a.name, b.name),
|
||||
less_to_order(a.diffuse, b.diffuse),
|
||||
less_to_order(a.specular, b.specular),
|
||||
less_to_order(a.specularity, b.specularity),
|
||||
less_to_order(a.transparency, b.transparency)
|
||||
};
|
||||
auto it = std::find_if(std::begin(order), std::end(order), [](int x) { return x; });
|
||||
if (it == std::end(order)) return false;
|
||||
return *it == -1;
|
||||
}
|
||||
|
||||
/* A compile-time for loop over the taxonomy kinds */
|
||||
template <size_t N>
|
||||
struct dispatch_comparison {
|
||||
@@ -245,10 +232,10 @@ bool ifcopenshell::geom::taxonomy::less(item::const_ptr a, item::const_ptr b) {
|
||||
|
||||
namespace {
|
||||
bool compare(const trimmed_curve& a, const trimmed_curve& b) {
|
||||
int a_which_start = a.start.index();
|
||||
int a_which_end = a.end.index();
|
||||
int b_which_start = b.start.index();
|
||||
int b_which_end = b.end.index();
|
||||
std::size_t a_which_start = a.start.index();
|
||||
std::size_t a_which_end = a.end.index();
|
||||
std::size_t b_which_start = b.start.index();
|
||||
std::size_t b_which_end = b.end.index();
|
||||
if (std::tie(a.orientation, a_which_start, a_which_end) ==
|
||||
std::tie(b.orientation, b_which_start, b_which_end)) {
|
||||
|
||||
|
||||
+14
-14
@@ -1629,20 +1629,20 @@ typedef item const* ptr;
|
||||
for (auto& i : deep->children) {
|
||||
// @todo Sad... now that we have templated collection members,
|
||||
// we can't generally use collection_base anymore as a cast target.
|
||||
if (auto s = std::dynamic_pointer_cast<taxonomy::collection>(i)) {
|
||||
ifcopenshell::geom::visit<taxonomy::collection>(s, fn);
|
||||
} else if (auto s = std::dynamic_pointer_cast<taxonomy::loop>(i)) {
|
||||
ifcopenshell::geom::visit<taxonomy::loop>(s, fn);
|
||||
} else if (auto s = std::dynamic_pointer_cast<taxonomy::face>(i)) {
|
||||
ifcopenshell::geom::visit<taxonomy::face>(s, fn);
|
||||
} else if (auto s = std::dynamic_pointer_cast<taxonomy::shell>(i)) {
|
||||
ifcopenshell::geom::visit<taxonomy::shell>(s, fn);
|
||||
} else if (auto s = std::dynamic_pointer_cast<taxonomy::solid>(i)) {
|
||||
ifcopenshell::geom::visit<taxonomy::solid>(s, fn);
|
||||
} else if (auto s = std::dynamic_pointer_cast<taxonomy::loft>(i)) {
|
||||
ifcopenshell::geom::visit<taxonomy::loft>(s, fn);
|
||||
} else if (auto s = std::dynamic_pointer_cast<taxonomy::boolean_result>(i)) {
|
||||
ifcopenshell::geom::visit<taxonomy::boolean_result>(s, fn);
|
||||
if (auto collection = std::dynamic_pointer_cast<taxonomy::collection>(i)) {
|
||||
ifcopenshell::geom::visit<taxonomy::collection>(collection, fn);
|
||||
} else if (auto loop = std::dynamic_pointer_cast<taxonomy::loop>(i)) {
|
||||
ifcopenshell::geom::visit<taxonomy::loop>(loop, fn);
|
||||
} else if (auto face = std::dynamic_pointer_cast<taxonomy::face>(i)) {
|
||||
ifcopenshell::geom::visit<taxonomy::face>(face, fn);
|
||||
} else if (auto shell = std::dynamic_pointer_cast<taxonomy::shell>(i)) {
|
||||
ifcopenshell::geom::visit<taxonomy::shell>(shell, fn);
|
||||
} else if (auto solid = std::dynamic_pointer_cast<taxonomy::solid>(i)) {
|
||||
ifcopenshell::geom::visit<taxonomy::solid>(solid, fn);
|
||||
} else if (auto loft = std::dynamic_pointer_cast<taxonomy::loft>(i)) {
|
||||
ifcopenshell::geom::visit<taxonomy::loft>(loft, fn);
|
||||
} else if (auto boolean_result = std::dynamic_pointer_cast<taxonomy::boolean_result>(i)) {
|
||||
ifcopenshell::geom::visit<taxonomy::boolean_result>(boolean_result, fn);
|
||||
}
|
||||
else {
|
||||
fn(i);
|
||||
|
||||
Reference in New Issue
Block a user