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

0025593: Number of intersection points for 2d curves depends on the order of arguments in command "2dintersect"

1. Unification of the polygons creation (it is regardless of arguments order).
2. Output of 2dintersect DRAW-command was changed.
3. Geom2dGcc_Circ2d2TanRadGeo.cxx:
     Precise intersection point found by Extrema Curve-Curve method (dot product between every tangent vector and vector between points on two curves must be equal to zero).
4. Some comments have been translated from French to English.

Some test case have been updated.

Changes in accordance with the last remark

Test case for issue CR25593
This commit is contained in:
nbv
2015-04-16 10:32:53 +03:00
committed by bugmaster
parent 346cf025a5
commit 1d19db8dad
41 changed files with 451 additions and 546 deletions

View File

@@ -104,7 +104,7 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
Standard_Real TlConf=(TheTolConf < TOL_CONF_MINI)? TOL_CONF_MINI : TheTolConf;
Perform(C1,D1,C2,D2,TlConf,Tl,0,DU,DV);
//----------------------------------------------------------------------
//-- Traitement des points en bouts
//-- Processing of end points
//----------------------------------------------------------------------
Standard_Boolean HeadOn1 = Standard_False;
Standard_Boolean HeadOn2 = Standard_False;
@@ -115,14 +115,14 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
//--------------------------------------------------------------------
//-- On ne rejette les points Head Head ... End End
//-- si ils figurent deja dans un bout de segment
//-- ( On ne peut pas tester les egalites sur les parametres)
//-- ( ces points n etant pas trouves a EpsX pres )
//-- PosSegment = 1 si Head Head
//-- 2 si Head End
//-- 4 si End Head
//-- 8 si End End
//-- The points Head Head ... End End are not rejected if
//-- they are already present at the end of segment
//-- ( It is not possible to test the equities on the parameters)
//-- ( these points are not found at EpsX precision )
//-- PosSegment = 1 if Head Head
//-- 2 if Head End
//-- 4 if End Head
//-- 8 if End End
//--------------------------------------------------------------------
Standard_Integer PosSegment = 0;
@@ -227,14 +227,14 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
Standard_Integer n=this->NbPoints();
//--------------------------------------------------------------------
//-- On ne rejette les points Head Head ... End End
//-- si ils figurent deja dans un bout de segment
//-- ( On ne peut pas tester les egalites sur les parametres)
//-- ( ces points n etant pas trouves a EpsX pres )
//-- PosSegment = 1 si Head Head
//-- 2 si Head End
//-- 4 si End Head
//-- 8 si End End
//-- The points Head Head ... End End are not rejected if
//-- they are already present at the end of segment
//-- ( It is not possible to test the equities on the parameters)
//-- ( these points are not found at EpsX precision )
//-- PosSegment = 1 if Head Head
//-- 2 if Head End
//-- 4 if End Head
//-- 8 if End End
//--------------------------------------------------------------------
Standard_Integer PosSegment = 0;
@@ -298,10 +298,10 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
if(NbIter>3 || (NbIter>2 && nbsamples>100)) return;
nbsamples*=2; //--- On prend systematiquement 2 fois plus de points que
//-- sur une courbe normale.
//-- Les courbes auto-intersectantes donne souvent des
//-- polygones assez loin de la courbe a parametre ct.
nbsamples*=2; //--- We take systematically two times more points
//-- than on a normal curve.
//-- Auto-intersecting curves often produce
//-- polygons rather far from the curve with parameter ct.
if(NbIter>0) {
nbsamples=(3*(nbsamples*NbIter))/2;
@@ -313,9 +313,9 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
}
//-- Poly1.Dump();
//----------------------------------------------------------------------
//-- Si la deflection est inferieure a la Tolerance de Confusion
//-- Alors la deflection du polygone est fixee a TolConf
//-- (Detection des Zones de Tangence)
//-- If the deflection is less than the Tolerance of Confusion
//-- then the deflection of the polygon is set in TolConf
//-- (Detection of Tangency Zones)
//----------------------------------------------------------------------
if(Poly1.DeflectionOverEstimation() < TolConf) {
Poly1.SetDeflectionOverEstimation(TolConf);
@@ -326,13 +326,13 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
Standard_Real U,V;
//----------------------------------------------------------------------
//-- Traitement des SectionPoint
//-- Processing of SectionPoint
//----------------------------------------------------------------------
Standard_Integer Nbsp = InterPP.NbSectionPoints();
if(Nbsp>=1) {
//-- ---------------------------------------------------------------------
//-- tri tri tri tri tri tri tri tri tri tri tri tri tri tri
//-- filtering, filtering, filtering ...
//--
Standard_Integer* TriIndex = new Standard_Integer [Nbsp+1];
Standard_Integer* PtrSegIndex1 = new Standard_Integer [Nbsp+1];
@@ -401,7 +401,7 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
EIP.Perform(Poly1,Poly1,SegIndex1,SegIndex2,ParamOn1,ParamOn2);
if(EIP.NbRoots()==0) {
//-- On supprime tous les segments voisins
//-- All neighbor segments are removed
for(Standard_Integer k=sp+1;k<=Nbsp;k++) {
Standard_Integer kk=TriIndex[k];
// --- avoid negative indicies as well as in outer done
@@ -415,7 +415,7 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
}
else if(EIP.NbRoots()>=1) {
//--------------------------------------------------------------------
//-- On verifie que le point trouve est bien une racine
//-- It is checked if the found point is a root
//--------------------------------------------------------------------
EIP.Roots(U,V);
@@ -426,15 +426,15 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
if(Abs(U-V)<=EpsX1) {
//-----------------------------------------
//-- Solution non valide
//-- Les maths ont du converger vers une
//-- solution triviale ( point U = V )
//-- Solution not valid
//-- The maths should have converged in a
//-- trivial solution ( point U = V )
//-----------------------------------------
Dist = TolConf+1.0;
}
//-----------------------------------------------------------------
//-- On verifie que le point (u,v) n existe pas deja
//-- It is checked if the point (u,v) already exists
//--
done = Standard_True;
Standard_Integer nbp=NbPoints();
@@ -448,12 +448,12 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
}
}
if(Dist <= TolConf) { //-- Ou le point est deja present
if(Dist <= TolConf) { //-- Or the point is already present
IntRes2d_Position Pos1 = IntRes2d_Middle;
IntRes2d_Position Pos2 = IntRes2d_Middle;
IntRes2d_Transition Trans1,Trans2;
//-----------------------------------------------------------------
//-- Calcul des Positions des Points sur la courbe
//-- Calculate Positions of Points on the curve
//--
if(P1.Distance(DomainOnCurve1.FirstPoint())<=DomainOnCurve1.FirstTolerance())
Pos1 = IntRes2d_Head;
@@ -599,13 +599,13 @@ Standard_Boolean HeadOrEndPoint( const IntRes2d_Domain& D1
}
//--------------------------------------------------------------------
//-- On Teste si un point de bout de segment a deja ces trnasitions
//-- Si Oui, on ne cree pas de nouveau point
//-- It is tested if a point at the end of segment already has its transitions
//-- If Yes, the new point is not created
//--
//-- PosSegment = 1 si Head Head
//-- 2 si Head End
//-- 4 si End Head
//-- 8 si End End
//-- PosSegment = 1 if Head Head
//-- 2 if Head End
//-- 4 if End Head
//-- 8 if End End
//--------------------------------------------------------------------
if(Pos1 == IntRes2d_Head) {
if((Pos2 == IntRes2d_Head)&&(PosSegment & 1)) return(Standard_False);
@@ -675,35 +675,30 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
/////////////////////////////////////////////
NCollection_Handle<IntCurve_ThePolygon2d> aPoly1 ,aPoly2;
if(nbsamplesOnC2 > nbsamplesOnC1) {
aPoly1 = new IntCurve_ThePolygon2d(C1,nbsamplesOnC1,D1,Tol);
if(aPoly1->DeflectionOverEstimation() < TolConf) {
aPoly2 = new IntCurve_ThePolygon2d(C2,nbsamplesOnC2,D2,Tol);
}
else {
aPoly2 = new IntCurve_ThePolygon2d(C2,nbsamplesOnC2,D2,Tol,aPoly1->Bounding());
aPoly1->SetDeflectionOverEstimation( aPoly2->DeflectionOverEstimation()
+ aPoly1->DeflectionOverEstimation());
aPoly1->ComputeWithBox(C1,aPoly2->Bounding());
}
}
else {
aPoly2 = new IntCurve_ThePolygon2d(C2,nbsamplesOnC2,D2,Tol);
if(aPoly2->DeflectionOverEstimation() < TolConf) {
aPoly1 = new IntCurve_ThePolygon2d(C1,nbsamplesOnC1,D1,Tol);
}
else {
aPoly1 = new IntCurve_ThePolygon2d(C1,nbsamplesOnC1,D1,Tol,aPoly2->Bounding());
aPoly2->SetDeflectionOverEstimation( aPoly2->DeflectionOverEstimation()
+ aPoly1->DeflectionOverEstimation());
aPoly2->ComputeWithBox(C2,aPoly1->Bounding());
}
NCollection_Handle<IntCurve_ThePolygon2d>
aPoly1 = new IntCurve_ThePolygon2d(C1,nbsamplesOnC1,D1,Tol),
aPoly2 = new IntCurve_ThePolygon2d(C2,nbsamplesOnC2,D2,Tol);
if( (aPoly1->DeflectionOverEstimation() > TolConf) ||
(aPoly2->DeflectionOverEstimation() > TolConf))
{
const Standard_Real aDeflectionSum =
Max(aPoly1->DeflectionOverEstimation(), TolConf) +
Max(aPoly2->DeflectionOverEstimation(), TolConf);
aPoly2->SetDeflectionOverEstimation(aDeflectionSum);
aPoly1->SetDeflectionOverEstimation(aDeflectionSum);
const Bnd_Box2d aB1 = aPoly1->Bounding(), aB2 = aPoly2->Bounding();
aPoly1->ComputeWithBox(C1, aB2);
aPoly2->ComputeWithBox(C2, aB1);
}
//----------------------------------------------------------------------
//-- Si la deflection est inferieure a la Tolerance de Confusion
//-- Alors la deflection du polygone est fixee a TolConf
//-- (Detection des Zones de Tangence)
//-- if the deflection less then the Tolerance of Confusion
//-- Then the deflection of the polygon is set in TolConf
//-- (Detection of Tangency Zones)
//----------------------------------------------------------------------
if(aPoly1->DeflectionOverEstimation() < TolConf) {
@@ -712,12 +707,12 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
if(aPoly2->DeflectionOverEstimation() < TolConf) {
aPoly2->SetDeflectionOverEstimation(TolConf);
}
//for case when a few polygon points were replaced by line
//if exact solution was not found
//then search of precise solution will be repeat
//for polygon conatins all initial points
//secondary search will be performed only for case when initial points
//were dropped
// for case when a few polygon points were replaced by line
// if exact solution was not found
// then search of precise solution will be repeated
// for polygon contains all initial points
// secondary search will be performed only for case when initial points
// were dropped
Standard_Boolean isFullRepresentation = ( aPoly1->NbSegments() == nbsamplesOnC1 &&
aPoly2->NbSegments() == nbsamplesOnC2 );
@@ -769,7 +764,7 @@ Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect(
Standard_Boolean AnErrorOccurred = Standard_False;
done = Standard_True; // To prevent exception in nbp=NbPoints();
//----------------------------------------------------------------------
//-- Traitement des SectionPoint
//-- Processing of SectionPoint
//----------------------------------------------------------------------
Standard_Integer Nbsp = InterPP.NbSectionPoints();
for(Standard_Integer sp=1; sp <= Nbsp; sp++) {
@@ -792,7 +787,7 @@ Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect(
}
//--------------------------------------------------------------------
//-- On verifie que le point trouve est bien une racine
//-- It is checked if the found point is really a root
//--------------------------------------------------------------------
EIP.Roots(U,V);
@@ -819,7 +814,7 @@ Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect(
Dist = P1.Distance(P2);
}
//-----------------------------------------------------------------
//-- On verifie que le point (u,v) n existe pas deja
//-- It is checked if the point (u,v) does not exist already
//--
Standard_Integer nbp=NbPoints();
Standard_Real EpsX1 = 10.0*TheCurveTool::EpsX(C1);
@@ -833,12 +828,12 @@ Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect(
}
}
if(Dist <= TolConf) { //-- Ou le point est deja present
if(Dist <= TolConf) { //-- Or the point is already present
IntRes2d_Position Pos1 = IntRes2d_Middle;
IntRes2d_Position Pos2 = IntRes2d_Middle;
IntRes2d_Transition Trans1,Trans2;
//-----------------------------------------------------------------
//-- Calcul des Positions des Points sur la courbe
//-- Calculate the Positions of Points on the curve
//--
if(P1.Distance(DomainOnCurve1.FirstPoint())<=DomainOnCurve1.FirstTolerance())
Pos1 = IntRes2d_Head;
@@ -850,7 +845,7 @@ Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect(
else if(P2.Distance(DomainOnCurve2.LastPoint())<=DomainOnCurve2.LastTolerance())
Pos2 = IntRes2d_End;
//-----------------------------------------------------------------
//-- Calcul des Transitions (Voir IntImpParGen.cxx)
//-- Calculate the Transitions (see IntImpParGen.cxx)
//--
if(IntImpParGen::DetermineTransition (Pos1, Tan1, Trans1, Pos2, Tan2, Trans2, TolConf) == Standard_False) {
TheCurveTool::D2(C1,U,P1,Tan1,Norm1);
@@ -863,13 +858,13 @@ Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect(
}
//----------------------------------------------------------------------
//-- Traitement des TangentZone
//-- Processing of TangentZone
//----------------------------------------------------------------------
Standard_Integer Nbtz = InterPP.NbTangentZones();
for(Standard_Integer tz=1; tz <= Nbtz; tz++) {
Standard_Integer NbPnts = InterPP.ZoneValue(tz).NumberOfPoints();
//====================================================================
//== Recherche du premier et du dernier point dans la zone de tg.
//== Find the first and the last point in the tangency zone.
//====================================================================
Standard_Real ParamSupOnCurve2,ParamInfOnCurve2;
Standard_Real ParamSupOnCurve1,ParamInfOnCurve1;
@@ -883,12 +878,11 @@ Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect(
for(Standard_Integer qq=1;qq<=NbPnts;qq++) {
const Intf_SectionPoint& SPnt1 = InterPP.ZoneValue(tz).GetPoint(qq);
//====================================================================
//== On discretise sur les zones de tangence
//== Test d arret :
//== Compteur
//== Deflection < Tolerance
//== OU Echantillon < EpsX (normalement la premiere condition est
//== plus severe)
//== The zones of tangency are discretized
//== Test of stop : Check if
//== (Deflection < Tolerance)
//== Or (Sample < EpsX) (normally the first condition is
//== more strict)
//====================================================================
// Standard_Real _PolyUInf,_PolyUSup,_PolyVInf,_PolyVSup;
Standard_Real _PolyUInf,_PolyVInf;
@@ -938,15 +932,15 @@ Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect(
,ParamInfOnCurve2,TolConf
,TheCurveTool::Value(C2,ParamSupOnCurve2)
,ParamSupOnCurve2,TolConf);
//-- On ne delete pas thePoly1(2) ,
//-- ils sont detruits enfin de fct.
//-- !! Pas de return intempestif !!
//-- thePoly1(2) are not deleted,
//-- finally they are destroyed.
//-- !! No untimely return !!
Perform(C1,RecursD1,C2,RecursD2,Tol,TolConf,NbIter+1,DeltaU,DeltaV);
}
else {
//-----------------------------------------------------------------
//-- Calcul des Positions des Points sur la courbe et des
//-- Transitions sur chaque borne du segment
//-- Calculate Positions of Points on the curve and
//-- Transitions on each limit of the segment
IntRes2d_Position Pos1 = IntRes2d_Middle;
IntRes2d_Position Pos2 = IntRes2d_Middle;

View File

@@ -46,20 +46,6 @@ is
returns Polygon2dGen from IntCurve;
Create (Curve : TheCurve;
NbPnt : Integer from Standard;
Domain : Domain from IntRes2d;
Tol : Real from Standard;
OtherBox : Box2d from Bnd)
---Purpose: Compute a polygon on the domain of the
-- curve. parameters of the begin and
-- end of the curve (and its polygon) are
-- adjusted to lie in the OtherBox.
returns Polygon2dGen from IntCurve;
ComputeWithBox(me : in out;
Curve : TheCurve;
OtherBox : Box2d from Bnd)

View File

@@ -26,19 +26,18 @@
#define MAJORATION_DEFLECTION 1.5
//======================================================================
//== On echantillonne sur le Domain de la Curve NbPts Points
//== a parametres constants.
//== We take samples on the Domain of the Curve NbPts Points
//== with constant parameters.
//==
//== On estime la fleche maximum en prenant la distance maxi entre la
//== droite Curve.Value(X(i))-->Curve.Value(X(i+1))
//== et le point Curve.Value(X(i+1/2))
//== We estimate the maximum deflection taking the max distance between the
//== right Curve.Value(X(i))-->Curve.Value(X(i+1))
//== and the point Curve.Value(X(i+1/2))
//======================================================================
// Modified by Sergey KHROMOV - Mon Mar 24 12:02:43 2003 Begin
IntCurve_Polygon2dGen::IntCurve_Polygon2dGen(const TheCurve& C,
const Standard_Integer tNbPts,
const IntRes2d_Domain& D,
const Standard_Real Tol):
// const Standard_Real ):
// Modified by Sergey KHROMOV - Mon Mar 24 12:02:45 2003 End
ThePnts(1,(tNbPts<3)? 6 : (tNbPts+tNbPts)),
TheParams(1,(tNbPts<3)? 6 : (tNbPts+tNbPts)),
@@ -49,13 +48,13 @@ IntCurve_Polygon2dGen::IntCurve_Polygon2dGen(const TheCurve& C,
TheMaxNbPoints = NbPts+NbPts;
NbPntIn = NbPts;
//-----------------------------------------------------
//--- Initialisation du Brise a d_Parametre constant
//--- Initialization of the breaking with d_Parametre constant
//---
Binf = D.FirstParameter();
Bsup = D.LastParameter();
//-----------------------------------------------------
//-- IntRes2d Raise si HasFirst retourne False
//-- et Acces a First Parameter
//-- IntRes2d Raise if HasFirst returns False
//-- and accesses First Parameter
//--
Standard_Real u=Binf;
Standard_Real u1=Bsup;
@@ -76,7 +75,7 @@ IntCurve_Polygon2dGen::IntCurve_Polygon2dGen(const TheCurve& C,
//-----------------------------------------------------
//--- Calcul d un majorant de fleche approche
//--- Calculate a maximal deflection
//---
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:05 2003 Begin
// TheDeflection = 0.000000001;
@@ -112,109 +111,6 @@ IntCurve_Polygon2dGen::IntCurve_Polygon2dGen(const TheCurve& C,
ClosedPolygon = Standard_False;
}
//======================================================================
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:26 2003 Begin
IntCurve_Polygon2dGen::IntCurve_Polygon2dGen(const TheCurve& C,
const Standard_Integer tNbPts,
const IntRes2d_Domain& D,
const Standard_Real Tol,
const Bnd_Box2d& BoxOtherPolygon):
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:28 2003 End
ThePnts(1,(tNbPts<3)? 6 : (tNbPts+tNbPts)),
TheParams(1,(tNbPts<3)? 6 : (tNbPts+tNbPts)),
TheIndex(1,(tNbPts<3)? 6 : (tNbPts+tNbPts))
{
Standard_Integer NbPts = (tNbPts<3)? 3 : tNbPts;
TheMaxNbPoints = NbPts+NbPts;
NbPntIn = NbPts;
//-----------------------------------------------------
//--- Initialisation du Brise a d_Parametre constant
//---
Binf = D.FirstParameter();
Bsup = D.LastParameter();
//-----------------------------------------------------
Standard_Real u=Binf;
Standard_Real u1=Bsup;
Standard_Real du=(u1-u)/(Standard_Real)(NbPts-1);
Standard_Integer i=1;
do {
gp_Pnt2d P=TheCurveTool::Value(C,u);
myBox.Add(P);
ThePnts.SetValue(i,P);
TheParams.SetValue(i,u);
TheIndex.SetValue(i,i);
u+=du;
i++;
}
while(i<=NbPts);
//-----------------------------------------------------
//--- Calcul d un majorant de fleche approche
//---
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:55 2003 Begin
// TheDeflection = 0.0000001;
TheDeflection = Min(0.0000001, Tol/100.);
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:56 2003 End
i=1;
u=D.FirstParameter();
u+=du * 0.5;
do {
gp_Pnt2d Pm = TheCurveTool::Value(C,u);
const gp_Pnt2d& P1 = ThePnts.Value(i);
const gp_Pnt2d& P2 = ThePnts.Value(i+1);
Standard_Real dx,dy;
dx=P1.X()-P2.X(); if(dx<0) dx=-dx;
dy=P1.Y()-P2.Y(); if(dy<0) dy=-dy;
if(dx+dy>1e-12) {
gp_Lin2d L(P1,gp_Dir2d(gp_Vec2d(P1,P2)));
Standard_Real t = L.Distance(Pm);
if(t>TheDeflection) {
TheDeflection = t;
}
}
u+=du;
i++;
}
while(i<NbPts);
myBox.Enlarge(TheDeflection*MAJORATION_DEFLECTION);
ClosedPolygon = Standard_False;
//-------------------------------------------------------
//-- On supprime les points alignes
//-- (Permet de diminuer le nombre total de points)
//-- (Dans le cas ou la courbe est "droite" )
Standard_Real DeflectionMaj = TheDeflection;
for(i=2;i<NbPntIn && NbPntIn>3;i++) {
Standard_Integer indexim1 = TheIndex.Value(i-1);
Standard_Integer indexi = TheIndex.Value(i);
Standard_Integer indexip1 = TheIndex.Value(i+1);
const gp_Pnt2d& Pim1 = ThePnts.Value(indexim1);
const gp_Pnt2d& Pi = ThePnts.Value(indexi);
const gp_Pnt2d& Pip1 = ThePnts.Value(indexip1);
Standard_Real dx,dy;
dx=Pim1.X()-Pip1.X(); if(dx<0) dx=-dx;
dy=Pim1.Y()-Pip1.Y(); if(dy<0) dy=-dy;
Standard_Real t=0;
if(dx+dy>1e-12) {
gp_Lin2d L(Pim1,gp_Dir2d(gp_Vec2d(Pim1,Pip1)));
t = L.Distance(Pi);
}
if(t<=DeflectionMaj) {
//-- On supprime le point i
for(Standard_Integer j = i; j<NbPntIn; j++) {
TheIndex.SetValue(j,TheIndex.Value(j+1));
}
NbPntIn--;
i--;
}
}
ComputeWithBox(C,BoxOtherPolygon);
}
//======================================================================
void IntCurve_Polygon2dGen::ComputeWithBox(const TheCurve& C,
const Bnd_Box2d& BoxOtherPolygon) {
if(myBox.IsOut(BoxOtherPolygon)) {
@@ -243,31 +139,23 @@ void IntCurve_Polygon2dGen::ComputeWithBox(const TheCurve& C,
const gp_Pnt2d& P2d = ThePnts.Value(TheIndex.Value(i));
Ri = CalculRegion(P2d.X(),P2d.Y(),bx0,bx1,by0,by1);
if((Ri & Rprec)==0) {
if(nbp) {
if(TheIndex.Value(nbp) != TheIndex.Value(i-1)) {
nbp++;
TheIndex.SetValue(nbp,TheIndex.Value(i-1));
}
}
else {
nbp++;
TheIndex.SetValue(nbp,TheIndex.Value(i-1));
}
nbp++;
TheIndex.SetValue(nbp,TheIndex.Value(i));
if(TheIndex.Value(i) > MaxIndexUsed) MaxIndexUsed = TheIndex.Value(i);
if(nbp) {
if(TheIndex.Value(nbp) != TheIndex.Value(i-1)) {
nbp++;
TheIndex.SetValue(nbp,TheIndex.Value(i-1));
}
}
else {
nbp++;
TheIndex.SetValue(nbp,TheIndex.Value(i-1));
}
nbp++;
TheIndex.SetValue(nbp,TheIndex.Value(i));
if(TheIndex.Value(i) > MaxIndexUsed) MaxIndexUsed = TheIndex.Value(i);
Rprec = Ri;
}
else {
if((Ri & Rprec)==0) {
nbp++;
TheIndex.SetValue(nbp,TheIndex.Value(i));
if(TheIndex.Value(i) > MaxIndexUsed) MaxIndexUsed = TheIndex.Value(i);
Rprec = Ri;
}//if((Ri & Rprec)==0) condition
Rprec = Ri;
}
}
Rprec = Ri;
}
if(nbp==1) {
@@ -418,7 +306,7 @@ void IntCurve_Polygon2dGen::Dump(void) const {
if(debug) {
Standard_Real bx0,bx1,by0,by1;
cout<<"\n ----- Dump de IntCurve_Polygon2dGen -----"<<endl;
cout<<"\n ----- Dump of IntCurve_Polygon2dGen -----"<<endl;
if(myBox.IsVoid()) {
cout<<" Polygone Vide "<<endl;
return;