diff --git a/Geo/discreteVertex.h b/Geo/discreteVertex.h index 3e35f02dc9f3ee48628007515275b96522a01951..a1da63c9cf4abab5a4ad5146fe6733055abf9771 100644 --- a/Geo/discreteVertex.h +++ b/Geo/discreteVertex.h @@ -9,7 +9,7 @@ class discreteVertex : public GVertex { public: discreteVertex(GModel *m, int num) : GVertex(m, num) {} virtual ~discreteVertex() {} - virtual GPoint point() const { return GPoint(x(), y(), z()); } + virtual GPoint point() const { return GPoint(x(), y(), z(), this); } virtual double x() const { return mesh_vertices.size() ? mesh_vertices[0]->x() : 0.; diff --git a/Geo/gmshVertex.cpp b/Geo/gmshVertex.cpp index 4c57ed3607476cfb8b881786a64b2e3bc5aba193..eb5ee0ecefdd0eeb7635f7dd3b305fb55b562abd 100644 --- a/Geo/gmshVertex.cpp +++ b/Geo/gmshVertex.cpp @@ -12,12 +12,13 @@ SPoint2 gmshVertex::reparamOnFace(GFace *face, int dir) const if(s->geometry){ // It is not always right if it is periodic. - if (l_edges.size() == 1 && - (*l_edges.begin())->getBeginVertex() == (*l_edges.begin())->getEndVertex()){ + if(l_edges.size() == 1 && + (*l_edges.begin())->getBeginVertex() == + (*l_edges.begin())->getEndVertex()){ Range<double> bb = (*l_edges.begin())->parBounds(0); - return (*l_edges.begin())->reparamOnFace ( face, bb.low(), dir); + return (*l_edges.begin())->reparamOnFace(face, bb.low(), dir); } - return v -> pntOnGeometry; + return v->pntOnGeometry; } if(s->Typ == MSH_SURF_REGL){ @@ -57,16 +58,16 @@ SPoint2 gmshVertex::reparamOnFace(GFace *face, int dir) const Msg(INFO, "Reparameterizing point %d on face %d", v->Num, s->Num); return GVertex::reparamOnFace(face, dir); } - return SPoint2(U,V); + return SPoint2(U, V); } else{ - return GVertex::reparamOnFace(face,dir); + return GVertex::reparamOnFace(face, dir); } } GEntity::GeomType gmshVertex::geomType() const { - if(v && v->Typ == MSH_POINT_BND_LAYER) + if(v->Typ == MSH_POINT_BND_LAYER) return BoundaryLayerPoint; else return Point; diff --git a/Geo/gmshVertex.h b/Geo/gmshVertex.h index e066dcf86b2d69c040f31c31e85fb2019972f428..19aeacc8c596811d8f307abfbaec43eddb8cc328 100644 --- a/Geo/gmshVertex.h +++ b/Geo/gmshVertex.h @@ -36,43 +36,20 @@ class gmshVertex : public GVertex { virtual ~gmshVertex() {} virtual GPoint point() const { - if(v) - return GPoint(v->Pos.X, v->Pos.Y, v->Pos.Z, this); - else if(mesh_vertices.size()) - return GPoint(mesh_vertices[0]->x(), - mesh_vertices[0]->y(), - mesh_vertices[0]->z(), this); - else - return GPoint(0., 0., 0., this); - } - virtual double x() const - { - return v ? v->Pos.X : mesh_vertices.size() ? mesh_vertices[0]->x() : 0.; - } - virtual double y() const - { - return v ? v->Pos.Y : mesh_vertices.size() ? mesh_vertices[0]->y() : 0.; - } - virtual double z() const - { - return v ? v->Pos.Z : mesh_vertices.size() ? mesh_vertices[0]->z() : 0.; + return GPoint(v->Pos.X, v->Pos.Y, v->Pos.Z, this); } + virtual double x() const { return v->Pos.X; } + virtual double y() const { return v->Pos.Y; } + virtual double z() const { return v->Pos.Z; } virtual void setPosition(GPoint &p) { - if(v){ - v->Pos.X = p.x(); - v->Pos.Y = p.y(); - v->Pos.Z = p.z(); - } - if(mesh_vertices.size()){ - mesh_vertices[0]->x() = p.x(); - mesh_vertices[0]->y() = p.y(); - mesh_vertices[0]->z() = p.z(); - } + v->Pos.X = p.x(); + v->Pos.Y = p.y(); + v->Pos.Z = p.z(); } virtual GeomType geomType() const; ModelType getNativeType() const { return GmshModel; } - void * getNativePtr() const { return v; } + void *getNativePtr() const { return v; } virtual void setPrescribedMeshSizeAtVertex(double l) { meshSize = l; diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index 36537d7d8d859f0d346a25205e50cb585211920b..321a5a99522ce680be72d499cba00060c9267785 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -1,4 +1,4 @@ -// $Id: Geom.cpp,v 1.144 2008-01-19 22:06:02 geuzaine Exp $ +// $Id: Geom.cpp,v 1.145 2008-02-03 08:25:36 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -28,6 +28,17 @@ extern Context_T CTX; +void drawBBox(GEntity *e) +{ + return; + glColor4ubv((GLubyte *) & CTX.color.fg); + glLineWidth(CTX.line_width); + gl2psLineWidth(CTX.line_width * CTX.print.eps_line_width_factor); + SBoundingBox3d bb = e->bounds(); + Draw_Box(bb.min().x(), bb.min().y(), bb.min().z(), + bb.max().x(), bb.max().y(), bb.max().z()); +} + class drawGVertex { public : void operator () (GVertex *v) @@ -179,6 +190,8 @@ class drawGEdge { CTX.arrow_rel_stem_length, CTX.arrow_rel_stem_radius, p.x(), p.y(), p.z(), der[0], der[1], der[2], CTX.geom.light); } + + if(CTX.draw_bbox) drawBBox(e); if(CTX.render_mode == GMSH_SELECT) { glPopName(); @@ -439,6 +452,8 @@ public : else _drawNonPlaneGFace(f); + if(CTX.draw_bbox) drawBBox(f); + if(CTX.render_mode == GMSH_SELECT) { glPopName(); glPopName(); @@ -480,6 +495,8 @@ class drawGRegion { Draw_String(Num); } + if(CTX.draw_bbox) drawBBox(r); + if(CTX.render_mode == GMSH_SELECT) { glPopName(); glPopName();