From 233aaeaca2de096d4388f1759905e8114a3c9d49 Mon Sep 17 00:00:00 2001 From: Ken Arroyo Ohori Date: Tue, 31 Jan 2017 19:03:15 -0600 Subject: [PATCH] Points and wires --- .../kernels/cgal/CgalConversionFunctions.cpp | 19 ++++++++++--------- .../kernels/cgal/CgalEntityMapping.cpp | 10 +++++----- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/ifcgeom/kernels/cgal/CgalConversionFunctions.cpp b/src/ifcgeom/kernels/cgal/CgalConversionFunctions.cpp index f226d7c9e4..53336e0da5 100644 --- a/src/ifcgeom/kernels/cgal/CgalConversionFunctions.cpp +++ b/src/ifcgeom/kernels/cgal/CgalConversionFunctions.cpp @@ -28,13 +28,14 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcExtrudedAreaSolid*, cgal_s } bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcCartesianPoint* l, cgal_point_t& point) { -// IN_CACHE(IfcCartesianPoint,l,gp_Pnt,point) -// std::vector xyz = l->Coordinates(); -// point = gp_Pnt( -// xyz.size() ? (xyz[0]*getValue(GV_LENGTH_UNIT)) : 0.0f, -// xyz.size() > 1 ? (xyz[1]*getValue(GV_LENGTH_UNIT)) : 0.0f, -// xyz.size() > 2 ? (xyz[2]*getValue(GV_LENGTH_UNIT)) : 0.0f -// ); -// CACHE(IfcCartesianPoint,l,point) - return true; + std::vector xyz = l->Coordinates(); +// for (const double &coordinate: xyz) std::cout << coordinate << " "; +// std::cout << std::endl; + if (xyz.size() == 3) { + point = new Kernel::Point_3(xyz[0], xyz[1], xyz[2]); + return true; + } else { + point = new Kernel::Point_3(); + return false; + } } diff --git a/src/ifcgeom/kernels/cgal/CgalEntityMapping.cpp b/src/ifcgeom/kernels/cgal/CgalEntityMapping.cpp index c04005e65d..b093aa2679 100644 --- a/src/ifcgeom/kernels/cgal/CgalEntityMapping.cpp +++ b/src/ifcgeom/kernels/cgal/CgalEntityMapping.cpp @@ -390,14 +390,14 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcFace* l, cgal_face_t& face bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcPolyLoop* l, cgal_wire_t& result) { IfcSchema::IfcCartesianPoint::list::ptr points = l->Polygon(); -// // Parse and store the points in a sequence -// TColgp_SequenceOfPnt polygon; + // Parse and store the points in a sequence + cgal_wire_t polygon; for(IfcSchema::IfcCartesianPoint::list::it it = points->begin(); it != points->end(); ++ it) { cgal_point_t pnt; IfcGeom::CgalKernel::convert(*it, pnt); -// polygon.Append(pnt); + polygon->push_back(*pnt); } -// + // // A loop should consist of at least three vertices // int original_count = polygon.Length(); // if (original_count < 3) { @@ -425,7 +425,7 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcPolyLoop* l, cgal_wire_t& // } // w.Close(); // -// result = w.Wire(); + result = polygon; return true; }