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

0025416: Wrong section curve

1. Restriction line is processed in IntTools_FaceFace with using methods of GeomInt_IntSS class.
2. Check, if Restriction- and Walking-lines (or Restriction-Restriction lines) are coincided, has been added in IntPatch_ImpPrmIntersection.cxx (at that RLine is considered to be isoline only).
3. Check, if RLine and GLine are coincided, has been added in IntPatch_ImpImpIntersection.cxx.
4. Create new class IntPatch_PointLine, which is inherited from IntPatch_Line.
5. The reason of exception (in DEBUG MODE) has been eliminated.

New test cases for issue #25416 were added.

tests/bugs/modalg_5/bug24650 was modified.
This commit is contained in:
nbv
2015-03-25 09:52:07 +03:00
committed by apn
parent 2a8523acca
commit d4b867e617
29 changed files with 1526 additions and 418 deletions

View File

@@ -38,14 +38,11 @@ is
class Point;
deferred class Line;
class GLine; -- inherits Line from IntPatch
class ALine; -- inherits Line from IntPatch
class WLine; -- inherits Line from IntPatch
class RLine; -- inherits Line from IntPatch
class ALine; -- inherits Line from IntPatch
class GLine; -- inherits Line from IntPatch
deferred class PointLine; -- inherits Line from IntPatch
class RLine; -- inherits PointLine from IntPatch
class WLine; -- inherits PointLine from IntPatch
class ArcFunction;

View File

@@ -44,7 +44,15 @@ is
Create (S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
TolArc,TolTang: Real from Standard)
TolArc,TolTang: Real from Standard;
theIsReqToKeepRLine: Boolean from Standard = Standard_False)
---Purpose: Flag theIsReqToKeepRLine has been enterred only for
-- compatibility with TopOpeBRep package. It shall be deleted
-- after deleting TopOpeBRep.
-- When intersection result returns IntPatch_RLine and another
-- IntPatch_Line (not restriction) we (in case of theIsReqToKeepRLine==TRUE)
-- will always keep both lines even if they are coincided.
returns ImpImpIntersection from IntPatch
@@ -55,9 +63,17 @@ is
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
TolArc,TolTang: Real from Standard;
isTheTrimmed: Boolean from Standard = Standard_False)
isTheTrimmed: Boolean from Standard = Standard_False;
theIsReqToKeepRLine: Boolean from Standard = Standard_False)
raises ConstructionError from Standard
---Purpose: Flag theIsReqToKeepRLine has been enterred only for
-- compatibility with TopOpeBRep package. It shall be deleted
-- after deleting TopOpeBRep.
-- When intersection result returns IntPatch_RLine and another
-- IntPatch_Line (not restriction) we (in case of theIsReqToKeepRLine==TRUE)
-- will always keep both lines even if they are coincided.
is static;

View File

@@ -22,6 +22,12 @@
#include <IntSurf.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <IntPatch_GLine.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_Parabola.hxx>
#include <Geom_Hyperbola.hxx>
static void PutPointsOnLine(const Handle(Adaptor3d_HSurface)& S1,
const Handle(Adaptor3d_HSurface)& S2,
@@ -82,7 +88,8 @@ static void ProcessSegments (const IntPatch_SequenceOfSegmentOfTheSOnBounds&,
static void ProcessRLine (IntPatch_SequenceOfLine&,
const IntSurf_Quadric&,
const IntSurf_Quadric&,
const Standard_Real);
const Standard_Real,
const Standard_Boolean theIsReqToKeepRLine);
//-- le calcul de dist est completement faux ds la routine ci dessous a revoir (lbr le 18 nov 97)
Standard_Boolean IntersectionWithAnArc(gp_Pnt& PSurf,
@@ -1654,13 +1661,136 @@ void ProcessSegments (const IntPatch_SequenceOfSegmentOfTheSOnBounds& listedg,
}
}
inline const gp_Pnt& PointValue(const Handle(IntPatch_RLine) theRLine,
const Standard_Integer theIndex)
{
return theRLine->Point(theIndex).Value();
}
inline const gp_Pnt& VertexValue( const Handle(IntPatch_RLine) theRLine,
const Standard_Integer theIndex)
{
return theRLine->Vertex(theIndex).Value();
}
static Standard_Real SquareDistance(const Handle(IntPatch_GLine) theGLine,
const gp_Pnt& theP,
GeomAPI_ProjectPointOnCurve& thePrj)
{
Standard_Real aSQDist = RealLast();
switch(theGLine->ArcType())
{
case IntPatch_Lin:
aSQDist = theGLine->Line().SquareDistance(theP);
break;
case IntPatch_Circle:
aSQDist = theGLine->Circle().SquareDistance(theP);
break;
default:
thePrj.Perform(theP);
if(thePrj.NbPoints() == 0)
{
//Lines are not overlapped
return aSQDist;
}
aSQDist = theP.SquareDistance(thePrj.NearestPoint());
}
return aSQDist;
}
static Standard_Boolean IsRLineGood(const IntSurf_Quadric& Quad1,
const IntSurf_Quadric& Quad2,
const Handle(IntPatch_GLine) theGLine,
const Handle(IntPatch_RLine) theRLine,
const Standard_Real theTol)
{
const Standard_Real aSQTol = theTol*theTol;
const IntPatch_IType aGType = theGLine->ArcType();
Standard_Integer aNbPntsM1 = 0;
const gp_Pnt& (*Value) (const Handle(IntPatch_RLine), const Standard_Integer);
if(theRLine->HasPolygon())
{
aNbPntsM1 = theRLine->NbPnts()-1;
Value = PointValue;
}
else
{
aNbPntsM1 = theRLine->NbVertex()-1;
Value = VertexValue;
}
if(aNbPntsM1 < 1)
return Standard_False;
GeomAPI_ProjectPointOnCurve aPrj;
Handle(Geom_Curve) aCurv;
if(aGType == IntPatch_Ellipse)
aCurv = new Geom_Ellipse(theGLine->Ellipse());
else if(aGType == IntPatch_Parabola)
aCurv = new Geom_Parabola(theGLine->Parabola());
else if(aGType == IntPatch_Hyperbola)
aCurv = new Geom_Hyperbola(theGLine->Hyperbola());
if(!aCurv.IsNull())
aPrj.Init(aCurv, aCurv->FirstParameter(), aCurv->LastParameter());
if(aNbPntsM1 == 1)
{
gp_Pnt aP1(Value(theRLine, 1)), aP2(Value(theRLine, 2));
if(aP1.SquareDistance(aP2) < aSQTol)
{
//RLine is degenerated
return Standard_False;
}
gp_Pnt aPMid;
if(theRLine->IsArcOnS1())
{
const Handle(Adaptor2d_HCurve2d)& anAC2d = theRLine->ArcOnS1();
const Standard_Real aParF = anAC2d->FirstParameter(),
aParL = anAC2d->LastParameter();
gp_Pnt2d aP2d(anAC2d->Value(0.5*(aParF+aParL)));
aPMid = Quad1.Value(aP2d.X(), aP2d.Y());
}
else
{
const Handle(Adaptor2d_HCurve2d)& anAC2d = theRLine->ArcOnS2();
const Standard_Real aParF = anAC2d->FirstParameter(),
aParL = anAC2d->LastParameter();
gp_Pnt2d aP2d(anAC2d->Value(0.5*(aParF+aParL)));
aPMid = Quad2.Value(aP2d.X(), aP2d.Y());
}
const Standard_Real aSQDist = SquareDistance(theGLine, aPMid, aPrj);
return (aSQDist > aSQTol);
}
for(Standard_Integer i = 2; i <= aNbPntsM1; i++)
{
const gp_Pnt aP(Value(theRLine, i));
const Standard_Real aSQDist = SquareDistance(theGLine, aP, aPrj);
if(aSQDist > aSQTol)
return Standard_True;
}
return Standard_False;
}
void ProcessRLine (IntPatch_SequenceOfLine& slin,
// const Handle(Adaptor3d_HSurface)& Surf1,
// const Handle(Adaptor3d_HSurface)& Surf2,
const IntSurf_Quadric& Quad1,
const IntSurf_Quadric& Quad2,
const Standard_Real _TolArc) {
const Standard_Real _TolArc,
const Standard_Boolean theIsReqToKeepRLine) {
// On cherche a placer sur les restrictions solutions les points "multiples"
// des autres lignes d intersection
@@ -1701,15 +1831,17 @@ void ProcessRLine (IntPatch_SequenceOfLine& slin,
for (i=1; i<=Nblin; i++) {
const Handle(IntPatch_Line)& slini = slin(i);
typ1 = slini->ArcType();
Standard_Boolean HasToDeleteRLine = Standard_False;
if (typ1 == IntPatch_Restriction) {
seq_Pnt3d.Clear();
seq_Real.Clear();
for (j=1; j<=Nblin; j++) {
const Handle(IntPatch_Line)& slinj = slin(j);
Nbpt = seq_Pnt3d.Length(); // important que ce soit ici
typ2 = slinj->ArcType();
if (typ2 != IntPatch_Restriction) {
//-- arcref = (*((Handle(IntPatch_RLine)*)&slini))->Arc();
//-- OnFirst = (*((Handle(IntPatch_RLine)*)&slini))->IsOnFirstSurface();
@@ -1896,8 +2028,32 @@ void ProcessRLine (IntPatch_SequenceOfLine& slin,
} //-- if (keeppoint)
} //-- if ((OnFirst && !Ptvtx.IsOnDomS1())||(!OnFirst && !Ptvtx.IsOnDomS2()))
} //-- boucle sur les vertex
if(!theIsReqToKeepRLine)
{
Handle(IntPatch_GLine) aGL = Handle(IntPatch_GLine)::DownCast(slinj);
if(!aGL.IsNull())
{
HasToDeleteRLine = !IsRLineGood(Quad1, Quad2, aGL,
Handle(IntPatch_RLine)::DownCast(slini), TolArc);
}
if(HasToDeleteRLine)
{
break;
}
}
} //-- if (typ2 != IntPatch_Restriction)
} //-- for (j=1; j<=Nblin; j++)
} //-- if (typ1 == IntPatch_Restriction)
if(HasToDeleteRLine)
{
slin.Remove(i);
i--;
Nblin = slin.Length();
continue;
}
} //-- for (i=1; i<=Nblin; i++)
}

View File

@@ -24,7 +24,7 @@ static
//purpose :
//=======================================================================
IntPatch_ImpImpIntersection::IntPatch_ImpImpIntersection ():
done(Standard_False)
done(Standard_False)
{
}
//=======================================================================
@@ -37,9 +37,10 @@ IntPatch_ImpImpIntersection::IntPatch_ImpImpIntersection
const Handle(Adaptor3d_HSurface)& S2,
const Handle(Adaptor3d_TopolTool)& D2,
const Standard_Real TolArc,
const Standard_Real TolTang)
const Standard_Real TolTang,
const Standard_Boolean theIsReqToKeepRLine)
{
Perform(S1,D1,S2,D2,TolArc,TolTang);
Perform(S1,D1,S2,D2,TolArc,TolTang, Standard_False, theIsReqToKeepRLine);
}
//=======================================================================
//function : Perform
@@ -51,7 +52,8 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
const Handle(Adaptor3d_TopolTool)& D2,
const Standard_Real TolArc,
const Standard_Real TolTang,
const Standard_Boolean isTheTrimmed) {
const Standard_Boolean isTheTrimmed,
const Standard_Boolean theIsReqToKeepRLine) {
done = Standard_False;
Standard_Boolean isTrimmed = isTheTrimmed;
spnt.Clear();
@@ -418,7 +420,7 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
if (edg1.Length() !=0 || edg2.Length() !=0) {
// ProcessRLine(slin,S1,S2,TolArc);
ProcessRLine(slin,quad1,quad2,TolArc);
ProcessRLine(slin,quad1,quad2,TolArc, theIsReqToKeepRLine);
}
}//if (!nosolonS1 || !nosolonS2) {
else {

View File

@@ -41,7 +41,6 @@
#define No_Standard_OutOfRange
#endif
#include <math_Vector.hxx>
#include <math_Matrix.hxx>
#include <TopTrans_CurveTransition.hxx>
@@ -53,6 +52,11 @@
#include <IntSurf_SequenceOfInteriorPoint.hxx>
#include <IntSurf_QuadricTool.hxx>
#include <GeomAbs_SurfaceType.hxx>
#include <IntAna2d_AnaIntersection.hxx>
#include <gp_Lin2d.hxx>
#include <ElCLib.hxx>
#include <Bnd_Box2d.hxx>
static Standard_Boolean DecomposeResult(const Handle(IntPatch_Line)& Line,
const Standard_Boolean IsReversed,
@@ -80,6 +84,12 @@ static
Standard_Real U2,
Standard_Real V2);
static Standard_Boolean IsIn2DBox(const Bnd_Box2d& theBox,
const Handle(IntPatch_PointLine)& theLine,
const Standard_Real theUPeriod,
const Standard_Real theVPeriod,
const Standard_Boolean isTheSurface1Using);
//=======================================================================
//function : IntPatch_ImpPrmIntersection
//purpose :
@@ -402,7 +412,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
const Standard_Real Pas)
{
Standard_Boolean reversed, procf, procl, dofirst, dolast;
Standard_Integer indfirst = 0, indlast = 0, ind2, i,j,k, NbSegm;
Standard_Integer indfirst = 0, indlast = 0, ind2, NbSegm;
Standard_Integer NbPointIns, NbPointRst, Nblines, Nbpts, NbPointDep;
Standard_Real U1,V1,U2,V2,paramf,paraml,currentparam;
@@ -557,7 +567,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
UVap(2)=s2d.Y();
Func.Value(UVap,Valf);
Standard_Real rvalf = Sign(1.,Valf(1));
for(i = 2; i <= aNbSamples; ++i)
for(Standard_Integer i = 2; i <= aNbSamples; ++i)
{
D1->SamplePoint(i,s2d, s3d);
UVap(1)=s2d.X();
@@ -586,7 +596,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
solins.Perform(Func,Surf1,D1,TolTang);
}
NbPointIns = solins.NbPoints();
for (i=1; i <= NbPointIns; i++) {
for (Standard_Integer i=1; i <= NbPointIns; i++) {
seqpins.Append(solins.Value(i));
}
}
@@ -616,13 +626,13 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
}
//
Nblines = iwalk.NbLines();
for (j=1; j<=Nblines; j++) {
for (Standard_Integer j=1; j<=Nblines; j++) {
const Handle(IntPatch_TheIWLineOfTheIWalking)& iwline = iwalk.Value(j);
const Handle(IntSurf_LineOn2S)& thelin = iwline->Line();
Nbpts = thelin->NbPoints();
if(Nbpts>=2) {
Standard_Integer k = 0;
tgline = iwline->TangentVector(k);
if(k>=1 && k<=Nbpts) { } else { k=Nbpts>>1; }
valpt = thelin->Value(k).Value();
@@ -772,7 +782,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
PPoint = seqpdep(indfirst);
tgline = PPoint.Direction3d();
Standard_Integer themult = PPoint.Multiplicity();
for (i=NbPointRst; i>=1; i--) {
for (Standard_Integer i=NbPointRst; i>=1; i--) {
if (Destination(i) == indfirst) {
if (!reversed) { //-- typeS1 = Pln || Cyl || Sph || Cone
Quad.Parameters(PPoint.Value(),U1,V1);
@@ -860,7 +870,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
PPoint = seqpdep(indlast);
tgline = PPoint.Direction3d().Reversed();
Standard_Integer themult = PPoint.Multiplicity();
for (i=NbPointRst; i >=1; i--) {
for (Standard_Integer i=NbPointRst; i >=1; i--) {
if (Destination(i) == indlast) {
if (!reversed) {
Quad.Parameters(PPoint.Value(),U1,V1);
@@ -952,7 +962,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
Nblines = slin.Length();
for (j=1; j<=Nblines-1; j++) {
for (Standard_Integer j=1; j<=Nblines-1; j++) {
dofirst = dolast = Standard_False;
const Handle(IntPatch_Line)& slinj = slin(j);
const Handle(IntPatch_WLine)& wlin1 = *((Handle(IntPatch_WLine)*)&slinj);
@@ -970,7 +980,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
}
if (dofirst || dolast) {
for (k=j+1; k<=Nblines;k++) {
for (Standard_Integer k=j+1; k<=Nblines;k++) {
const Handle(IntPatch_Line)& slink = slin(k);
const Handle(IntPatch_WLine)& wlin2 = *((Handle(IntPatch_WLine)*)&slink);
if (wlin2->HasFirstPoint()) {
@@ -1031,7 +1041,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
// Treatment the segments
NbSegm = solrst.NbSegments();
if (NbSegm) {
for(i=1; i<=NbSegm; i++) {
for(Standard_Integer i=1; i<=NbSegm; i++) {
thesegm = solrst.Segment(i);
//Check if segment is degenerated
if(thesegm.HasFirstPoint() && thesegm.HasLastPoint())
@@ -1240,7 +1250,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
Standard_Integer nbsample = 100;
if (!reversed) {
for (j=1; j<=nbsample; j++) {
for (Standard_Integer j=1; j<=nbsample; j++) {
prm = paramf + (j-1)*(paraml-paramf)/(nbsample-1);
arcsegm->D0(prm,p2d);
Surf2->D0(p2d.X(),p2d.Y(),ptpoly);
@@ -1251,7 +1261,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
}
}
else {
for (j=1; j<=nbsample; j++) {
for (Standard_Integer j=1; j<=nbsample; j++) {
prm = paramf + (j-1)*(paraml-paramf)/(nbsample-1);
arcsegm->D0(prm,p2d);
Surf1->D0(p2d.X(),p2d.Y(),ptpoly);
@@ -1266,7 +1276,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
if (dofirst || dolast) {
Nblines = slin.Length();
for (j=1; j<=Nblines; j++) {
for (Standard_Integer j=1; j<=Nblines; j++) {
const Handle(IntPatch_Line)& slinj = slin(j);
typ = slinj->ArcType();
if (typ == IntPatch_Walking) {
@@ -1275,7 +1285,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
else {
Nbpts = (*((Handle(IntPatch_RLine)*)&slinj))->NbVertex();
}
for (k=1; k<=Nbpts;k++) {
for (Standard_Integer k=1; k<=Nbpts;k++) {
if (typ == IntPatch_Walking) {
ptdeb = (*((Handle(IntPatch_WLine)*)&slinj))->Vertex(k);
}
@@ -1333,18 +1343,100 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
}// if (NbSegm)
//
// on traite les restrictions de la surface implicite
for (i=1; i<=slin.Length(); i++)
for (Standard_Integer i=1; i<=slin.Length(); i++)
{
Handle(IntPatch_Line)& aL = slin(i);
if (!reversed)
IntPatch_RstInt::PutVertexOnLine(slin(i),Surf1,D1,Surf2,Standard_True,TolTang);
IntPatch_RstInt::PutVertexOnLine(aL,Surf1,D1,Surf2,Standard_True,TolTang);
else
IntPatch_RstInt::PutVertexOnLine(slin(i),Surf2,D2,Surf1,Standard_False,TolTang);
IntPatch_RstInt::PutVertexOnLine(aL,Surf2,D2,Surf1,Standard_False,TolTang);
}
const Standard_Real aUPeriodOfSurf1 = Surf1->IsUPeriodic() ? Surf1->UPeriod() : 0.0,
aUPeriodOfSurf2 = Surf2->IsUPeriodic() ? Surf2->UPeriod() : 0.0,
aVPeriodOfSurf1 = Surf1->IsVPeriodic() ? Surf1->VPeriod() : 0.0,
aVPeriodOfSurf2 = Surf2->IsVPeriodic() ? Surf2->VPeriod() : 0.0;
for (Standard_Integer i = 1; i <= slin.Length(); i++)
{
//BndBox of the points in Restriction line
Bnd_Box2d aBRL;
for(Standard_Integer j = i + 1; j <= slin.Length(); j++)
{
Handle(IntPatch_PointLine) aL1 = Handle(IntPatch_PointLine)::DownCast(slin(i));
Handle(IntPatch_PointLine) aL2 = Handle(IntPatch_PointLine)::DownCast(slin(j));
Handle(IntPatch_RLine) aRL1 = Handle(IntPatch_RLine)::DownCast(aL1);
Handle(IntPatch_RLine) aRL2 = Handle(IntPatch_RLine)::DownCast(aL2);
if(aRL1.IsNull() && aRL2.IsNull())
{//If Walking-Walking
continue;
}
else if(aRL1.IsNull())
{// i-th line is not restriction,
// but j-th is restriction
slin.Append(aL1);
slin.SetValue(i, aL2);
slin.Remove(j);
j--;
continue;
}
//Here aL1 (i-th line) is Restriction-line and aL2 (j-th line) is not Restriction
if(aBRL.IsVoid())
{//Fill aBRL
for(Standard_Integer aPRID = 1; aPRID <= aRL1->NbPnts(); aPRID++)
{
Standard_Real u = 0.0, v = 0.0;
if(reversed)
aRL1->Point(aPRID).ParametersOnS1(u, v);
else
aRL1->Point(aPRID).ParametersOnS2(u, v);
aBRL.Add(gp_Pnt2d(u, v));
}
Standard_Real aXmin = 0.0, aYmin = 0.0, aXMax = 0.0, aYMax = 0.0;
aBRL.Get(aXmin, aYmin, aXMax, aYMax);
const Standard_Real aDX = aXMax - aXmin,
aDY = aYMax - aYmin;
const Standard_Real aTolU = reversed? Surf1->UResolution(TolArc) : Surf2->UResolution(TolArc);
const Standard_Real aTolV = reversed? Surf1->VResolution(TolArc) : Surf2->VResolution(TolArc);
if((aDX > aTolU) && (aDY > aTolV))
{//Delete restriction line because it is not isoline.
slin.Remove(i);
i--;
break;
}
aXmin -= aTolU;
aXMax += aTolU;
aYmin -= aTolV;
aYMax += aTolV;
aBRL.SetVoid();
aBRL.Update(aXmin, aYmin, aXMax, aYMax);
}
const Standard_Boolean isCoincide = IsIn2DBox(aBRL, aL2,
(reversed? aUPeriodOfSurf1 : aUPeriodOfSurf2),
(reversed? aVPeriodOfSurf1 : aVPeriodOfSurf2), reversed);
if(isCoincide)
{//Delete Walking-line
slin.Remove(j);
j--;
}
}
}
empt = (slin.Length() == 0 && spnt.Length() == 0);
done = Standard_True;
// post processing for cones and spheres
if(slin.Length() == 0)
return;
@@ -1355,12 +1447,14 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
if(!isDecomposeRequired)
return;
// post processing for cones and spheres
const Handle(Adaptor3d_TopolTool)& PDomain = (reversed) ? D1 : D2;
const Handle(Adaptor3d_HSurface)& aQSurf = (reversed) ? Surf2 : Surf1;
IntPatch_SequenceOfLine dslin;
Standard_Boolean isDecompose = Standard_False;
for(i = 1; i <= slin.Length(); i++ )
for(Standard_Integer i = 1; i <= slin.Length(); i++ )
{
if(DecomposeResult(slin(i),reversed,Quad,PDomain,aQSurf,TolArc,dslin))
{
@@ -1372,7 +1466,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
return;
slin.Clear();
for(i = 1; i <= dslin.Length(); i++ )
for(Standard_Integer i = 1; i <= dslin.Length(); i++ )
slin.Append(dslin(i));
}
@@ -1518,8 +1612,8 @@ static Standard_Boolean AreSamePoints(const IntSurf_PntOn2S& P1,
}
static void ForcedPurgePoints(const Handle(IntSurf_LineOn2S)& Result,
const Standard_Boolean IsReversed,
const IntSurf_Quadric& Quad)
const Standard_Boolean IsReversed,
const IntSurf_Quadric& Quad)
{
if(Result->NbPoints() <= 30) return;
Standard_Integer Index = 0, IndexLimF = 8, IndexLimL = 8;
@@ -1790,10 +1884,10 @@ static Standard_Boolean InsertSeamVertices(Handle(IntSurf_LineOn2S)& Line,
}
static void ToSmooth( const Handle(IntSurf_LineOn2S)& Line,
const Standard_Boolean IsReversed,
const IntSurf_Quadric& Quad,
const Standard_Boolean IsFirst,
Standard_Real& D3D)
const Standard_Boolean IsReversed,
const IntSurf_Quadric& Quad,
const Standard_Boolean IsFirst,
Standard_Real& D3D)
{
if(Line->NbPoints() <= 10)
return;
@@ -1886,10 +1980,10 @@ static void ToSmooth( const Handle(IntSurf_LineOn2S)& Line,
}
static Standard_Boolean TestMiddleOnPrm(const IntSurf_PntOn2S& aP,
const IntSurf_PntOn2S& aV,
const Standard_Boolean IsReversed,
const Standard_Real ArcTol,
const Handle(Adaptor3d_TopolTool)& PDomain)
const IntSurf_PntOn2S& aV,
const Standard_Boolean IsReversed,
const Standard_Real ArcTol,
const Handle(Adaptor3d_TopolTool)& PDomain)
{
Standard_Boolean result = Standard_False;
@@ -1911,15 +2005,15 @@ static Standard_Boolean TestMiddleOnPrm(const IntSurf_PntOn2S& aP,
}
static void VerifyVertices( const Handle(IntSurf_LineOn2S)& Line,
const Standard_Boolean IsReversed,
const Handle(IntSurf_LineOn2S)& Vertices,
const Standard_Real TOL2D,
const Standard_Real ArcTol,
const Handle(Adaptor3d_TopolTool)& PDomain,
IntSurf_PntOn2S& VrtF,
Standard_Boolean& AddFirst,
IntSurf_PntOn2S& VrtL,
Standard_Boolean& AddLast)
const Standard_Boolean IsReversed,
const Handle(IntSurf_LineOn2S)& Vertices,
const Standard_Real TOL2D,
const Standard_Real ArcTol,
const Handle(Adaptor3d_TopolTool)& PDomain,
IntSurf_PntOn2S& VrtF,
Standard_Boolean& AddFirst,
IntSurf_PntOn2S& VrtL,
Standard_Boolean& AddLast)
{
Standard_Integer nbp = Line->NbPoints(), nbv = Vertices->NbPoints();
Standard_Integer FIndexSame = 0, FIndexNear = 0, LIndexSame = 0, LIndexNear = 0;
@@ -2522,21 +2616,58 @@ static Standard_Boolean DecomposeResult(const Handle(IntPatch_Line)& theLine,
return hasBeenDecomposed;
}
/*
// <-A
static Standard_Boolean IsIn2DBox(const Bnd_Box2d& theBox,
const Handle(IntPatch_PointLine)& theLine,
const Standard_Real theUPeriod,
const Standard_Real theVPeriod,
const Standard_Boolean isTheSurface1Using)
{
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);
const Standard_Integer aNbPnts = theLine->NbPnts();
const Standard_Real aDeltaUPeriod[] = {0.0, -theUPeriod, 2.0*theUPeriod};
const Standard_Real aDeltaVPeriod[] = {0.0, -theVPeriod, 2.0*theVPeriod};
const Standard_Integer aSzOfUPArr = sizeof(aDeltaUPeriod)/sizeof(aDeltaUPeriod[0]);
const Standard_Integer aSzOfVPArr = sizeof(aDeltaVPeriod)/sizeof(aDeltaVPeriod[0]);
for(Standard_Integer aPtID = 1; aPtID <= aNbPnts; aPtID++)
{
Standard_Real aU = 0.0, aV = 0.0;
if(isTheSurface1Using)
theLine->Point(aPtID).ParametersOnS1(aU, aV);
else
theLine->Point(aPtID).ParametersOnS2(aU, aV);
if(!theBox.IsOut(gp_Pnt2d(aU, aV)))
continue;
Standard_Boolean isInscribe = Standard_False;
for(Standard_Integer aUind = 0; !isInscribe && (aUind < aSzOfUPArr); aUind++)
{
if((aUind > 0) && (aDeltaUPeriod[aUind] == 0.0))
{
break;
}
aU += aDeltaUPeriod[aUind];
for(Standard_Integer aVind = 0; !isInscribe && (aVind < aSzOfVPArr); aVind++)
{
if((aVind > 0) && (aDeltaVPeriod[aVind] == 0.0))
{
break;
}
aV += aDeltaVPeriod[aVind];
isInscribe = !theBox.IsOut(gp_Pnt2d(aU, aV));
}
}
if(!isInscribe)
return Standard_False;
}
return Standard_True;
}
}
*/

View File

@@ -88,8 +88,16 @@ is
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
TolArc,TolTang: Real from Standard;
isGeomInt : Boolean from Standard = Standard_True)
isGeomInt : Boolean from Standard = Standard_True;
theIsReqToKeepRLine: Boolean from Standard = Standard_False)
---Purpose: Flag theIsReqToKeepRLine has been enterred only for
-- compatibility with TopOpeBRep package. It shall be deleted
-- after deleting TopOpeBRep.
-- When intersection result returns IntPatch_RLine and another
-- IntPatch_Line (not restriction) we (in case of theIsReqToKeepRLine==TRUE)
-- will always keep both lines even if they are coincided.
raises ConstructionError from Standard
is static;
@@ -140,7 +148,15 @@ is
TolArc,TolTang: Real from Standard;
LOfPnts: in out ListOfPntOn2S from IntSurf;
RestrictLine: Boolean from Standard;
typs1, typs2: SurfaceType from GeomAbs)
typs1, typs2: SurfaceType from GeomAbs;
theIsReqToKeepRLine: Boolean from Standard = Standard_False)
---Purpose: Flag theIsReqToKeepRLine has been enterred only for
-- compatibility with TopOpeBRep package. It shall be deleted
-- after deleting TopOpeBRep.
-- When intersection result returns IntPatch_RLine and another
-- IntPatch_Line (not restriction) we (in case of theIsReqToKeepRLine==TRUE)
-- will always keep both lines even if they are coincided.
is private;
@@ -150,8 +166,16 @@ is
TolArc,TolTang: Real from Standard;
LOfPnts: in out ListOfPntOn2S from IntSurf;
RestrictLine: Boolean from Standard;
typs1, typs2: SurfaceType from GeomAbs)
typs1, typs2: SurfaceType from GeomAbs;
theIsReqToKeepRLine: Boolean from Standard = Standard_False)
---Purpose: Flag theIsReqToKeepRLine has been enterred only for
-- compatibility with TopOpeBRep package. It shall be deleted
-- after deleting TopOpeBRep.
-- When intersection result returns IntPatch_RLine and another
-- IntPatch_Line (not restriction) we (in case of theIsReqToKeepRLine==TRUE)
-- will always keep both lines even if they are coincided.
is private;
GeomParamPerfom(me: in out;

View File

@@ -925,7 +925,8 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1,
const Handle(Adaptor3d_TopolTool)& theD2,
const Standard_Real TolArc,
const Standard_Real TolTang,
const Standard_Boolean isGeomInt)
const Standard_Boolean isGeomInt,
const Standard_Boolean theIsReqToKeepRLine)
{
myTolArc = TolArc;
myTolTang = TolTang;
@@ -1124,13 +1125,15 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1,
{
if(theD1->DomainIsInfinite() || theD2->DomainIsInfinite())
{
GeomGeomPerfom(theS1, theD1, theS2, theD2, TolArc,
TolTang, ListOfPnts, RestrictLine, typs1, typs2);
GeomGeomPerfom( theS1, theD1, theS2, theD2, TolArc,
TolTang, ListOfPnts, RestrictLine,
typs1, typs2, theIsReqToKeepRLine);
}
else
{
GeomGeomPerfomTrimSurf(theS1, theD1, theS2, theD2,
TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2);
GeomGeomPerfomTrimSurf( theS1, theD1, theS2, theD2,
TolArc, TolTang, ListOfPnts, RestrictLine,
typs1, typs2, theIsReqToKeepRLine);
}
}
else
@@ -1500,9 +1503,11 @@ void IntPatch_Intersection::GeomGeomPerfom(const Handle(Adaptor3d_HSurface)& the
IntSurf_ListOfPntOn2S& ListOfPnts,
const Standard_Boolean RestrictLine,
const GeomAbs_SurfaceType typs1,
const GeomAbs_SurfaceType typs2)
const GeomAbs_SurfaceType typs2,
const Standard_Boolean theIsReqToKeepRLine)
{
IntPatch_ImpImpIntersection interii(theS1,theD1,theS2,theD2,myTolArc,myTolTang);
IntPatch_ImpImpIntersection interii(theS1,theD1,theS2,theD2,
myTolArc,myTolTang, theIsReqToKeepRLine);
const Standard_Boolean anIS = interii.IsDone();
if (anIS)
{
@@ -1693,14 +1698,16 @@ void IntPatch_Intersection::
IntSurf_ListOfPntOn2S& theListOfPnts,
const Standard_Boolean RestrictLine,
const GeomAbs_SurfaceType theTyps1,
const GeomAbs_SurfaceType theTyps2)
const GeomAbs_SurfaceType theTyps2,
const Standard_Boolean theIsReqToKeepRLine)
{
IntSurf_Quadric Quad1,Quad2;
if((theTyps1 == GeomAbs_Cylinder) && (theTyps2 == GeomAbs_Cylinder))
{
IntPatch_ImpImpIntersection anInt;
anInt.Perform(theS1, theD1, theS2, theD2, myTolArc, myTolTang, Standard_True);
anInt.Perform(theS1, theD1, theS2, theD2, myTolArc,
myTolTang, Standard_True, theIsReqToKeepRLine);
done = anInt.IsDone();
@@ -1743,7 +1750,8 @@ void IntPatch_Intersection::
else
{
GeomGeomPerfom(theS1, theD1, theS2, theD2,
theTolArc, theTolTang, theListOfPnts, RestrictLine, theTyps1, theTyps2);
theTolArc, theTolTang, theListOfPnts,
RestrictLine, theTyps1, theTyps2, theIsReqToKeepRLine);
}
}

View File

@@ -24,7 +24,6 @@ uses
HVertex from Adaptor3d,
HCurve2d from Adaptor2d,
PntOn2S from IntSurf,
Line from IntPatch,
Transition from IntSurf,
Pnt from gp

View File

@@ -0,0 +1,75 @@
-- Created on: 2015-02-18
-- Created by: Nikolai BUKHALOV
-- Copyright (c) 1992-1999 Matra Datavision
-- Copyright (c) 1999-2015 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
deferred class PointLine from IntPatch
inherits Line from IntPatch
---Purpose: Definition of an intersection line between two
-- surfaces.
-- A line defined by a set of points
-- (e.g. coming from a walking algorithm) as
-- defined in the class WLine or RLine (Restriction line).
uses TypeTrans from IntSurf,
Situation from IntSurf,
PntOn2S from IntSurf
raises DomainError from Standard,
OutOfRange from Standard
is
Initialize(Tang: Boolean from Standard;
Trans1,Trans2: TypeTrans from IntSurf);
---Purpose: To initialize the fields, when the transitions
-- are In or Out.
Initialize(Tang: Boolean from Standard;
Situ1,Situ2: Situation from IntSurf);
---Purpose: To initialize the fields, when the transitions
-- are Touch.
Initialize(Tang: Boolean from Standard);
---Purpose: To initialize the fields, when the transitions
-- are Undecided.
NbPnts(me) returns Integer from Standard
---Purpose: Returns the number of intersection points.
is deferred;
Point(me; Index : Integer from Standard) returns PntOn2S from IntSurf
---Purpose: Returns the intersection point of range Index.
---C++: return const&
raises OutOfRange from Standard,
DomainError from Standard
--- The exception DomainError is raised if HasPolygon returns False.
--- The exception OutOfRange is raised if Index <= 0 or Index > NbPnts.
is deferred;
-- fields
end Line;

View File

@@ -0,0 +1,36 @@
// Created on: 2015-02-18
// Created by: Nikolai BUKHALOV
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <IntPatch_PointLine.ixx>
IntPatch_PointLine::IntPatch_PointLine (const Standard_Boolean Tang,
const IntSurf_TypeTrans Trans1,
const IntSurf_TypeTrans Trans2) :
IntPatch_Line(Tang, Trans1, Trans2)
{}
IntPatch_PointLine::IntPatch_PointLine (const Standard_Boolean Tang,
const IntSurf_Situation Situ1,
const IntSurf_Situation Situ2) :
IntPatch_Line(Tang, Situ1, Situ2)
{}
IntPatch_PointLine::IntPatch_PointLine (const Standard_Boolean Tang) :
IntPatch_Line(Tang)
{}

View File

@@ -17,7 +17,7 @@
class RLine from IntPatch
inherits Line from IntPatch
inherits PointLine from IntPatch
---Purpose: Implementation of an intersection line described by a
-- restriction line on one of the surfaces.

View File

@@ -20,10 +20,9 @@
#include <Precision.hxx>
IntPatch_RLine::IntPatch_RLine (const Standard_Boolean Tang,
const IntSurf_TypeTrans Trans1,
const IntSurf_TypeTrans Trans2) :
IntPatch_Line(Tang,Trans1,Trans2),
fipt(Standard_False),lapt(Standard_False)
const IntSurf_TypeTrans Trans1,
const IntSurf_TypeTrans Trans2) :
IntPatch_PointLine(Tang,Trans1,Trans2), fipt(Standard_False),lapt(Standard_False)
{
typ = IntPatch_Restriction;
@@ -33,10 +32,9 @@ IntPatch_RLine::IntPatch_RLine (const Standard_Boolean Tang,
IntPatch_RLine::IntPatch_RLine (const Standard_Boolean Tang,
const IntSurf_Situation Situ1,
const IntSurf_Situation Situ2) :
IntPatch_Line(Tang,Situ1,Situ2),
fipt(Standard_False),lapt(Standard_False)
const IntSurf_Situation Situ1,
const IntSurf_Situation Situ2) :
IntPatch_PointLine(Tang,Situ1,Situ2), fipt(Standard_False),lapt(Standard_False)
{
typ = IntPatch_Restriction;
onS2=Standard_False;
@@ -45,8 +43,7 @@ IntPatch_RLine::IntPatch_RLine (const Standard_Boolean Tang,
IntPatch_RLine::IntPatch_RLine (const Standard_Boolean Tang) :
IntPatch_Line(Tang),
fipt(Standard_False),lapt(Standard_False)
IntPatch_PointLine(Tang), fipt(Standard_False),lapt(Standard_False)
{
typ = IntPatch_Restriction;

View File

@@ -16,7 +16,7 @@
class WLine from IntPatch
inherits Line from IntPatch
inherits PointLine from IntPatch
---Purpose: Definition of set of points as a result of the intersection
-- between 2 parametrised patches.

View File

@@ -28,7 +28,7 @@ IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
const Standard_Boolean Tang,
const IntSurf_TypeTrans Trans1,
const IntSurf_TypeTrans Trans2) :
IntPatch_Line(Tang,Trans1,Trans2),fipt(Standard_False),lapt(Standard_False),
IntPatch_PointLine(Tang,Trans1,Trans2),fipt(Standard_False),lapt(Standard_False),
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False)
{
typ = IntPatch_Walking;
@@ -44,7 +44,7 @@ IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
const Standard_Boolean Tang,
const IntSurf_Situation Situ1,
const IntSurf_Situation Situ2) :
IntPatch_Line(Tang,Situ1,Situ2),fipt(Standard_False),lapt(Standard_False),
IntPatch_PointLine(Tang,Situ1,Situ2),fipt(Standard_False),lapt(Standard_False),
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False)
{
typ = IntPatch_Walking;
@@ -58,7 +58,7 @@ IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
const Standard_Boolean Tang) :
IntPatch_Line(Tang),fipt(Standard_False),lapt(Standard_False),
IntPatch_PointLine(Tang),fipt(Standard_False),lapt(Standard_False),
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False)
{
typ = IntPatch_Walking;