- switch ( posType ) {
- case SMDS_TOP_FACE: {
- SMDS_FacePosition* fPos = ( SMDS_FacePosition* ) pos;
- uv.SetCoord( fPos->GetUParameter(), fPos->GetVParameter() );
- break;
- }
- case SMDS_TOP_EDGE: {
- TopoDS_Shape S = aMesh->IndexToShape( node->getshapeId() );
- Handle(Geom2d_Curve) pcurve;
- if ( !S.IsNull() && S.ShapeType() == TopAbs_EDGE )
- pcurve = BRep_Tool::CurveOnSurface( TopoDS::Edge( S ), face, f,l );
- if ( !pcurve.IsNull() ) {
- double u = (( SMDS_EdgePosition* ) pos )->GetUParameter();
- uv = pcurve->Value( u ).XY();
- }
- break;
- }
- case SMDS_TOP_VERTEX: {
- TopoDS_Shape S = aMesh->IndexToShape( node->getshapeId() );
- if ( !S.IsNull() && S.ShapeType() == TopAbs_VERTEX )
- uv = BRep_Tool::Parameters( TopoDS::Vertex( S ), face ).XY();
- break;
- }
- default:;
- }
- // check existing UV
- bool project = true;
- gp_Pnt pNode ( node->X(), node->Y(), node->Z() );
- double dist1 = DBL_MAX, dist2 = 0;
- if ( posType != SMDS_TOP_3DSPACE ) {
- dist1 = pNode.SquareDistance( surface->Value( uv.X(), uv.Y() ));
- project = dist1 > fToler2;
- }
+ if ( pos )
+ {
+ bool toCheck = true;
+ uv = helper.GetNodeUV( face, node, nodeInFace, &toCheck );
+ }
+ // compute not existing UV
+ bool project = ( posType == SMDS_TOP_3DSPACE );
+ // double dist1 = DBL_MAX, dist2 = 0;
+ // if ( posType != SMDS_TOP_3DSPACE ) {
+ // dist1 = pNode.SquareDistance( surface->Value( uv.X(), uv.Y() ));
+ // project = dist1 > fToler2;
+ // }