SMESHDS_Mesh* meshDS = theMesh->GetMeshDS();
vector<double> len( nbEdges );
+ int nbDegen = 0;
list<TopoDS_Edge>::iterator edge = theEdges.begin();
for ( int index = 0; edge != theEdges.end(); ++index, ++edge )
{
int i = theIsForward ? index : nbEdges - index - 1;
len[i] = SMESH_Algo::EdgeLength( *edge );
+ if ( len[i] < DBL_MIN ) nbDegen++;
myLength += len[i];
myEdge[i] = *edge;
if ( !theIsForward ) myEdge[i].Reverse();
myMissingVertexNodes = true;
if ( nbEdges > 1 && myLength > DBL_MIN ) {
+ const double degenNormLen = 1.e-5;
+ double totLength = myLength;
+ if ( nbDegen )
+ totLength += myLength * degenNormLen * nbDegen;
+ double prevNormPar = 0;
for ( int i = 0; i < nbEdges; ++i ) {
- myNormPar[ i ] = len[i]/myLength;
- if ( i > 0 )
- myNormPar[ i ] += myNormPar[ i-1 ];
+ if ( len[ i ] < DBL_MIN )
+ len[ i ] = myLength * degenNormLen;
+ myNormPar[ i ] = prevNormPar + len[i]/totLength;
+ prevNormPar = myNormPar[ i ];
}
}
myNormPar[nbEdges-1] = 1.;
//dump();
}
-//================================================================================
-/*!
- * \brief First curve parameter
- * \retval double - parameter value
- */
-//================================================================================
-
-// double StdMeshers_FaceSide::First() const
-// {
-// return 0;
-// }
-// //================================================================================
-// /*!
-// * \brief Last curve parameter
-// * \retval double - parameter value
-// */
-// //================================================================================
-
-// double StdMeshers_FaceSide::Last() const
-// {
-// return 1;
-// }
-
-// //================================================================================
-// /*!
-// * \brief
-// * \retval bool -
-// */
-// //================================================================================
-
-// bool StdMeshers_FaceSide::IsForward() const
-// {
-// return myIsForward;
-// }
//================================================================================
/*!
// sort nodes of all edges putting them into a map
map< double, const SMDS_MeshNode*> u2node;
+ //int nbOnDegen = 0;
for ( int i = 0; i < myEdge.size(); ++i )
{
// put 1st vertex node
}
}
if ( u2node.size() != myNbPonits ) {
- MESSAGE("Wrong node parameters on edges");
+ MESSAGE("Wrong node parameters on edges, u2node.size():"
+ <<u2node.size()<<" != myNbPonits:"<<myNbPonits);
return myPoints;
}
#endif
paramSize = myNormPar[ EdgeIndex ] - prevNormPar;
}
- double r = ( uvPt.normParam - prevNormPar )/ paramSize;
- uvPt.param = myFirst[EdgeIndex] * ( 1 - r ) + myLast[EdgeIndex] * r;
+ const SMDS_EdgePosition* epos =
+ dynamic_cast<const SMDS_EdgePosition*>(uvPt.node->GetPosition().get());
+ if ( epos ) {
+ uvPt.param = epos->GetUParameter();
+ }
+ else {
+ double r = ( uvPt.normParam - prevNormPar )/ paramSize;
+ uvPt.param = myFirst[EdgeIndex] * ( 1 - r ) + myLast[EdgeIndex] * r;
+ }
if ( !myC2d[ EdgeIndex ].IsNull() ) {
gp_Pnt2d p = myC2d[ EdgeIndex ]->Value( uvPt.param );
uvPt.u = p.X();
// correspondence mefisto index --> Nodes
vector< const SMDS_MeshNode*> mefistoToDS(nbpnt, (const SMDS_MeshNode*)0);
- // fill input points UV
- LoadPoints(wires, uvslf, mefistoToDS, scalex, scaley);
-
- // Compute
- aptrte(nutysu, aretmx,
- nblf, nudslf, uvslf, nbpti, uvpti, nbst, uvst, nbt, nust, ierr);
-
bool isOk = false;
- if (ierr == 0)
- {
- MESSAGE("... End Triangulation Generated Triangle Number " << nbt);
- MESSAGE(" Node Number " << nbst);
- StoreResult(nbst, uvst, nbt, nust, mefistoToDS, scalex, scaley);
- isOk = true;
- }
- else
+
+ // fill input points UV
+ if ( LoadPoints(wires, uvslf, mefistoToDS, scalex, scaley) )
{
- MESSAGE("Error in Triangulation");
+ // Compute
+ aptrte(nutysu, aretmx,
+ nblf, nudslf, uvslf, nbpti, uvpti, nbst, uvst, nbt, nust, ierr);
+
+ if (ierr == 0)
+ {
+ MESSAGE("... End Triangulation Generated Triangle Number " << nbt);
+ MESSAGE(" Node Number " << nbst);
+ StoreResult(nbst, uvst, nbt, nust, mefistoToDS, scalex, scaley);
+ isOk = true;
+ }
+ else
+ {
+ MESSAGE("Error in Triangulation");
+ }
}
if (nudslf != NULL) delete[]nudslf;
if (uvslf != NULL) delete[]uvslf;
for ( int iW = 0; iW < wires.size(); ++iW )
{
const vector<UVPtStruct>& uvPtVec = wires[ iW ]->GetUVPtStruct(isXConst,constValue);
+ if ( uvPtVec.size() != wires[ iW ]->NbPoints() ) {
+ MESSAGE("Wrong nb UVPtStruct: "<<uvPtVec.size()<<" != "<<wires[ iW ]->NbPoints());
+ return false;
+ }
vector<UVPtStruct>::const_iterator uvPt = uvPtVec.begin();
for ( ++uvPt; uvPt != uvPtVec.end(); ++uvPt )
}
FaceQuadStruct* quad = new FaceQuadStruct;
quad->uv_grid = 0;
+ for ( int i = 0; i < NB_SIDES; ++i )
+ quad->side[i] = 0;
int nbSides = 0;
list< TopoDS_Edge >::iterator edgeIt = edges.begin();
- if ( nbEdgesInWire.front() == 4 ) {
+ if ( nbEdgesInWire.front() == 4 ) { // exactly 4 edges
for ( ; edgeIt != edges.end(); ++edgeIt, nbSides++ )
quad->side[nbSides] = new StdMeshers_FaceSide(F,*edgeIt,&aMesh,nbSides<TOP_SIDE);
}
- else {
+ else if ( nbEdgesInWire.front() > 4 ) { // more than 4 edges - try to unite
list< TopoDS_Edge > sideEdges;
while ( edgeIt != edges.end()) {
sideEdges.clear();
}
}
if (nbSides != 4) {
- INFOS("face must have 4 edges /quadrangles");
+ INFOS("face must have 4 edges / quadrangle");
delete quad;
quad = 0;
}