From 2cf7cee433306fca3728d6c8ddc7ba91104f99ca Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sun, 13 Aug 2006 22:41:34 +0000 Subject: [PATCH] *** empty log message *** --- Geo/GEdge.cpp | 13 +++++++++++++ Geo/GEdge.h | 3 +++ Geo/GEntity.h | 8 ++++++-- Geo/GVertex.h | 2 +- Geo/gmshEdge.cpp | 12 ------------ Geo/gmshEdge.h | 3 +-- 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp index cded8e5551..e291007584 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 fb93f2e023..5552b53990 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 e4453f45ab..9c3d482fce 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 dfd9cb15e3..9e595a0d01 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 8f08f5c06b..a33d86645f 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 ced0f6135d..71e8207c1d 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; } -- GitLab