mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0024418: Modeling Algorithms - Wrong section curves when intersecting analytical surfaces
IntPatch_ALineToWLine.cxx - setting minimal number of points in a WLine depending on step size IntPatch_WLineTool.cxx - fix WLines connecting check condition test cases has been changed according to new behavior
This commit is contained in:
@@ -433,10 +433,32 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
if(aStep < Epsilon(theLPar))
|
||||
break;
|
||||
|
||||
Standard_Boolean isStepReduced = Standard_False;
|
||||
Standard_Real aLPar = theLPar;
|
||||
|
||||
for (Standard_Integer i = aVertexParams.Lower(); i <= aVertexParams.Upper(); i++)
|
||||
{
|
||||
if (hasVertexBeenChecked(i))
|
||||
continue;
|
||||
|
||||
aLPar = aVertexParams(i);
|
||||
if (Abs(aLPar - aParameter) < aPrmTol)
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ((aStep - (aLPar - aParameter) > aPrmTol) &&
|
||||
(Abs(aLPar - aParameter) > aPrmTol))
|
||||
{
|
||||
aStep = Max((aLPar - aParameter) / 5, 1.e-5);
|
||||
isStepReduced = Standard_True;
|
||||
}
|
||||
|
||||
Standard_Integer aNewVertID = 0;
|
||||
aLinOn2S = new IntSurf_LineOn2S;
|
||||
|
||||
const Standard_Real aStepMin = 0.1*aStep, aStepMax = 10.0*aStep;
|
||||
Standard_Real aStepMin = 0.1 * aStep, aStepMax = 10.0 * aStep;
|
||||
|
||||
Standard_Boolean isLast = Standard_False;
|
||||
Standard_Real aPrevParam = aParameter;
|
||||
@@ -586,8 +608,12 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
{
|
||||
if (isPointValid)
|
||||
{
|
||||
StepComputing(theALine, aPOn2S, theLPar, aParameter, aTgMagn,
|
||||
aStepMin, aStepMax, myTol3D, aStep);
|
||||
if (!isStepReduced)
|
||||
{
|
||||
StepComputing(theALine, aPOn2S, theLPar, aParameter, aTgMagn,
|
||||
aStepMin, aStepMax, myTol3D, aStep);
|
||||
}
|
||||
|
||||
AddPointIntoLine(aLinOn2S, anArrPeriods, aPOn2S);
|
||||
aPrevLPoint = aPOn2S;
|
||||
}
|
||||
@@ -694,6 +720,38 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
|
||||
if ((aPrePointExist != IntPatch_SPntNone) && (aLinOn2S->NbPoints() > 1))
|
||||
break;
|
||||
|
||||
if (isStepReduced)
|
||||
{
|
||||
isStepReduced = Standard_False;
|
||||
|
||||
aStep = (theLPar - aParameter) / (Standard_Real)(myNbPointsInWline - 1);
|
||||
if(aStep < Epsilon(theLPar))
|
||||
break;
|
||||
|
||||
aLPar = aVertexParams(aNbVert);
|
||||
for (Standard_Integer i = aVertexParams.Lower(); i <= aVertexParams.Upper(); i++)
|
||||
{
|
||||
if (hasVertexBeenChecked(i))
|
||||
continue;
|
||||
|
||||
aLPar = aVertexParams(i);
|
||||
if (Abs(aLPar - aParameter) < aPrmTol)
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ((aStep - (aLPar - aParameter) > aPrmTol) &&
|
||||
(Abs(aLPar - aParameter) > aPrmTol))
|
||||
{
|
||||
aStep = Max((aLPar - aParameter) / 5, 1.e-5);
|
||||
isStepReduced = Standard_True;
|
||||
}
|
||||
|
||||
aStepMin = 0.1 * aStep;
|
||||
aStepMax = 10.0 * aStep;
|
||||
}
|
||||
}//for(; !isLast; aParameter += aStep)
|
||||
|
||||
if(aLinOn2S->NbPoints() < 2)
|
||||
|
@@ -1717,6 +1717,38 @@ void IntPatch_WLineTool::JoinWLines(IntPatch_SequenceOfLine& theSlin,
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsNeedSkipWL
|
||||
//purpose : Detect is WLine need to skip.
|
||||
//=======================================================================
|
||||
static Standard_Boolean IsNeedSkipWL(const Handle(IntPatch_WLine)& theWL,
|
||||
const Bnd_Box2d& theBoxS1,
|
||||
const Bnd_Box2d& theBoxS2,
|
||||
const Standard_Real* const theArrPeriods)
|
||||
{
|
||||
Standard_Real aFirstp, aLastp;
|
||||
Standard_Integer aNbVtx = theWL->NbVertex();
|
||||
Standard_Boolean isNeedSkip = Standard_True;
|
||||
|
||||
for (Standard_Integer i = 1; i < aNbVtx; i++) {
|
||||
aFirstp = theWL->Vertex (i).ParameterOnLine();
|
||||
aLastp = theWL->Vertex (i + 1).ParameterOnLine();
|
||||
|
||||
Standard_Real aU1, aV1, aU2, aV2;
|
||||
const Standard_Integer pmid = (Standard_Integer)((aFirstp + aLastp) / 2);
|
||||
const IntSurf_PntOn2S& aPmid = theWL->Point (pmid);
|
||||
aPmid.Parameters (aU1, aV1, aU2, aV2);
|
||||
|
||||
if (!IsOutOfDomain (theBoxS1, theBoxS2, aPmid, theArrPeriods))
|
||||
{
|
||||
isNeedSkip = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return isNeedSkip;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ExtendTwoWLines
|
||||
//purpose : Performs extending theWLine1 and theWLine2 through their
|
||||
@@ -1737,8 +1769,17 @@ void IntPatch_WLineTool::
|
||||
|
||||
gp_Vec aVec1, aVec2, aVec3;
|
||||
|
||||
unsigned int hasBeenJoinedCounter = 0;
|
||||
|
||||
for(Standard_Integer aNumOfLine1 = 1; aNumOfLine1 <= theSlin.Length(); aNumOfLine1++)
|
||||
{
|
||||
if (hasBeenJoinedCounter > 0)
|
||||
{
|
||||
aNumOfLine1--;
|
||||
}
|
||||
|
||||
hasBeenJoinedCounter = 0;
|
||||
|
||||
Handle(IntPatch_WLine) aWLine1 (Handle(IntPatch_WLine)::
|
||||
DownCast(theSlin.Value(aNumOfLine1)));
|
||||
|
||||
@@ -1761,6 +1802,11 @@ void IntPatch_WLineTool::
|
||||
const IntSurf_PntOn2S& aPntLWL1 = aWLine1->Point(aNbPntsWL1);
|
||||
const IntSurf_PntOn2S& aPntLm1WL1 = aWLine1->Point(aNbPntsWL1-1);
|
||||
|
||||
if (IsNeedSkipWL(aWLine1, theBoxS1, theBoxS2, theArrPeriods))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//Enable/Disable of some ckeck. Bit-mask is used for it.
|
||||
//E.g. if 1st point of aWLine1 matches with
|
||||
//1st point of aWLine2 then we do not need in check
|
||||
@@ -1781,16 +1827,24 @@ void IntPatch_WLineTool::
|
||||
const IntSurf_PntOn2S& aPntFWL2 = aWLine2->Point(1);
|
||||
const IntSurf_PntOn2S& aPntLWL2 = aWLine2->Point(aWLine2->NbPnts());
|
||||
|
||||
if( aPntFWL1.IsSame(aPntFWL2, theToler3D) ||
|
||||
aPntFWL1.IsSame(aPntLWL2, theToler3D) )
|
||||
if (!(aPntFWL1.IsSame(aPntFWL2, theToler3D, Precision::PConfusion())) &&
|
||||
!(aPntFWL1.IsSame(aPntLWL2, theToler3D, Precision::PConfusion())))
|
||||
{
|
||||
aCheckResult |= IntPatchWT_DisFirstFirst | IntPatchWT_DisFirstLast;
|
||||
if (aPntFWL1.IsSame(aPntFWL2, theToler3D) ||
|
||||
aPntFWL1.IsSame(aPntLWL2, theToler3D))
|
||||
{
|
||||
aCheckResult |= IntPatchWT_DisFirstFirst | IntPatchWT_DisFirstLast;
|
||||
}
|
||||
}
|
||||
|
||||
if( aPntLWL1.IsSame(aPntFWL2, theToler3D) ||
|
||||
aPntLWL1.IsSame(aPntFWL2, theToler3D))
|
||||
if (!(aPntLWL1.IsSame(aPntFWL2, theToler3D, Precision::PConfusion())) &&
|
||||
!(aPntLWL1.IsSame(aPntLWL2, theToler3D, Precision::PConfusion())))
|
||||
{
|
||||
aCheckResult |= IntPatchWT_DisLastFirst | IntPatchWT_DisLastLast;
|
||||
if (aPntLWL1.IsSame(aPntFWL2, theToler3D) ||
|
||||
aPntLWL1.IsSame(aPntLWL2, theToler3D))
|
||||
{
|
||||
aCheckResult |= IntPatchWT_DisLastFirst | IntPatchWT_DisLastLast;
|
||||
}
|
||||
}
|
||||
|
||||
if (!theListOfCriticalPoints.IsEmpty())
|
||||
@@ -1862,8 +1916,13 @@ void IntPatch_WLineTool::
|
||||
|
||||
const IntSurf_PntOn2S& aPntLWL2 = aWLine2->Point(aNbPntsWL2);
|
||||
const IntSurf_PntOn2S& aPntLm1WL2 = aWLine2->Point(aNbPntsWL2-1);
|
||||
|
||||
//if(!(aCheckResult & IntPatchWT_DisFirstFirst))
|
||||
|
||||
if (IsNeedSkipWL(aWLine2, theBoxS1, theBoxS2, theArrPeriods))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!(aCheckResult & IntPatchWT_DisFirstFirst))
|
||||
{// First/First
|
||||
aVec1.SetXYZ(aPntFp1WL1.Value().XYZ() - aPntFWL1.Value().XYZ());
|
||||
aVec2.SetXYZ(aPntFWL2.Value().XYZ() - aPntFp1WL2.Value().XYZ());
|
||||
@@ -1909,6 +1968,7 @@ void IntPatch_WLineTool::
|
||||
|
||||
if(hasBeenJoined)
|
||||
{
|
||||
hasBeenJoinedCounter++;
|
||||
theSlin.Remove(aNumOfLine2);
|
||||
aNumOfLine2--;
|
||||
}
|
||||
|
Reference in New Issue
Block a user