Skip to content

Commit 3fa8947

Browse files
committed
small fixes in CurveConverter
1 parent b7c10dd commit 3fa8947

19 files changed

+1587
-1545
lines changed

IfcPlusPlus/src/external/Carve/src/include/carve/kd_node.hpp

+1-74
Original file line numberDiff line numberDiff line change
@@ -265,81 +265,8 @@ class kd_node {
265265
// distance_t must provide:
266266
// double operator()(data_t, vector<ndim>);
267267
// double operator()(axis_pos, vector<ndim>);
268-
template <typename distance_t>
269-
struct near_point_query {
270-
// q_t - the priority queue value type.
271-
// q_t.first: distance from object to query point.
272-
// q_t.second: pointer to object
273-
typedef std::pair<double, const data_t*> q_t;
274-
275-
// the queue priority should sort from smallest distance to largest, and on
276-
// equal distance, by object pointer.
277-
struct pcmp {
278-
bool operator()(const q_t& a, const q_t& b) {
279-
return (a.first > b.first) ||
280-
((a.first == b.first) && (a.second < b.second));
281-
}
282-
};
283-
284-
vector<ndim> point;
285-
const kd_node* node;
286-
std::priority_queue<q_t, std::vector<q_t>, pcmp> pq;
287-
288-
distance_t dist;
289-
double dist_to_parent_split;
290-
291-
void addToPQ(kd_node* node) {
292-
if (node->c_neg) {
293-
addToPQ(node->c_neg);
294-
addToPQ(node->c_pos);
295-
} else {
296-
for (typename kd_node::container_t::const_iterator i =
297-
node->data.begin();
298-
i != node->data.end(); ++i) {
299-
double d = dist((*i), point);
300-
pq.push(std::make_pair(d, &(*i)));
301-
}
302-
}
303-
}
304-
305-
const data_t* next() {
306-
while (1) {
307-
if (pq.size()) {
308-
q_t t = pq.top();
309-
if (!node->parent || t.first < dist_to_parent_split) {
310-
pq.pop();
311-
return t.second;
312-
}
313-
}
314-
315-
if (!node->parent) {
316-
return NULL;
317-
}
268+
318269

319-
if (node->parent->c_neg == node) {
320-
addToPQ(node->parent->c_pos);
321-
} else {
322-
addToPQ(node->parent->c_neg);
323-
}
324-
325-
node = node->parent;
326-
dist_to_parent_split = dist(node->splitpos, point);
327-
}
328-
}
329-
330-
near_point_query(const vector<ndim> _point, const kd_node* _node)
331-
: point(_point), node(_node), pq(), dist() {
332-
while (node->c_neg) {
333-
node = (point[node->axis] < node->pos) ? node->c_neg : node->c_pos;
334-
}
335-
if (node->parent) {
336-
dist_to_parent_split = dist(node->parent->splitpos, point);
337-
} else {
338-
dist_to_parent_split = HUGE_VAL;
339-
}
340-
addToPQ(node);
341-
}
342-
};
343270
};
344271
} // namespace geom
345272
} // namespace carve

IfcPlusPlus/src/external/Carve/src/include/carve/rtree.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <carve/geom.hpp>
3131

3232
#include <iostream>
33-
33+
#include <cstdint>
3434
#include <cmath>
3535
#include <limits>
3636

IfcPlusPlus/src/ifcpp/IFC4X3/EntityFactory.h

+879-879
Large diffs are not rendered by default.

IfcPlusPlus/src/ifcpp/IFC4X3/TypeFactory.h

+440-440
Large diffs are not rendered by default.

IfcPlusPlus/src/ifcpp/geometry/CSG_Adapter.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ bool CSG_Adapter::computeCSG_Carve(const shared_ptr<carve::mesh::MeshSet<3> >& i
381381
bool operandA_dumped = false;
382382
bool operandB_dumped = false;
383383
bool dump_result_mesh = false;
384-
384+
if(false)
385385
{
386386
if (5598 == tag || !infoInputA.meshSetValid)
387387
{
@@ -763,7 +763,7 @@ bool CSG_Adapter::computeCSG_Carve(const shared_ptr<carve::mesh::MeshSet<3> >& i
763763

764764
if (!result_valid_2)
765765
{
766-
std::cout << "!result" << std::endl;
766+
std::cout << __FUNCTION__ << ": !result_valid_2" << std::endl;
767767
}
768768
}
769769
#endif

IfcPlusPlus/src/ifcpp/geometry/ConverterOSG.h

+5-6
Original file line numberDiff line numberDiff line change
@@ -839,13 +839,12 @@ class ConverterOSG : public StatusCallback
839839
double epsCoplanarFacesAngle = eps;
840840
double minFaceArea = eps;
841841
bool dumpMeshes = false;
842+
PolyInputCache3D polyTriangulated;
842843
GeomProcessingParams params(m_geom_settings, dumpMeshes);
843-
PolyInputCache3D poly(0.001);
844-
MeshOps::retriangulateMeshSetForExport(item_meshset, poly, params);
844+
MeshOps::retriangulateMeshSetForExport(item_meshset, polyTriangulated, params);
845845

846846
std::map<std::string, std::string> mesh_input_options;
847-
shared_ptr<carve::mesh::MeshSet<3> > meshsetTriangulated(poly.m_poly_data->createMesh(mesh_input_options, eps));
848-
847+
shared_ptr<carve::mesh::MeshSet<3> > meshsetTriangulated(polyTriangulated.m_poly_data->createMesh(mesh_input_options, EPS_M7));
849848
drawMeshSet(meshsetTriangulated, geode, crease_angle, min_triangle_area, false, disableBackfaceCulling);
850849

851850
if (m_render_crease_edges)
@@ -864,7 +863,7 @@ class ConverterOSG : public StatusCallback
864863
#ifdef _DEBUG
865864
//vec4 color(0.6f, 0.6f, 0.6f, 0.1f);
866865
//GeomDebugDump::moveOffset(1);
867-
//GeomDebugDump::dumpMeshset(meshsetTriangulated, color, false, true, true);
866+
//GeomDebugDump::dumpMeshset(item_meshset, color, false, true, true);
868867
#endif
869868
}
870869
}
@@ -891,7 +890,7 @@ class ConverterOSG : public StatusCallback
891890

892891
#ifdef _DEBUG
893892
int tag = ifc_product->m_tag;
894-
if (product_guid.compare("3WMG3ehJnBiu4F_L5ltNmO") == 0 || ifc_product->classID() == IFC4X3::IFCWINDOW)
893+
if (product_guid.compare("3WMG3ehJnBiu4F_L5ltNmO") == 0 || ifc_product->classID() == IFCWINDOW)
895894
{
896895
int wait = 0;
897896
}

0 commit comments

Comments
 (0)