1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +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->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.
slin.Append(wline);
@ -1252,10 +1322,18 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
// on traite les restrictions de la surface implicite
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)
IntPatch_RstInt::PutVertexOnLine(slin(i),Surf1,D1,Surf2,Standard_True,TolTang);
IntPatch_RstInt::PutVertexOnLine(aL,Surf1,D1,Surf2,Standard_True,TolTang, 1);
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);
done = Standard_True;
@ -1287,7 +1365,7 @@ static Handle(IntSurf_LineOn2S) VSplitLine(Handle(IntSurf_LineOn2S)& Line,
Standard_Boolean IsReversed,
Handle(Adaptor3d_HSurface)& QSurf,
Handle(IntSurf_LineOn2S)& Vertices)
{
{
Handle(IntSurf_LineOn2S) line = new IntSurf_LineOn2S();
Standard_Real VF = QSurf->FirstVParameter();
@ -1403,7 +1481,7 @@ static Handle(IntSurf_LineOn2S) GetVertices(const Handle(IntPatch_WLine)& WLine,
const Standard_Real TOL3D,
const Standard_Real TOL2D)
{
// Standard_Real TOL3D = 1.e-12, TOL2D = 1.e-8;
// Standard_Real TOL3D = 1.e-12, TOL2D = 1.e-8;
Handle(IntSurf_LineOn2S) vertices = new IntSurf_LineOn2S();
@ -1742,11 +1820,11 @@ static Standard_Boolean InsertSeamVertices(Handle(IntSurf_LineOn2S)& Line,
break;
}
else {
// Line->InsertBefore(ip,Line->Value(ipn));
// Line->RemovePoint(ip+2);
// result = Standard_True;
// cout << "swap vertex " << endl;
// break;
// Line->InsertBefore(ip,Line->Value(ipn));
// Line->RemovePoint(ip+2);
// result = Standard_True;
// cout << "swap vertex " << endl;
// break;
}
}
}
@ -2391,7 +2469,7 @@ void DecomposeResult(Handle(IntPatch_Line)& Line,
AnV1=V1;
}
IntSurf_PntOn2S aVF,aVL;
IntSurf_PntOn2S aVF, aVL;
Standard_Boolean addVF = Standard_False, addVL = Standard_False;
VerifyVertices(sline,IsReversed,vline,TOL2DS,ArcTol,PDomain,aVF,addVF,aVL,addVL);
@ -2461,22 +2539,22 @@ void DecomposeResult(Handle(IntPatch_Line)& Line,
sline = new IntSurf_LineOn2S();
goto nextline;
}
}
}
/*
// <-A
{
Standard_Integer aNbPnts;
Standard_Real aU1,aV1,aU2,aV2;
gp_Pnt aPx;
//
aNbPnts=thelin->NbPoints();
printf(" WLine: aNbPnts=%d\n", aNbPnts);
for(i=1; i <= aNbPnts; ++i) {
const IntSurf_PntOn2S& aPoint = thelin->Value(i);
aPx=aPoint.Value();
aPoint.Parameters(aU1, aV1, aU2, aV2);
printf(" point %d %lf %lf %lf %lf %lf %lf %lf\n",
i, aPx.X(), aPx.Y(), aPx.Z(), aU1, aV1, aU2, aV2);
}
}
{
Standard_Integer aNbPnts;
Standard_Real aU1,aV1,aU2,aV2;
gp_Pnt aPx;
//
aNbPnts=thelin->NbPoints();
printf(" WLine: aNbPnts=%d\n", aNbPnts);
for(i=1; i <= aNbPnts; ++i) {
const IntSurf_PntOn2S& aPoint = thelin->Value(i);
aPx=aPoint.Value();
aPoint.Parameters(aU1, aV1, aU2, aV2);
printf(" point %d %lf %lf %lf %lf %lf %lf %lf\n",
i, aPx.X(), aPx.Y(), aPx.Z(), aU1, aV1, aU2, aV2);
}
}
*/

View File

@ -309,6 +309,18 @@ is
---C++: return const&
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)
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());
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());
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);
}
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_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();
if(typl == IntPatch_Analytic) {

View File

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

View File

@ -43,7 +43,9 @@ uses Vector from math,
VectorOfWalkingData from IntWalk,
Vec from gp,
Dir2d from gp,
PntOn2S from IntSurf
Pnt from gp,
PntOn2S from IntSurf,
Box2d from Bnd
raises NotDone from StdFail,
@ -270,6 +272,59 @@ is
Clear (me: in out) is static protected;
---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

File diff suppressed because it is too large Load Diff