From 76e531688febf23326b15517516f22619774c9b2 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Mon, 4 Dec 2006 16:41:39 +0000 Subject: [PATCH] Add middle edge points to compute mean plane of plane faces with less than 3 bounding points --- Geo/GFace.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Geo/GFace.cpp b/Geo/GFace.cpp index a90f61889d..67522421fe 100644 --- a/Geo/GFace.cpp +++ b/Geo/GFace.cpp @@ -1,4 +1,4 @@ -// $Id: GFace.cpp,v 1.27 2006-12-04 15:55:05 geuzaine Exp $ +// $Id: GFace.cpp,v 1.28 2006-12-04 16:41:39 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -140,6 +140,19 @@ void GFace::computeMeanPlane() const GVertex *v = *itv; pts.push_back(SPoint3(v->x(), v->y(), v->z())); } + + if(pts.size() < 3){ + Msg(INFO, "Adding middle edge points to compute mean plane of face %d", tag()); + std::list<GEdge*> edg = edges(); + std::list<GEdge*>::const_iterator ite = edg.begin(); + for(; ite != edg.end(); ite++){ + const GEdge *e = *ite; + Range<double> t_bounds = e->parBounds(0); + GPoint p = e->point((t_bounds.low() + t_bounds.high()) / 2.); + pts.push_back(SPoint3(p.x(), p.y(), p.z())); + } + } + computeMeanPlane(pts); } -- GitLab