1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0021564: Intersection of two planar faces produces curve with too many poles

I ComputePurgedWLine() function:
Excess points in walking line are deleted when:
1) Distance between neighboring points too small.
2) Points lie in one pipe without big jump on chord length.

III
Fixed problem with extremaPC with too close knot distribution to [minParam, maxParam] borders.

IV ApproxInt_Approx.gxx
New division criteria in intersection approximator.

III Test case
Test cases update to the new behavior.
Test case for CR21564

Correction of test cases for issue CR21564
This commit is contained in:
aml
2015-08-13 11:04:03 +03:00
committed by ski
parent 7a324550c8
commit 0cbfb9f151
24 changed files with 481 additions and 99 deletions

View File

@@ -332,13 +332,16 @@ void ApproxInt_Approx::Perform(const Handle(TheWLine)& theline,
nbmc++) {
myBezToBSpl.Append(myComputeLineBezier.Value(nbmc));
}
if(imax<indicemax) {
imin = imax;
imax = imin+nbpntbez;
OtherInter = Standard_True;
if((indicemax-imax)<(nbpntbez/2)) {
imax = indicemax;
}
if(imax<indicemax)
{
imin = imax;
imax = imin+nbpntbez;
OtherInter = Standard_True;
if((indicemax-imax)<(nbpntbez/2))
{
imax = indicemax;
}
imax = CorrectFinishIdx(imin, imax, theline);
}
}
}
@@ -567,14 +570,17 @@ void ApproxInt_Approx::Perform(const ThePSurface& Surf1,
nbmc++) {
myBezToBSpl.Append(myComputeLineBezier.Value(nbmc));
}
if(imax<indicemax) {
imin = imax;
imax = imin+nbpntbez;
OtherInter = Standard_True;
if((indicemax-imax)<(nbpntbez/2)) {
imax = indicemax;
}
}
if(imax<indicemax)
{
imin = imax;
imax = imin+nbpntbez;
OtherInter = Standard_True;
if((indicemax-imax)<(nbpntbez/2))
{
imax = indicemax;
}
imax = CorrectFinishIdx(imin, imax, theline);
}
}
}
while(OtherInter);
@@ -903,13 +909,16 @@ void ApproxInt_Approx::Perform(const ThePSurface& PSurf,
nbmc++) {
myBezToBSpl.Append(myComputeLineBezier.Value(nbmc));
}
if(imax<indicemax) {
imin = imax;
imax = imin+nbpntbez;
OtherInter = Standard_True;
if((indicemax-imax)<(nbpntbez/2)) {
imax = indicemax;
}
if(imax<indicemax)
{
imin = imax;
imax = imin+nbpntbez;
OtherInter = Standard_True;
if((indicemax-imax)<(nbpntbez/2))
{
imax = indicemax;
}
imax = CorrectFinishIdx(imin, imax, theline);
}
}
}
@@ -1117,21 +1126,26 @@ void ApproxInt_Approx::Perform(const TheISurface& ISurf,
}
}
OtherInter = Standard_False;
if(myApproxBez) {
for(Standard_Integer nbmc = 1;
nbmc <= myComputeLineBezier.NbMultiCurves() ;
nbmc++) {
myBezToBSpl.Append(myComputeLineBezier.Value(nbmc));
if(myApproxBez)
{
for(Standard_Integer nbmc = 1;
nbmc <= myComputeLineBezier.NbMultiCurves() ;
nbmc++)
{
myBezToBSpl.Append(myComputeLineBezier.Value(nbmc));
}
if(imax<indicemax) {
imin = imax;
imax = imin+nbpntbez;
OtherInter = Standard_True;
if((indicemax-imax)<(nbpntbez/2)) {
imax = indicemax;
}
if(imax<indicemax)
{
imin = imax;
imax = imin+nbpntbez;
OtherInter = Standard_True;
if((indicemax-imax)<(nbpntbez/2))
{
imax = indicemax;
}
imax = CorrectFinishIdx(imin, imax, theline);
}
}
}
}
while(OtherInter);
if(myApproxBez) {
@@ -1208,3 +1222,31 @@ const AppParCurves_MultiBSpCurve& ApproxInt_Approx::Value(const Standard_Integer
return(myComputeLine.Value());
}
}
//--------------------------------------------------------------------------------
Standard_Integer ApproxInt_Approx::CorrectFinishIdx(const Standard_Integer theMinIdx,
const Standard_Integer theMaxIdx,
const Handle(TheWLine)& theline)
{
const Standard_Real aNullCoeff = 1.0e-16;
Standard_Real aLimitMaxCoeff = 1.0 / 2500.0;
Standard_Real aDist = theline->Point(theMinIdx).Value().SquareDistance(
theline->Point(theMinIdx + 1).Value());
for(Standard_Integer anIdx = theMinIdx + 1; anIdx < theMaxIdx - 1; anIdx++)
{
Standard_Real aNextDist = theline->Point(anIdx).Value().SquareDistance(
theline->Point(anIdx + 1).Value());
Standard_Real aCoeff = Min (aNextDist, aDist) / Max (aNextDist, aDist);
//
if (aCoeff < aLimitMaxCoeff && // Base criteria.
aNextDist > aDist && // Step increasing.
aNextDist > aNullCoeff && // Avoid separation in case of too small step.
aDist > aNullCoeff) // Usually found when purger not invoked (blend).
{
return anIdx;
}
aDist = aNextDist;
}
return theMaxIdx;
}