Commit dbc8e809 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[occ][brep] implement getshape for bboxes

This reuses the code of getShape(box) for now. But, when the Box class
is made more generic (not necessarily axis-aligned), then the code will
be different.
parent 31c4506e
......@@ -91,6 +91,7 @@
#include <frackit/geometry/cylindersurface.hh>
#include <frackit/geometry/box.hh>
#include <frackit/geometry/boundingbox.hh>
#include <frackit/geometry/boundingbox.hh>
#include <frackit/geometry/sphere.hh>
#include <frackit/geometryutilities/name.hh>
......@@ -323,6 +324,8 @@ namespace OCCUtilities {
/*!
* \ingroup OpenCascade
* \brief Get the BRep of a box.
* \todo TODO: Once boxes are more generic (than axis-aligned
* bounding boxes), this must be adapted
*/
template<class ctype>
TopoDS_Solid getShape(const Box<ctype>& box)
......@@ -336,6 +339,22 @@ namespace OCCUtilities {
return TopoDS::Solid(makeBox.Shape());
}
/*!
* \ingroup OpenCascade
* \brief Get the BRep of a bounding box.
*/
template<class ctype>
TopoDS_Solid getShape(const BoundingBox<ctype>& bbox)
{
const gp_Pnt pMin(bbox.xMin(), bbox.yMin(), bbox.zMin());
const gp_Pnt pMax(bbox.xMax(), bbox.yMax(), bbox.zMax());
BRepPrimAPI_MakeBox makeBox(pMin, pMax);
makeBox.Build();
if (!makeBox.IsDone())
throw std::runtime_error("Could not build box");
return TopoDS::Solid(makeBox.Shape());
}
/*!
* \ingroup OpenCascade
* \brief Get the BRep of a sphere.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment