Fixed pointer bug, wires seem okay now

This commit is contained in:
Ken Arroyo Ohori
2017-02-01 15:57:25 -06:00
parent 233aaeaca2
commit f2a45b7057
3 changed files with 17 additions and 29 deletions
@@ -33,6 +33,7 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcCartesianPoint* l, cgal_po
// std::cout << std::endl; // std::cout << std::endl;
if (xyz.size() == 3) { if (xyz.size() == 3) {
point = new Kernel::Point_3(xyz[0], xyz[1], xyz[2]); point = new Kernel::Point_3(xyz[0], xyz[1], xyz[2]);
// std::cout << *point << std::endl;
return true; return true;
} else { } else {
point = new Kernel::Point_3(); point = new Kernel::Point_3();
+14 -27
View File
@@ -236,15 +236,15 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcFace* l, cgal_face_t& face
// //
cgal_wire_t wire; cgal_wire_t wire;
if (!convert_wire(loop, wire)) { if (!convert_wire(loop, wire)) {
// Logger::Message(Logger::LOG_ERROR, "Failed to process face boundary loop", loop->entity); Logger::Message(Logger::LOG_ERROR, "Failed to process face boundary loop", loop->entity);
// delete mf; // delete mf;
// return false; return false;
} }
//
// if (!same_sense) { // if (!same_sense) {
// wire.Reverse(); // wire.Reverse();
// } // }
// //
// wire_senses.Bind(wire.Oriented(TopAbs_FORWARD), same_sense ? TopAbs_FORWARD : TopAbs_REVERSED); // wire_senses.Bind(wire.Oriented(TopAbs_FORWARD), same_sense ? TopAbs_FORWARD : TopAbs_REVERSED);
// //
// bool flattened_wire = false; // bool flattened_wire = false;
@@ -259,14 +259,6 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcFace* l, cgal_face_t& face
// mf = new BRepBuilderAPI_MakeFace(face_surface, wire, false); // mf = new BRepBuilderAPI_MakeFace(face_surface, wire, false);
// } // }
// //
// /* BRepBuilderAPI_FaceError er = mf->Error();
// if (er == BRepBuilderAPI_NotPlanar) {
// ShapeFix_ShapeTolerance FTol;
// FTol.SetTolerance(wire, getValue(GV_PRECISION), TopAbs_WIRE);
// delete mf;
// mf = new BRepBuilderAPI_MakeFace(wire);
// } */
//
// if (mf->IsDone()) { // if (mf->IsDone()) {
// TopoDS_Face outer_face_bound = mf->Face(); // TopoDS_Face outer_face_bound = mf->Face();
// //
@@ -391,20 +383,21 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcPolyLoop* l, cgal_wire_t&
IfcSchema::IfcCartesianPoint::list::ptr points = l->Polygon(); IfcSchema::IfcCartesianPoint::list::ptr points = l->Polygon();
// Parse and store the points in a sequence // Parse and store the points in a sequence
cgal_wire_t polygon; cgal_wire_t polygon = new std::vector<Kernel::Point_3>();
for(IfcSchema::IfcCartesianPoint::list::it it = points->begin(); it != points->end(); ++ it) { for(IfcSchema::IfcCartesianPoint::list::it it = points->begin(); it != points->end(); ++ it) {
cgal_point_t pnt; cgal_point_t pnt;
IfcGeom::CgalKernel::convert(*it, pnt); IfcGeom::CgalKernel::convert(*it, pnt);
// std::cout << *pnt << std::endl;
polygon->push_back(*pnt); polygon->push_back(*pnt);
} }
// // A loop should consist of at least three vertices // A loop should consist of at least three vertices
// int original_count = polygon.Length(); int original_count = polygon->size();
// if (original_count < 3) { if (original_count < 3) {
// Logger::Message(Logger::LOG_ERROR, "Not enough edges for:", l->entity); Logger::Message(Logger::LOG_ERROR, "Not enough edges for:", l->entity);
// return false; return false;
// } }
//
// // Remove points that are too close to one another // // Remove points that are too close to one another
// remove_duplicate_points_from_loop(polygon, true); // remove_duplicate_points_from_loop(polygon, true);
// //
@@ -418,13 +411,7 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcPolyLoop* l, cgal_wire_t&
// Logger::Message(Logger::LOG_ERROR, "Not enough edges for:", l->entity); // Logger::Message(Logger::LOG_ERROR, "Not enough edges for:", l->entity);
// return false; // return false;
// } // }
//
// BRepBuilderAPI_MakePolygon w;
// for (int i = 1; i <= polygon.Length(); ++i) {
// w.Add(polygon.Value(i));
// }
// w.Close();
//
result = polygon; result = polygon;
return true; return true;
} }
+2 -2
View File
@@ -40,11 +40,11 @@ if ( it != cache.T.end() ) { e = it->second; return true; }
#undef Handle #undef Handle
#include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Nef_polyhedron_3.h> #include <CGAL/Polyhedron_3.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Nef_polyhedron_3<Kernel> *cgal_shape_t; typedef CGAL::Polyhedron_3<Kernel> *cgal_shape_t;
typedef std::vector<Kernel::Point_3> *cgal_face_t; typedef std::vector<Kernel::Point_3> *cgal_face_t;
typedef std::vector<Kernel::Point_3> *cgal_wire_t; typedef std::vector<Kernel::Point_3> *cgal_wire_t;
typedef std::vector<Kernel::Point_3> *cgal_curve_t; typedef std::vector<Kernel::Point_3> *cgal_curve_t;