mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0026151: Wrong result obtained by intersection algorithm.
1. Methods IntPolyh_MaillageAffinage::GetMinDeflection() and IntPolyh_MaillageAffinage::GetMaxDeflection() have been created (see cdl-file for more detail information). 2. Extended check, if starting point of WLine is a tangent point, has been implemented in IntWalk_PWalking::Perform(...) method. Test cases for issue CR26151
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
|
||||
#include <Extrema_GenLocateExtPS.hxx>
|
||||
|
||||
//==================================================================================
|
||||
// function : IntWalk_PWalking::IntWalk_PWalking
|
||||
// purpose :
|
||||
@@ -391,7 +393,7 @@ done(Standard_True),
|
||||
close(Standard_False),
|
||||
fleche(Deflection),
|
||||
tolconf(Epsilon),
|
||||
sensCheminement(1),
|
||||
sensCheminement(1),
|
||||
myIntersectionOn2S(Caro1,Caro2,TolTangency),
|
||||
STATIC_BLOCAGE_SUR_PAS_TROP_GRAND(0),
|
||||
STATIC_PRECEDENT_INFLEXION(0)
|
||||
@@ -575,6 +577,94 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep)
|
||||
{
|
||||
Perform(ParDep,Um1,Vm1,Um2,Vm2,UM1,VM1,UM2,VM2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SQDistPointSurface
|
||||
//purpose : Returns square distance between thePnt and theSurf.
|
||||
// (theU0, theV0) is initial point for extrema
|
||||
//=======================================================================
|
||||
static Standard_Real SQDistPointSurface(const gp_Pnt &thePnt,
|
||||
const Adaptor3d_Surface& theSurf,
|
||||
const Standard_Real theU0,
|
||||
const Standard_Real theV0)
|
||||
{
|
||||
const Extrema_GenLocateExtPS aExtPS(thePnt, theSurf, theU0, theV0,
|
||||
Precision::PConfusion(), Precision::PConfusion());
|
||||
if(!aExtPS.IsDone())
|
||||
return RealLast();
|
||||
|
||||
return aExtPS.SquareDistance();
|
||||
}
|
||||
|
||||
//==================================================================================
|
||||
// function : IsTangentExtCheck
|
||||
// purpose : Additional check if the surfaces are tangent.
|
||||
// Checks if any point in one surface lie in another surface
|
||||
// (with given tolerance)
|
||||
//==================================================================================
|
||||
static Standard_Boolean IsTangentExtCheck(const Handle(Adaptor3d_HSurface)& theSurf1,
|
||||
const Handle(Adaptor3d_HSurface)& theSurf2,
|
||||
const Standard_Real theU10,
|
||||
const Standard_Real theV10,
|
||||
const Standard_Real theU20,
|
||||
const Standard_Real theV20,
|
||||
const Standard_Real theArrStep[])
|
||||
{
|
||||
{
|
||||
gp_Pnt aPt;
|
||||
gp_Vec aDu1, aDv1, aDu2, aDv2;
|
||||
theSurf1->D1(theU10, theV10, aPt, aDu1, aDv1);
|
||||
theSurf2->D1(theU20, theV20, aPt, aDu2, aDv2);
|
||||
|
||||
const gp_Vec aN1(aDu1.Crossed(aDv1)),
|
||||
aN2(aDu2.Crossed(aDv2));
|
||||
const Standard_Real aDP = aN1.Dot(aN2),
|
||||
aSQ1 = aN1.SquareMagnitude(),
|
||||
aSQ2 = aN2.SquareMagnitude();
|
||||
|
||||
if((aSQ1 < RealSmall()) || (aSQ2 < RealSmall()))
|
||||
return Standard_True; //Tangent
|
||||
|
||||
if(aDP*aDP < 0.9998*aSQ1*aSQ2)
|
||||
{//cos(ang N1<->N2) < 0.9999
|
||||
return Standard_False; //Not tangent
|
||||
}
|
||||
}
|
||||
|
||||
const Standard_Real aSQToler = 4.0e-14;
|
||||
const Standard_Integer aNbItems = 4;
|
||||
const Standard_Real aParUS1[aNbItems] = { theU10 + theArrStep[0],
|
||||
theU10 - theArrStep[0],
|
||||
theU10, theU10};
|
||||
const Standard_Real aParVS1[aNbItems] = { theV10, theV10,
|
||||
theV10 + theArrStep[1],
|
||||
theV10 - theArrStep[1]};
|
||||
const Standard_Real aParUS2[aNbItems] = { theU20 + theArrStep[2],
|
||||
theU20 - theArrStep[2],
|
||||
theU20, theU20};
|
||||
const Standard_Real aParVS2[aNbItems] = { theV20, theV20,
|
||||
theV20 + theArrStep[3],
|
||||
theV20 - theArrStep[3]};
|
||||
|
||||
for(Standard_Integer i = 0; i < aNbItems; i++)
|
||||
{
|
||||
gp_Pnt aP(theSurf1->Value(aParUS1[i], aParVS1[i]));
|
||||
const Standard_Real aSqDist = SQDistPointSurface(aP, theSurf2->Surface(), theU20, theV20);
|
||||
if(aSqDist > aSQToler)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
for(Standard_Integer i = 0; i < aNbItems; i++)
|
||||
{
|
||||
gp_Pnt aP(theSurf2->Value(aParUS2[i], aParVS2[i]));
|
||||
const Standard_Real aSqDist = SQDistPointSurface(aP, theSurf1->Surface(), theU10, theV10);
|
||||
if(aSqDist > aSQToler)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//==================================================================================
|
||||
// function : Perform
|
||||
// purpose :
|
||||
@@ -701,6 +791,10 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
|
||||
Standard_Boolean bTestFirstPoint = Standard_True;
|
||||
|
||||
previousPoint.Parameters(Param(1),Param(2),Param(3),Param(4));
|
||||
|
||||
if(IsTangentExtCheck(Caro1, Caro2, Param(1), Param(2), Param(3), Param(4), pasuv))
|
||||
return;
|
||||
|
||||
AddAPoint(line,previousPoint);
|
||||
//
|
||||
IntWalk_StatusDeflection Status = IntWalk_OK;
|
||||
|
Reference in New Issue
Block a user