mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Skeleton for planes+halfspaces. Might be wrong.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user