Skeleton for planes+halfspaces. Might be wrong.

This commit is contained in:
Ken Arroyo Ohori
2017-03-07 14:30:48 -06:00
parent 27d8e86024
commit 3f94d4af37
4 changed files with 33 additions and 0 deletions
@@ -49,6 +49,18 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcDirection* l, cgal_directi
return true;
}
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcPlane* pln, cgal_plane_t& plane) {
// IN_CACHE(IfcPlane,pln,gp_Pln,plane)
IfcSchema::IfcAxis2Placement3D* l = pln->Position();
cgal_point_t o;
cgal_direction_t axis = Kernel::Vector_3(0,0,1);
IfcGeom::CgalKernel::convert(l->Location(),o);
if ( l->hasAxis() ) IfcGeom::CgalKernel::convert(l->Axis(),axis);
plane = Kernel::Plane_3(o, axis);
// CACHE(IfcPlane,pln,plane)
return true;
}
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcAxis2Placement2D* l, cgal_placement_t& trsf) {
// IN_CACHE(IfcAxis2Placement3D,l,gp_Trsf,trsf)
cgal_point_t o;
@@ -47,6 +47,7 @@ SHAPE(IfcRectangularPyramid);
SHAPE(IfcRightCircularCylinder);
SHAPE(IfcRightCircularCone);
SHAPE(IfcTriangulatedFaceSet);
SHAPE(IfcHalfSpaceSolid);
FACE(IfcArbitraryClosedProfileDef);
FACE(IfcCircleHollowProfileDef);
@@ -65,6 +66,7 @@ WIRE(IfcPolyline);
CLASS(IfcCartesianPoint,cgal_point_t);
CLASS(IfcDirection,cgal_direction_t);
CLASS(IfcPlane,cgal_plane_t);
CLASS(IfcAxis2Placement2D,cgal_placement_t);
CLASS(IfcAxis2Placement3D,cgal_placement_t);
CLASS(IfcObjectPlacement,cgal_placement_t);
@@ -925,3 +925,21 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcTriangulatedFaceSet* l, cg
shape = CGAL::Nef_polyhedron_3<Kernel>(polyhedron);
return true;
}
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcHalfSpaceSolid* l, cgal_shape_t& shape) {
IfcSchema::IfcSurface* surface = l->BaseSurface();
if ( ! surface->is(IfcSchema::Type::IfcPlane) ) {
Logger::Message(Logger::LOG_ERROR, "Unsupported BaseSurface:", surface->entity);
return false;
}
cgal_plane_t pln;
IfcGeom::CgalKernel::convert((IfcSchema::IfcPlane*)surface,pln);
// TODO: This might be the other way around?
if (!l->AgreementFlag()) pln = pln.opposite();
// const gp_Pnt pnt = pln.Location().Translated( l->AgreementFlag() ? -pln.Axis().Direction() : pln.Axis().Direction());
// shape = BRepPrimAPI_MakeHalfSpace(BRepBuilderAPI_MakeFace(pln),pnt).Solid();
shape = CGAL::Nef_polyhedron_3<Kernel>(pln);
return true;
}
+1
View File
@@ -54,6 +54,7 @@ typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef Kernel::Aff_transformation_3 cgal_placement_t;
typedef Kernel::Point_3 cgal_point_t;
typedef Kernel::Vector_3 cgal_direction_t;
typedef Kernel::Plane_3 cgal_plane_t;
typedef std::vector<Kernel::Point_3> cgal_curve_t;
typedef std::vector<Kernel::Point_3> cgal_wire_t;