0021223: EDF 1839 SMESH: Bug of convert to quadratic after pattern mapping

Use Precision::Infinite() to mark UV of node on face as "not set"
This commit is contained in:
eap 2011-04-21 13:32:29 +00:00
parent 884e982781
commit bdb6d61f8c
2 changed files with 14 additions and 14 deletions

View File

@ -473,7 +473,7 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
if ( validU ) if ( validU )
uv = C2d->Value( u ); uv = C2d->Value( u );
else else
uv.SetCoord(0.,0.); uv.SetCoord( Precision::Infinite(),0.);
if ( check || !validU ) if ( check || !validU )
uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), 10*MaxTolerance( F ),/*force=*/ !validU ); uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), 10*MaxTolerance( F ),/*force=*/ !validU );
@ -552,6 +552,10 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
uv = GetUVOnSeam( uv, GetNodeUV( F, n2, 0 )); uv = GetUVOnSeam( uv, GetNodeUV( F, n2, 0 ));
} }
} }
else
{
uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), 10*MaxTolerance( F ));
}
if ( check ) if ( check )
*check = uvOK; *check = uvOK;
@ -572,18 +576,15 @@ bool SMESH_MesherHelper::CheckNodeUV(const TopoDS_Face& F,
double distXYZ[4]) const double distXYZ[4]) const
{ {
int shapeID = n->getshapeId(); int shapeID = n->getshapeId();
if ( force || toCheckPosOnShape( shapeID )) bool infinit = ( Precision::IsInfinite( uv.X() ) || Precision::IsInfinite( uv.Y() ));
if ( force || toCheckPosOnShape( shapeID ) || infinit )
{ {
double toldis = tol;
double tolmin = 1.e-7*myMesh->GetMeshDS()->getMaxDim(); // nodes coordinates are stored in float format
if (toldis < tolmin) toldis = tolmin;
// check that uv is correct // check that uv is correct
TopLoc_Location loc; TopLoc_Location loc;
Handle(Geom_Surface) surface = BRep_Tool::Surface( F,loc ); Handle(Geom_Surface) surface = BRep_Tool::Surface( F,loc );
gp_Pnt nodePnt = XYZ( n ), surfPnt(0,0,0); gp_Pnt nodePnt = XYZ( n ), surfPnt(0,0,0);
double dist = 0; double dist = 0;
if ( !loc.IsIdentity() ) nodePnt.Transform( loc.Transformation().Inverted() ); if ( !loc.IsIdentity() ) nodePnt.Transform( loc.Transformation().Inverted() );
bool infinit = ( Precision::IsInfinite( uv.X() ) || Precision::IsInfinite( uv.Y() ));
if ( infinit || if ( infinit ||
(dist = nodePnt.Distance( surfPnt = surface->Value( uv.X(), uv.Y() ))) > tol ) (dist = nodePnt.Distance( surfPnt = surface->Value( uv.X(), uv.Y() ))) > tol )
{ {
@ -776,10 +777,6 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
int shapeID = n->getshapeId(); int shapeID = n->getshapeId();
if ( force || toCheckPosOnShape( shapeID )) if ( force || toCheckPosOnShape( shapeID ))
{ {
//double toldis = tol;
//double tolmin = 1.e-7*myMesh->GetMeshDS()->getMaxDim(); // nodes coordinates are stored in float format
//if (toldis < tolmin) toldis = tolmin;
// check that u is correct
TopLoc_Location loc; double f,l; TopLoc_Location loc; double f,l;
Handle(Geom_Curve) curve = BRep_Tool::Curve( E,loc,f,l ); Handle(Geom_Curve) curve = BRep_Tool::Curve( E,loc,f,l );
if ( curve.IsNull() ) // degenerated edge if ( curve.IsNull() ) // degenerated edge
@ -801,7 +798,7 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
distXYZ[0] = dist; distXYZ[0] = dist;
distXYZ[1] = curvPnt.X(); distXYZ[2] = curvPnt.Y(); distXYZ[3]=curvPnt.Z(); distXYZ[1] = curvPnt.X(); distXYZ[2] = curvPnt.Y(); distXYZ[3]=curvPnt.Z();
} }
if ( dist > tol /*toldis*/ ) if ( dist > tol )
{ {
setPosOnShapeValidity( shapeID, false ); setPosOnShapeValidity( shapeID, false );
// u incorrect, project the node to the curve // u incorrect, project the node to the curve
@ -830,10 +827,10 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
distXYZ[0] = dist; distXYZ[0] = dist;
distXYZ[1] = curvPnt.X(); distXYZ[2] = curvPnt.Y(); distXYZ[3]=curvPnt.Z(); distXYZ[1] = curvPnt.X(); distXYZ[2] = curvPnt.Y(); distXYZ[3]=curvPnt.Z();
} }
if ( dist > tol /*toldis*/) if ( dist > tol )
{ {
MESSAGE( "SMESH_MesherHelper::CheckNodeU(), invalid projection" ); MESSAGE( "SMESH_MesherHelper::CheckNodeU(), invalid projection" );
MESSAGE("distance " << dist << " " << tol/*dis*/); MESSAGE("distance " << dist << " " << tol );
return false; return false;
} }
// store the fixed U on the edge // store the fixed U on the edge

View File

@ -40,6 +40,7 @@
#include <GeomAdaptor_Surface.hxx> #include <GeomAdaptor_Surface.hxx>
#include <Geom_Curve.hxx> #include <Geom_Curve.hxx>
#include <Geom_Surface.hxx> #include <Geom_Surface.hxx>
#include <Precision.hxx>
#include <TopAbs_ShapeEnum.hxx> #include <TopAbs_ShapeEnum.hxx>
#include <TopExp.hxx> #include <TopExp.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
@ -4121,7 +4122,9 @@ void SMESH_Pattern::createElements(SMESH_Mesh* theMes
if (!node->getshapeId() && if (!node->getshapeId() &&
shellNodes.find( node ) == shellNodes.end() ) { shellNodes.find( node ) == shellNodes.end() ) {
if ( S.ShapeType() == TopAbs_FACE ) if ( S.ShapeType() == TopAbs_FACE )
aMeshDS->SetNodeOnFace( node, shapeID ); aMeshDS->SetNodeOnFace( node, shapeID,
Precision::Infinite(),// <- it's a sign that UV is not set
Precision::Infinite());
else { else {
aMeshDS->SetNodeInVolume( node, shapeID ); aMeshDS->SetNodeInVolume( node, shapeID );
shellNodes.insert( node ); shellNodes.insert( node );