vector< const SMDS_MeshNode*>&mefistoToDS,
double scalex, double scaley)
{
- SMESHDS_Mesh * meshDS = _helper->GetMeshDS();
- int faceID = _helper->GetSubShapeID();
+ _helper->SetElementsOnShape( true );
TopoDS_Face F = TopoDS::Face( _helper->GetSubShape() );
Handle(Geom_Surface) S = BRep_Tool::Surface( F );
double v = uvst[n][1] / scaley;
gp_Pnt P = S->Value(u, v);
- SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
- meshDS->SetNodeOnFace(node, faceID, u, v);
-
- //MESSAGE(P.X()<<" "<<P.Y()<<" "<<P.Z());
- mefistoToDS[n] = node;
- //MESSAGE("NEW: "<<n<<" "<<mefistoToDS[n+1]);
+ mefistoToDS[n] = _helper->AddNode( P.X(), P.Y(), P.Z(), 0, u, v );
}
}
// triangle points must be in trigonometric order if face is Forward
// else they must be put clockwise
- bool triangleIsWellOriented = ( F.Orientation() == TopAbs_FORWARD );
+ int i1 = 1, i2 = 2;
+ if ( F.Orientation() != TopAbs_FORWARD )
+ std::swap( i1, i2 );
+ const SMDS_MeshNode * nn[3];
for (n = 1; n <= nbt; n++)
{
- const SMDS_MeshNode * n1 = mefistoToDS[ nust[m++] - 1 ];
- const SMDS_MeshNode * n2 = mefistoToDS[ nust[m++] - 1 ];
- const SMDS_MeshNode * n3 = mefistoToDS[ nust[m++] - 1 ];
+ nn[ 0 ] = mefistoToDS[ nust[m++] - 1 ];
+ nn[ 1 ] = mefistoToDS[ nust[m++] - 1 ];
+ nn[ 2 ] = mefistoToDS[ nust[m++] - 1 ];
+ m++;
// avoid creating degenetrated faces
- bool isDegen = ( _helper->HasDegeneratedEdges() && ( n1 == n2 || n1 == n3 || n2 == n3 ));
+ bool isDegen = ( _helper->HasDegeneratedEdges() &&
+ ( nn[0] == nn[1] || nn[1] == nn[2] || nn[2] == nn[0] ));
if ( !isDegen )
- {
- SMDS_MeshElement * elt;
- if (triangleIsWellOriented)
- elt = _helper->AddFace(n1, n2, n3);
- else
- elt = _helper->AddFace(n1, n3, n2);
- meshDS->SetMeshElementOnShape(elt, faceID);
- }
- m++;
+ _helper->AddFace( nn[0], nn[i1], nn[i2] );
}
// remove bad elements built on vertices shared by wires
nbSame++;
if (nbSame > 1) {
MESSAGE( "RM bad element " << elem->GetID());
- meshDS->RemoveElement( elem );
+ _helper->GetMeshDS()->RemoveElement( elem );
}
}
}