Skip to content
Snippets Groups Projects
Commit 7be877d6 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

true bounding boxes

parent 8fa0d5e7
Branches
Tags
No related merge requests found
...@@ -45,6 +45,16 @@ OCCEdge::~OCCEdge() ...@@ -45,6 +45,16 @@ OCCEdge::~OCCEdge()
model()->getOCCInternals()->unbind(c); model()->getOCCInternals()->unbind(c);
} }
SBoundingBox3d OCCEdge::bounds() const
{
Bnd_Box b;
BRepBndLib::Add(c, b);
double xmin, ymin, zmin, xmax, ymax, zmax;
b.Get(xmin, ymin, zmin, xmax, ymax, zmax);
SBoundingBox3d bbox(xmin, ymin, zmin, xmax, ymax, zmax);
return bbox;
}
Range<double> OCCEdge::parBounds(int i) const Range<double> OCCEdge::parBounds(int i) const
{ {
return Range<double>(s0, s1); return Range<double>(s0, s1);
......
...@@ -28,6 +28,7 @@ class OCCEdge : public GEdge { ...@@ -28,6 +28,7 @@ class OCCEdge : public GEdge {
public: public:
OCCEdge(GModel *model, TopoDS_Edge _e, int num, GVertex *v1, GVertex *v2); OCCEdge(GModel *model, TopoDS_Edge _e, int num, GVertex *v1, GVertex *v2);
virtual ~OCCEdge(); virtual ~OCCEdge();
virtual SBoundingBox3d bounds() const;
virtual Range<double> parBounds(int i) const; virtual Range<double> parBounds(int i) const;
virtual GeomType geomType() const; virtual GeomType geomType() const;
virtual bool degenerate(int) const { return BRep_Tool::Degenerated(c); } virtual bool degenerate(int) const { return BRep_Tool::Degenerated(c); }
......
...@@ -125,6 +125,16 @@ void OCCFace::setup() ...@@ -125,6 +125,16 @@ void OCCFace::setup()
// } // }
} }
SBoundingBox3d OCCFace::bounds() const
{
Bnd_Box b;
BRepBndLib::Add(s, b);
double xmin, ymin, zmin, xmax, ymax, zmax;
b.Get(xmin, ymin, zmin, xmax, ymax, zmax);
SBoundingBox3d bbox(xmin, ymin, zmin, xmax, ymax, zmax);
return bbox;
}
Range<double> OCCFace::parBounds(int i) const Range<double> OCCFace::parBounds(int i) const
{ {
double umin2, umax2, vmin2, vmax2; double umin2, umax2, vmin2, vmax2;
......
...@@ -31,6 +31,7 @@ class OCCFace : public GFace { ...@@ -31,6 +31,7 @@ class OCCFace : public GFace {
public: public:
OCCFace(GModel *m, TopoDS_Face s, int num); OCCFace(GModel *m, TopoDS_Face s, int num);
virtual ~OCCFace(); virtual ~OCCFace();
virtual SBoundingBox3d bounds() const;
Range<double> parBounds(int i) const; Range<double> parBounds(int i) const;
virtual GPoint point(double par1, double par2) const; virtual GPoint point(double par1, double par2) const;
virtual GPoint closestPoint(const SPoint3 & queryPoint, virtual GPoint closestPoint(const SPoint3 & queryPoint,
......
...@@ -47,6 +47,16 @@ void OCCRegion::setup() ...@@ -47,6 +47,16 @@ void OCCRegion::setup()
Msg::Debug("OCC Region %d with %d faces", tag(), l_faces.size()); Msg::Debug("OCC Region %d with %d faces", tag(), l_faces.size());
} }
SBoundingBox3d OCCRegion::bounds() const
{
Bnd_Box b;
BRepBndLib::Add(s, b);
double xmin, ymin, zmin, xmax, ymax, zmax;
b.Get(xmin, ymin, zmin, xmax, ymax, zmax);
SBoundingBox3d bbox(xmin, ymin, zmin, xmax, ymax, zmax);
return bbox;
}
GEntity::GeomType OCCRegion::geomType() const GEntity::GeomType OCCRegion::geomType() const
{ {
return Unknown; return Unknown;
......
...@@ -19,6 +19,7 @@ class OCCRegion : public GRegion { ...@@ -19,6 +19,7 @@ class OCCRegion : public GRegion {
public: public:
OCCRegion(GModel *m, TopoDS_Solid s, int num); OCCRegion(GModel *m, TopoDS_Solid s, int num);
virtual ~OCCRegion(); virtual ~OCCRegion();
virtual SBoundingBox3d bounds() const;
virtual GeomType geomType() const; virtual GeomType geomType() const;
ModelType getNativeType() const { return OpenCascadeModel; } ModelType getNativeType() const { return OpenCascadeModel; }
void * getNativePtr() const { return (void*)&s; } void * getNativePtr() const { return (void*)&s; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment