1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

0025416: Wrong section curve

patch #25416 to OCCT 6.7.0
This commit is contained in:
nbv 2014-10-30 16:17:37 +03:00
parent 95ee0712bc
commit 86b52ffdea
8 changed files with 2816 additions and 1120 deletions

View File

@ -890,6 +890,76 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
wline->AddVertex(ptfin); wline->AddVertex(ptfin);
wline->SetLastPoint(wline->NbVertex()); wline->SetLastPoint(wline->NbVertex());
} }
if(wline->NbPnts() < 40)
{
Standard_Boolean hasBeenAdded = iwalk.SeekAdditionalPoints(Surf1, Surf2, 40, j);
if (!reversed)
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang, hasBeenAdded);
else
IntPatch_RstInt::PutVertexOnLine(wline,Surf2,D2,Surf1,Standard_False,TolTang, hasBeenAdded);
if(hasBeenAdded)
{
const Standard_Real aTol = Precision::Confusion()*Precision::Confusion();
Standard_Real aDecrParam = 0.0;
Standard_Integer aNbVert = wline->NbVertex();
for (Standard_Integer aV = 2; aV <= aNbVert; aV++)
{
IntPatch_Point aVert = wline->Vertex(aV);
const gp_Pnt aP(aVert.Value()), aP1(wline->Vertex(aV-1).Value());
if(aV == aNbVert)
{
if(aP.SquareDistance(aP1) <= aTol)
{
wline->RemoveVertex(aV-1);
}
break;
}
else
{
aVert.SetParameter(aVert.ParameterOnLine() - aDecrParam);
wline->RemoveVertex(aV);
wline->InsertVertexBefore(aV, aVert);
}
const gp_Pnt aP2(wline->Vertex(aV+1).Value());
if(aP.SquareDistance(aP1) <= aTol)
{
wline->RemoveVertex(aV);
}
else if(aP.SquareDistance(aP2) <= aTol)
{
wline->RemoveVertex(aV);
aDecrParam++;
aV--;
aNbVert = wline->NbVertex();
}
aNbVert = wline->NbVertex();
}
}
if (wline->HasLastPoint())
{
wline->SetLastPoint(wline->NbVertex());
wline->LastPoint(indlast);
}
}
else
{
if (!reversed)
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
else
IntPatch_RstInt::PutVertexOnLine(wline,Surf2,D2,Surf1,Standard_False,TolTang);
}
// //
// Il faut traiter les points de passage. // Il faut traiter les points de passage.
slin.Append(wline); slin.Append(wline);
@ -1252,10 +1322,18 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
// on traite les restrictions de la surface implicite // on traite les restrictions de la surface implicite
for (i=1; i<=slin.Length(); i++) for (i=1; i<=slin.Length(); i++)
{ {
Handle(IntPatch_Line)& aL = slin(i);
const Handle(IntPatch_WLine)& wline = Handle(IntPatch_WLine)::DownCast(aL);
if(!wline.IsNull())
{//It was processed above
continue;
}
if (!reversed) if (!reversed)
IntPatch_RstInt::PutVertexOnLine(slin(i),Surf1,D1,Surf2,Standard_True,TolTang); IntPatch_RstInt::PutVertexOnLine(aL,Surf1,D1,Surf2,Standard_True,TolTang, 1);
else else
IntPatch_RstInt::PutVertexOnLine(slin(i),Surf2,D2,Surf1,Standard_False,TolTang); IntPatch_RstInt::PutVertexOnLine(aL,Surf2,D2,Surf1,Standard_False,TolTang, 1);
} }
empt = (slin.Length() == 0 && spnt.Length() == 0); empt = (slin.Length() == 0 && spnt.Length() == 0);
done = Standard_True; done = Standard_True;

View File

@ -309,6 +309,18 @@ is
---C++: return const& ---C++: return const&
returns HCurve2d from Adaptor2d; returns HCurve2d from Adaptor2d;
ClearVertexes(me: mutable)
is static;
RemoveVertex(me: mutable;
theIndex : Integer from Standard)
is static;
InsertVertexBefore(me: mutable;
theIndex : Integer from Standard;
thePnt : Point from IntPatch)
is static;
Dump(me) Dump(me)
is static; is static;

View File

@ -622,7 +622,17 @@ void IntPatch_WLine::ComputeVertexParameters( const Standard_Real RTol,
RecadreMemePeriode(POn2S,curv->Value(nbponline),U1Period(),V1Period(),U2Period(),V2Period()); RecadreMemePeriode(POn2S,curv->Value(nbponline),U1Period(),V1Period(),U2Period(),V2Period());
curv->Add(POn2S); curv->Add(POn2S);
} }
else { else if(hasBeenAdded)
{
RecadreMemePeriode(POn2S,curv->Value(indicevertexonline+1),U1Period(),V1Period(),U2Period(),V2Period());
const IntSurf_PntOn2S aP2S1 = curv->Value(curv->NbPoints());
if(POn2S.Value().SquareDistance(aP2S1.Value()) > Precision::Confusion()*Precision::Confusion())
{
curv->InsertBefore(indicevertexonline+1,POn2S);
}
}
else
{
RecadreMemePeriode(POn2S,curv->Value(indicevertexonline+1),U1Period(),V1Period(),U2Period(),V2Period()); RecadreMemePeriode(POn2S,curv->Value(indicevertexonline+1),U1Period(),V1Period(),U2Period(),V2Period());
curv->InsertBefore(indicevertexonline+1,POn2S); curv->InsertBefore(indicevertexonline+1,POn2S);
} }

View File

@ -97,3 +97,27 @@ inline const IntPatch_Point& IntPatch_WLine::Vertex (const Standard_Integer Inde
{ {
return svtx(Index); return svtx(Index);
} }
inline void IntPatch_WLine::ClearVertexes()
{
svtx.Clear();
}
inline void IntPatch_WLine::RemoveVertex(const Standard_Integer theIndex)
{
if((theIndex < 1) || (theIndex > NbVertex()))
Standard_OutOfRange::Raise("Cannot delete not existing vertex");
svtx.Remove(theIndex);
}
inline void IntPatch_WLine::InsertVertexBefore( const Standard_Integer theIndex,
const IntPatch_Point& thePnt)
{
const Standard_Integer aNbVertexes = NbVertex();
Standard_Integer anIndex = Max(theIndex, 1);
if(anIndex > aNbVertexes)
svtx.Append(thePnt);
else
svtx.InsertBefore(theIndex, thePnt);
}

View File

@ -77,7 +77,7 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
{ {
Standard_Integer i,nbvtx; Standard_Integer i,nbvtx;
Standard_Real firstp,lastp; Standard_Real firstp,lastp;
const Standard_Real Tol = Precision::PConfusion() * 35.0; const Standard_Real Tol = 1.001e-6;//Precision::PConfusion() * 35.0;
const IntPatch_IType typl = L->ArcType(); const IntPatch_IType typl = L->ArcType();
if(typl == IntPatch_Analytic) { if(typl == IntPatch_Analytic) {

View File

@ -29,7 +29,7 @@ package IntWalk
-- All the methods of the classes of this package are Internal. -- All the methods of the classes of this package are Internal.
-- --
uses uses
Standard, MMgt, TCollection, TColStd, gp, math, StdFail, IntSurf, IntImp Standard, MMgt, TCollection, TColStd, gp, math, StdFail, IntSurf, IntImp, Adaptor3d, Bnd
is is

View File

@ -43,7 +43,9 @@ uses Vector from math,
VectorOfWalkingData from IntWalk, VectorOfWalkingData from IntWalk,
Vec from gp, Vec from gp,
Dir2d from gp, Dir2d from gp,
PntOn2S from IntSurf Pnt from gp,
PntOn2S from IntSurf,
Box2d from Bnd
raises NotDone from StdFail, raises NotDone from StdFail,
@ -270,6 +272,59 @@ is
Clear (me: in out) is static protected; Clear (me: in out) is static protected;
---Purpose: Clears up internal containers ---Purpose: Clears up internal containers
DistanceMinimizeByGradient (me: in out;
theASurf1 , theASurf2 : ThePSurface;
theU1, theV1, theU2, theV2: out Real from Standard;
theBox1, theBox2: Box2d from Bnd;
theStep0U1V1: Real from Standard = 1.0e-6;
theStep0U2V2: Real from Standard = 1.0e-6)
returns Boolean from Standard
is static protected;
---Purpose: Clears up internal containers
DistanceMinimizeByExtrema (me: in out;
theASurf : ThePSurface;
theP0 : Pnt from gp;
theU0, theV0: out Real from Standard;
theStep0U: Real from Standard = 1.0;
theStep0V: Real from Standard = 1.0)
returns Boolean from Standard
is static protected;
---Purpose: Clears up internal containers
SeekPointOnBoundary(me : in out;
theASurf1 , theASurf2 : ThePSurface ;
theU1, theV1, theU2, theV2: Real from Standard;
isTheFirst : Boolean from Standard;
theNCurve : Integer from Standard;
theExtendingType : Integer from Standard;
theParamTol : Real from Standard)
returns Boolean from Standard
is static protected;
-- Unites and correctly coordinates of work of
-- "DistanceMinimizeByGradient" and "DistanceMinimizeByExtrema" functions.
PutToBoundary(me : in out;
theASurf1 , theASurf2 : ThePSurface;
theNCurve : Integer from Standard)
-- Tries to extend existing intersection line
-- (as set of points) to surface's boundaries,
-- if it is possibly.
-- If line is scienter far from boundaries
-- or is (almost) parralel with some boundary,
-- extending is not required.
returns Boolean from Standard;
SeekAdditionalPoints( me : in out;
theASurf1 , theASurf2 : ThePSurface;
theMinNbPoints : Integer from Standard;
theNCurve : Integer from Standard)
returns Boolean from Standard;
-- Unites and correctly coordinates of work of
-- "DistanceMinimizeByGradient" and "DistanceMinimizeByExtrema" functions.
fields fields

File diff suppressed because it is too large Load Diff