From 475d7c1304e733196b4da8b4c083f9c0ae6927d2 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 2 Feb 2016 21:10:57 +0300 Subject: [PATCH] Fix regressions in QuadTo4Tri() and QuadToTri() mesh_Quadratic_00/A3 imps_09/K8 --- src/SMESH/SMESH_MeshEditor.cxx | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 56371d711..79ecf615d 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -1601,13 +1601,13 @@ void SMESH_MeshEditor::QuadTo4Tri (TIDSortedElemSet & theElems) // create 4 triangles - GetMeshDS()->RemoveFreeElement( quad, subMeshDS, /*fromGroups=*/false ); - helper.SetIsQuadratic ( nodes.size() > 4 ); helper.SetIsBiQuadratic( nodes.size() == 9 ); if ( helper.GetIsQuadratic() ) helper.AddTLinks( static_cast< const SMDS_MeshFace*>( quad )); + GetMeshDS()->RemoveFreeElement( quad, subMeshDS, /*fromGroups=*/false ); + for ( int i = 0; i < 4; ++i ) { SMDS_MeshElement* tria = helper.AddFace( nodes[ i ], @@ -2997,30 +2997,27 @@ bool SMESH_MeshEditor::QuadToTri (TIDSortedElemSet & theElems, } const SMDS_MeshNode* aNodes [8]; - const SMDS_MeshNode* inFaceNode = 0; SMDS_ElemIteratorPtr itN = elem->nodesIterator(); - int i = 0; + for ( int i = 0; itN->more(); ++i ) + aNodes[ i ] = static_cast( itN->next() ); + + const SMDS_MeshNode* inFaceNode = 0; if ( helper.GetNodeUVneedInFaceNode() ) - while ( itN->more() && !inFaceNode ) { - aNodes[ i++ ] = static_cast( itN->next() ); - if ( aNodes[ i-1 ]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE ) - { - inFaceNode = aNodes[ i-1 ]; - } - } + for ( int i = 0; i < 8 && !inFaceNode; ++i ) + if ( aNodes[ i ]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE ) + inFaceNode = aNodes[ i ]; // find middle point for (0,1,2,3) // and create a node in this point; gp_XYZ p( 0,0,0 ); if ( surface.IsNull() ) { - for(i=0; i<4; i++) - p += gp_XYZ(aNodes[i]->X(), aNodes[i]->Y(), aNodes[i]->Z() ); + for ( int i = 0; i < 4; i++ ) p += SMESH_TNodeXYZ( aNodes[i] ); p /= 4; } else { TopoDS_Face geomFace = TopoDS::Face( helper.GetSubShape() ); gp_XY uv( 0,0 ); - for(i=0; i<4; i++) + for ( int i = 0; i < 4; i++ ) uv += helper.GetNodeUV( geomFace, aNodes[i], inFaceNode ); uv /= 4.; p = surface->Value( uv.X(), uv.Y() ).XYZ();