Skip to content
Snippets Groups Projects
Commit 227d3128 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

Rescue mode in XYtoUV

parent c36fae95
No related branches found
No related tags found
No related merge requests found
// $Id: Utils.cpp,v 1.4 2001-11-05 08:37:27 geuzaine Exp $ // $Id: Utils.cpp,v 1.5 2001-11-08 10:16:41 geuzaine Exp $
#include "Gmsh.h" #include "Gmsh.h"
#include "Numeric.h" #include "Numeric.h"
...@@ -362,24 +362,21 @@ void XYtoUV (Surface * s, double *X, double *Y, ...@@ -362,24 +362,21 @@ void XYtoUV (Surface * s, double *X, double *Y,
else Msg(WARNING, "Many (%d) iterations in XYtoUV...", iter); else Msg(WARNING, "Many (%d) iterations in XYtoUV...", iter);
} }
if (Unew > umax || Vnew > vmax || Unew < umin || Vnew < vmin){ int thresh = Unew > umax || Vnew > vmax || Unew < umin || Vnew < vmin;
Msg(WARNING, "(U,V) thresholded in XYtoUV (surface mesh may be wrong)");
if (thresh){
//Msg(WARNING, "(U,V) thresholded in XYtoUV (surface mesh may be wrong)");
if(Unew > umax) *U = umax; if(Unew > umax) *U = umax;
if(Vnew > vmax) *V = vmax; if(Vnew > vmax) *V = vmax;
if(Unew < umin) *U = umin; if(Unew < umin) *U = umin;
if(Vnew < vmin) *V = vmin; if(Vnew < vmin) *V = vmin;
} }
#if 0 #if 1
if (iter == MaxIter || Unew > umax || Vnew > vmax || Unew < umin || Vnew < vmin){ if (iter == MaxIter || thresh){
static int first_try=1; Msg(WARNING, "Entering rescue mode in XYtoUV: surface mesh may be wrong");
if(first_try){
Msg(WARNING, "Entering rescue mode in XYtoUV...");
first_try=0;
}
find_bestuv (s, *X, *Y, U, V, Z, 30); find_bestuv (s, *X, *Y, U, V, Z, 30);
P = InterpolateSurface (s, *U, *V, 0, 0); P = InterpolateSurface (s, *U, *V, 0, 0);
*X = P.Pos.X; *X = P.Pos.X;
*Y = P.Pos.Y; *Y = P.Pos.Y;
*Z = P.Pos.Z; *Z = P.Pos.Z;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment