diff --git a/Geo/GFace.cpp b/Geo/GFace.cpp index 389389275c60869d4aa5f03cde87a4d447f76ce3..2cdaec14d20ceef5d0dc330355a42a4ae76c123d 100644 --- a/Geo/GFace.cpp +++ b/Geo/GFace.cpp @@ -265,15 +265,17 @@ end: //check coherence for plane surfaces if(geomType() == GEntity::Plane) { + SBoundingBox3d bb = bounds(); + double lc = norm(SVector3(bb.max(), bb.min())); std::list<GVertex*> verts = vertices(); std::list<GVertex*>::const_iterator itv = verts.begin(); for(; itv != verts.end(); itv++){ const GVertex *v = *itv; double d = meanPlane.a * v->x() + meanPlane.b * v->y() + meanPlane.c * v->z() - meanPlane.d; - if(fabs(d) > 1.e-3) { + if(fabs(d) > lc * 1.e-3) { Msg(GERROR1, "Plane surface %d (%gx+%gy+%gz+%g=0) is not plane!", - v->tag(), meanPlane.a, meanPlane.b, meanPlane.c, meanPlane.d); + tag(), meanPlane.a, meanPlane.b, meanPlane.c, meanPlane.d); Msg(GERROR3, "Control point %d = (%g,%g,%g), val=%g", v->tag(), v->x(), v->y(), v->z(), d); return; diff --git a/Geo/gmshEdge.cpp b/Geo/gmshEdge.cpp index e9c242a829cbf4aa0cd9a05f3ea1e59a254c6fd6..7eb42e2cd968192aab70095b17c8cf2966d6a582 100644 --- a/Geo/gmshEdge.cpp +++ b/Geo/gmshEdge.cpp @@ -34,29 +34,13 @@ Range<double> gmshEdge::parBounds(int i) const SBoundingBox3d gmshEdge::bounds() const { - double xmin = 0., ymin = 0., zmin = 0.; - double xmax = 0., ymax = 0., zmax = 0.; - for (int i = 0; i < 20; i++){ - double u = c->ubeg + (i/19.) * (c->uend - c->ubeg); + 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); - if (!i){ - xmin = xmax = a.Pos.X; - ymin = ymax = a.Pos.Y; - zmin = zmax = a.Pos.Z; - } - else{ - if(a.Pos.X < xmin) xmin = a.Pos.X; - if(a.Pos.Y < ymin) ymin = a.Pos.Z; - if(a.Pos.Z < zmin) zmin = a.Pos.Y; - if(a.Pos.X > xmax) xmax = a.Pos.X; - if(a.Pos.Y > ymax) ymax = a.Pos.Z; - if(a.Pos.Z > zmax) zmax = a.Pos.Y; - } + bbox += SPoint3(a.Pos.X, a.Pos.Y, a.Pos.Z); } - SPoint3 bmin(xmin, ymin, zmin); - SPoint3 bmax(xmax, ymax, zmax); - SBoundingBox3d bbox(bmin); - bbox += bmax; return bbox; } diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp index 65cf56073d1909270a1ef5896d4370c863f1283b..ff53ae3121153fa71d4a09a987ffb1b3fbb12327 100644 --- a/Mesh/meshGFace.cpp +++ b/Mesh/meshGFace.cpp @@ -12,6 +12,8 @@ #include "Numeric.h" #include "BDS.h" +extern Context_T CTX; + int Orientation (std::vector<MVertex*> &cu) { int N, i, a, b, c; @@ -65,8 +67,6 @@ int Orientation (std::vector<MVertex*> &cu) -extern Context_T CTX; - class fromCartesianToParametric { GFace *gf;