//================================================================================
TopoDS_Edge makeEdgeFromMA( SMESH_MesherHelper& theHelper,
- const SMESH_MAT2d::MedialAxis& theMA )
+ const SMESH_MAT2d::MedialAxis& theMA,
+ const double theMinSegLen)
{
if ( theMA.nbBranches() != 1 )
return TopoDS_Edge();
TopoDS_Face face = TopoDS::Face( theHelper.GetSubShape() );
Handle(Geom_Surface) surface = BRep_Tool::Surface( face );
+ vector< gp_Pnt > pnt;
+ pnt.reserve( uv.size() * 2 );
+ pnt.push_back( surface->Value( uv[0].X(), uv[0].Y() ));
+ for ( size_t i = 1; i < uv.size(); ++i )
+ {
+ gp_Pnt p = surface->Value( uv[i].X(), uv[i].Y() );
+ int nbDiv = int( p.Distance( pnt.back() ) / theMinSegLen );
+ for ( int iD = 1; iD < nbDiv; ++iD )
+ {
+ double R = iD / double( nbDiv );
+ gp_XY uvR = uv[i-1] * (1 - R) + uv[i] * R;
+ pnt.push_back( surface->Value( uvR.X(), uvR.Y() ));
+ }
+ pnt.push_back( p );
+ }
+
// cout << "from salome.geom import geomBuilder" << endl;
// cout << "geompy = geomBuilder.New(salome.myStudy)" << endl;
- Handle(TColgp_HArray1OfPnt) points = new TColgp_HArray1OfPnt(1, uv.size());
- for ( size_t i = 0; i < uv.size(); ++i )
+ Handle(TColgp_HArray1OfPnt) points = new TColgp_HArray1OfPnt(1, pnt.size());
+ for ( size_t i = 0; i < pnt.size(); ++i )
{
- gp_Pnt p = surface->Value( uv[i].X(), uv[i].Y() );
+ gp_Pnt& p = pnt[i];
points->SetValue( i+1, p );
- //cout << "geompy.MakeVertex( "<< p.X()<<", " << p.Y()<<", " << p.Z()<<" )" << endl;
+ // cout << "geompy.MakeVertex( "<< p.X()<<", " << p.Y()<<", " << p.Z()
+ // <<" theName = 'p_" << i << "')" << endl;
}
GeomAPI_Interpolate interpol( points, /*isClosed=*/false, gp::Resolution());
const SMESH_MAT2d::MedialAxis& theMA,
const SinuousFace& theSinuFace,
SMESH_Algo* the1dAlgo,
+ const double theMinSegLen,
vector<double>& theMAParams )
{
// check if all EDGEs of one size are meshed, then MA discretization is not needed
return true; // discretization is not needed
- TopoDS_Edge branchEdge = makeEdgeFromMA( theHelper, theMA );
+ TopoDS_Edge branchEdge = makeEdgeFromMA( theHelper, theMA, theMinSegLen );
if ( branchEdge.IsNull() )
return false;
_regular1D->SetSegmentLength( minSegLen );
vector<double> maParams;
- if ( ! divideMA( helper, ma, sinuFace, _regular1D, maParams ))
+ if ( ! divideMA( helper, ma, sinuFace, _regular1D, minSegLen, maParams ))
return error(COMPERR_BAD_SHAPE);
_progress = 0.4;