mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-24 10:40:32 +05:00
#20232 EDF 22208 - Add a crack in a pipe
This commit is contained in:
parent
d311ab479f
commit
d76c0e6e5e
@ -200,20 +200,35 @@ namespace // INTERNAL STUFF
|
|||||||
if ( getBox()->IsOut( point ))
|
if ( getBox()->IsOut( point ))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
bool ok = false;
|
||||||
|
double dist2, param;
|
||||||
|
distance2 = Precision::Infinite();
|
||||||
|
|
||||||
if ( isLeaf() )
|
if ( isLeaf() )
|
||||||
{
|
{
|
||||||
for ( size_t i = 0; i < _segments.size(); ++i )
|
for ( size_t i = 0; i < _segments.size(); ++i )
|
||||||
if ( !_segments[i].IsOut( point ) &&
|
if ( !_segments[i].IsOut( point ) &&
|
||||||
_segments[i].IsOn( point, distance2, u ))
|
_segments[i].IsOn( point, dist2, param ) &&
|
||||||
return true;
|
dist2 < distance2 )
|
||||||
|
{
|
||||||
|
distance2 = dist2;
|
||||||
|
u = param;
|
||||||
|
ok = true;
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
if (((CurveProjector*) myChildren[i])->IsOnCurve( point, distance2, u ))
|
if (((CurveProjector*) myChildren[i])->IsOnCurve( point, dist2, param ) &&
|
||||||
return true;
|
dist2 < distance2 )
|
||||||
|
{
|
||||||
|
distance2 = dist2;
|
||||||
|
u = param;
|
||||||
|
ok = true;
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -233,13 +248,13 @@ namespace // INTERNAL STUFF
|
|||||||
_pLast = pl;
|
_pLast = pl;
|
||||||
_curve = curve;
|
_curve = curve;
|
||||||
_length2 = pf.SquareDistance( pl );
|
_length2 = pf.SquareDistance( pl );
|
||||||
|
_line.SetLocation( pf );
|
||||||
|
_line.SetDirection( gp_Vec( pf, pl ));
|
||||||
_chord2 = Max( _line. SquareDistance( curve->Value( uf + 0.25 * ( ul - uf ))),
|
_chord2 = Max( _line. SquareDistance( curve->Value( uf + 0.25 * ( ul - uf ))),
|
||||||
Max( _line.SquareDistance( curve->Value( uf + 0.5 * ( ul - uf ))),
|
Max( _line.SquareDistance( curve->Value( uf + 0.5 * ( ul - uf ))),
|
||||||
_line.SquareDistance( curve->Value( uf + 0.75 * ( ul - uf )))));
|
_line.SquareDistance( curve->Value( uf + 0.75 * ( ul - uf )))));
|
||||||
_chord2 = Max( tol, _chord2 );
|
_chord2 = Max( tol, _chord2 );
|
||||||
_chord = Sqrt( _chord2 );
|
_chord = Sqrt( _chord2 );
|
||||||
_line.SetLocation( pf );
|
|
||||||
_line.SetDirection( gp_Vec( pf, pl ));
|
|
||||||
|
|
||||||
Bnd_Box bb;
|
Bnd_Box bb;
|
||||||
BndLib_Add3dCurve::Add( GeomAdaptor_Curve( curve, uf, ul ), tol, bb );
|
BndLib_Add3dCurve::Add( GeomAdaptor_Curve( curve, uf, ul ), tol, bb );
|
||||||
@ -268,12 +283,12 @@ namespace // INTERNAL STUFF
|
|||||||
gp_Vec edge( _pFirst, _pLast );
|
gp_Vec edge( _pFirst, _pLast );
|
||||||
gp_Vec n1p ( _pFirst, point );
|
gp_Vec n1p ( _pFirst, point );
|
||||||
u = ( edge * n1p ) / _length2; // param [0,1] on the edge
|
u = ( edge * n1p ) / _length2; // param [0,1] on the edge
|
||||||
if ( u < 0 )
|
if ( u < 0. )
|
||||||
{
|
{
|
||||||
if ( _pFirst.SquareDistance( point ) > _chord2 )
|
if ( _pFirst.SquareDistance( point ) > _chord2 )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if ( u > _chord )
|
else if ( u > 1. )
|
||||||
{
|
{
|
||||||
if ( _pLast.SquareDistance( point ) > _chord2 )
|
if ( _pLast.SquareDistance( point ) > _chord2 )
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user