diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp index cded8e55516dcc21a6f3b03faa64f2ca185a020a..e2910075844904adaca1e039a1823769cabb3160 100644 --- a/Geo/GEdge.cpp +++ b/Geo/GEdge.cpp @@ -38,6 +38,19 @@ GEdge::~GEdge() lines.clear(); } +SBoundingBox3d GEdge::bounds() const +{ + Range<double> tr = parBounds(0); + SBoundingBox3d bbox; + const int N = 10; + for(int i = 0; i < N; i++){ + double t = tr.low() + (double)i/(double)(N - 1) * (tr.high() - tr.low()); + GPoint p = point(t); + bbox += SPoint3(p.x(), p.y(), p.z()); + } + return bbox; +} + void GEdge::setVisibility(char val, bool recursive) { GEntity::setVisibility(val); diff --git a/Geo/GEdge.h b/Geo/GEdge.h index fb93f2e0233280777361921a1aef37f0f6c66267..5552b5399020c4b5a177d5ed5226597703f82ec2 100644 --- a/Geo/GEdge.h +++ b/Geo/GEdge.h @@ -33,6 +33,9 @@ class GEdge : public GEntity { virtual bool continuous(int dim=0) const = 0; virtual void setVisibility(char val, bool recursive=false); + // The bounding box + SBoundingBox3d bounds() const; + // Get the parameter location for a point in space on the edge. virtual double parFromPoint(const SPoint3 &) const = 0; diff --git a/Geo/GEntity.h b/Geo/GEntity.h index e4453f45abef15ac501cf3a407d45c6da8da7727..9c3d482fce65e75522cf9932c44d25d360b66331 100644 --- a/Geo/GEntity.h +++ b/Geo/GEntity.h @@ -135,12 +135,16 @@ class GEntity { // The bounding box virtual SBoundingBox3d bounds() const{throw;} - // Get/set the visibility flag + // Get the visibility flag virtual char getVisibility(){ return _visible; } + + // Set the visibility flag virtual void setVisibility(char val, bool recursive=false){ _visible = val; } - // Get/set the multi-purpose flag + // Get the multi-purpose flag virtual char getFlag(){ return _flag; } + + // Set the multi-purpose flag virtual void setFlag(char val){ _flag = val; } // Returns an information string for the entity diff --git a/Geo/GVertex.h b/Geo/GVertex.h index dfd9cb15e30cc0da94422ade3f904aae890d21cb..9e595a0d01a39c760c3de33c4261b4665a3170ef 100644 --- a/Geo/GVertex.h +++ b/Geo/GVertex.h @@ -6,7 +6,7 @@ #include "GPoint.h" // A model vertex -class GVertex : public GEntity +class GVertex : public GEntity { protected: std::list<GEdge*> l_edges; diff --git a/Geo/gmshEdge.cpp b/Geo/gmshEdge.cpp index 8f08f5c06b34a66137cf21e73b46796b48e20f8e..a33d86645fc06d5c958830efcda296f35e1ee229 100644 --- a/Geo/gmshEdge.cpp +++ b/Geo/gmshEdge.cpp @@ -28,18 +28,6 @@ Range<double> gmshEdge::parBounds(int i) const return(Range<double>(c->ubeg, c->uend)); } -SBoundingBox3d gmshEdge::bounds() const -{ - SBoundingBox3d bbox; - const int N = 10; - for(int i = 0; i < N; i++){ - double u = c->ubeg + (double)i/(double)(N - 1) * (c->uend - c->ubeg); - Vertex a = InterpolateCurve(c, u, 0); - bbox += SPoint3(a.Pos.X, a.Pos.Y, a.Pos.Z); - } - return bbox; -} - GPoint gmshEdge::point(double par) const { Vertex a = InterpolateCurve(c, par, 0); diff --git a/Geo/gmshEdge.h b/Geo/gmshEdge.h index ced0f6135d0ca87c5933876ac4bb7b46b706fd5f..71e8207c1dd8bc92d8621206d23458d8f78f9a68 100644 --- a/Geo/gmshEdge.h +++ b/Geo/gmshEdge.h @@ -16,12 +16,11 @@ class gmshEdge : public GEdge { gmshEdge(GModel *model, int num); virtual ~gmshEdge() {} double period() const { throw ; } - Range<double> parBounds(int i) const; virtual bool periodic(int dim=0) const { return false; } + virtual Range<double> parBounds(int i) const; virtual GeomType geomType() const; virtual bool degenerate(int) const { return false; } virtual bool continuous(int dim) const { return true; } - SBoundingBox3d bounds() const; virtual GPoint point(double p) const; virtual GPoint closestPoint(const SPoint3 & queryPoint); virtual int containsPoint(const SPoint3 &pt) const { throw; }