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.
}
}
//
+ if(!aHatcher.IsDone(aIx))
+ {
+ iErr=2;
+ return iErr;
+ }
+
aNbDomains=aHatcher.NbDomains(aIx);
if (aNbDomains > 0) {
const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, 1);
GeomInt_IntSS_1.cxx
+GeomInt_VectorOfReal.hxx
\ No newline at end of file
IntSurf,
IntPatch,
- ApproxInt
+ ApproxInt,
+ Bnd
is
class IntSS;
+ imported VectorOfReal;
class LineConstructor;
Surface from Geom,
HSurface from GeomAdaptor,
TopolTool from Adaptor3d,
- Line from IntPatch
-
+ Line from IntPatch,
+ RLine from IntPatch,
+ Box2d from Bnd,
+ VectorOfReal from GeomInt
+
raises NotDone from StdFail,
OutOfRange from Standard
aTolCheck:out Real from Standard;
aTolAngCheck:out Real from Standard);
+ TreatRLine(myclass; theRL: RLine from IntPatch;
+ theHS1, theHS2: HSurface from GeomAdaptor;
+ theC3d: out Curve from Geom;
+ theC2d1, theC2d2: out Curve from Geom2d;
+ theTolReached: out Real from Standard);
+ ---Purpose: converts RLine to Geom(2d)_Curve.
+
+ BuildPCurves(myclass; f, l : Real from Standard;
+ Tol: out Real from Standard;
+ S: Surface from Geom;
+ C: Curve from Geom;
+ C2d: out Curve from Geom2d);
+ ---Purpose: creates 2D-curve on given surface from given 3D-curve
+
+ TrimILineOnSurfBoundaries(myclass; theC2d1, theC2d2: Curve from Geom2d;
+ theBound1, theBound2: Box2d from Bnd;
+ theArrayOfParameters: out VectorOfReal from GeomInt);
+ ---Purpose: puts into theArrayOfParameters the parameters of intersection
+ -- points of given theC2d1 and theC2d2 curves with the boundaries
+ -- of the source surface.
+
--- Private methods
--
--
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <algorithm>
+
#include <GeomInt_IntSS.ixx>
+#include <GeomInt.hxx>
+
#include <Precision.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <GeomInt_WLApprox.hxx>
#include <Extrema_ExtPS.hxx>
-static
- void BuildPCurves (Standard_Real f,
- Standard_Real l,
- Standard_Real& Tol,
- const Handle (Geom_Surface)& S,
- const Handle (Geom_Curve)& C,
- Handle (Geom2d_Curve)& C2d);
+#include <GeomAdaptor_HSurface.hxx>
+#include <gp_Lin2d.hxx>
+#include <Geom2d_Line.hxx>
+#include <IntPatch_RLine.hxx>
+#include <Geom2dAdaptor.hxx>
+#include <Adaptor2d_HCurve2d.hxx>
+#include <Approx_CurveOnSurface.hxx>
+#include <GeomAdaptor.hxx>
+#include <GeomProjLib.hxx>
+#include <GeomAPI_ProjectPointOnSurf.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TColgp_Array1OfPnt2d.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <Geom2d_BSplineCurve.hxx>
+#include <Geom2dAPI_InterCurveCurve.hxx>
+#include <IntRes2d_IntersectionPoint.hxx>
static
void Parameters(const Handle(GeomAdaptor_HSurface)& HS1,
void GetQuadric(const Handle(GeomAdaptor_HSurface)& HS1,
IntSurf_Quadric& quad1);
-static
- void TreatRLine(const Handle(IntPatch_RLine)& theRL,
- const Handle(GeomAdaptor_HSurface)& theHS1,
- const Handle(GeomAdaptor_HSurface)& theHS2,
- const Standard_Boolean theApprox1,
- const Standard_Boolean theApprox2,
- Handle(Geom_Curve)& theC3d,
- Handle(Geom2d_Curve)& theC2d1,
- Handle(Geom2d_Curve)& theC2d2,
- Standard_Real& theTolReached);
-
-//
-
-
class ProjectPointOnSurf
{
public:
//function : MakeCurve
//purpose :
//=======================================================================
- void GeomInt_IntSS::MakeCurve(const Standard_Integer Index,
- const Handle(Adaptor3d_TopolTool) & dom1,
- const Handle(Adaptor3d_TopolTool) & dom2,
- const Standard_Real Tol,
- const Standard_Boolean Approx,
- const Standard_Boolean ApproxS1,
- const Standard_Boolean ApproxS2)
+void GeomInt_IntSS::MakeCurve(const Standard_Integer Index,
+ const Handle(Adaptor3d_TopolTool) & dom1,
+ const Handle(Adaptor3d_TopolTool) & dom2,
+ const Standard_Real Tol,
+ const Standard_Boolean Approx,
+ const Standard_Boolean ApproxS1,
+ const Standard_Boolean ApproxS2)
{
Standard_Boolean myApprox1, myApprox2, myApprox;
default: break;
}
- if(!isAnalS1 || !isAnalS2)
+ Handle(IntPatch_RLine) RL =
+ Handle(IntPatch_RLine)::DownCast(L);
+ Handle(Geom_Curve) aC3d;
+ Handle(Geom2d_Curve) aC2d1, aC2d2;
+ Standard_Real aTolReached;
+ TreatRLine(RL, myHS1, myHS2, aC3d,
+ aC2d1, aC2d2, aTolReached);
+
+ if(aC3d.IsNull())
+ break;
+
+ Bnd_Box2d aBox1, aBox2;
+
+ const Standard_Real aU1f = myHS1->FirstUParameter(),
+ aV1f = myHS1->FirstVParameter(),
+ aU1l = myHS1->LastUParameter(),
+ aV1l = myHS1->LastVParameter();
+ const Standard_Real aU2f = myHS2->FirstUParameter(),
+ aV2f = myHS2->FirstVParameter(),
+ aU2l = myHS2->LastUParameter(),
+ aV2l = myHS2->LastVParameter();
+
+ aBox1.Add(gp_Pnt2d(aU1f, aV1f));
+ aBox1.Add(gp_Pnt2d(aU1l, aV1l));
+ aBox2.Add(gp_Pnt2d(aU2f, aV2f));
+ aBox2.Add(gp_Pnt2d(aU2l, aV2l));
+
+ GeomInt_VectorOfReal anArrayOfParameters;
+
+ //We consider here that the intersection line is same-parameter-line
+ anArrayOfParameters.Append(aC3d->FirstParameter());
+ anArrayOfParameters.Append(aC3d->LastParameter());
+
+ TrimILineOnSurfBoundaries(aC2d1, aC2d2, aBox1, aBox2, anArrayOfParameters);
+
+ const Standard_Integer aNbIntersSolutionsm1 = anArrayOfParameters.Length() - 1;
+
+ //Trim RLine found.
+ for(Standard_Integer anInd = 0; anInd < aNbIntersSolutionsm1; anInd++)
{
- Handle(IntPatch_RLine) RL =
- Handle(IntPatch_RLine)::DownCast(L);
- Handle(Geom_Curve) aC3d;
- Handle(Geom2d_Curve) aC2d1, aC2d2;
- Standard_Real aTolReached;
- TreatRLine(RL, myHS1, myHS2, myApprox1, myApprox2, aC3d,
- aC2d1, aC2d2, aTolReached);
- sline.Append(aC3d);
- slineS1.Append(aC2d1);
- slineS2.Append(aC2d2);
+ const Standard_Real aParF = anArrayOfParameters(anInd),
+ aParL = anArrayOfParameters(anInd+1);
+
+ if((aParL - aParF) <= Precision::PConfusion())
+ continue;
+
+ const Standard_Real aPar = 0.5*(aParF + aParL);
+ gp_Pnt2d aPt;
+
+ Handle(Geom2d_Curve) aCurv2d1, aCurv2d2;
+ if(!aC2d1.IsNull())
+ {
+ aC2d1->D0(aPar, aPt);
+
+ if(aBox1.IsOut(aPt))
+ continue;
+
+ if(myApprox1)
+ aCurv2d1 = new Geom2d_TrimmedCurve(aC2d1, aParF, aParL);
+ }
+
+ if(!aC2d2.IsNull())
+ {
+ aC2d2->D0(aPar, aPt);
+
+ if(aBox2.IsOut(aPt))
+ continue;
+
+ if(myApprox2)
+ aCurv2d2 = new Geom2d_TrimmedCurve(aC2d2, aParF, aParL);
+ }
+
+ Handle(Geom_Curve) aCurv3d = new Geom_TrimmedCurve(aC3d, aParF, aParL);
+
+ sline.Append(aCurv3d);
+ slineS1.Append(aCurv2d1);
+ slineS2.Append(aCurv2d2);
}
}
break;
-
}
}
//
//=======================================================================
//function : AdjustUPeriodic
//purpose :
-//=======================================================================
-void TreatRLine(const Handle(IntPatch_RLine)& theRL,
- const Handle(GeomAdaptor_HSurface)& theHS1,
- const Handle(GeomAdaptor_HSurface)& theHS2,
- const Standard_Boolean theApprox1,
- const Standard_Boolean theApprox2,
- Handle(Geom_Curve)& theC3d,
- Handle(Geom2d_Curve)& theC2d1,
- Handle(Geom2d_Curve)& theC2d2,
- Standard_Real& theTolReached)
-{
- Handle(GeomAdaptor_HSurface) aGAHS;
- Handle(Adaptor2d_HCurve2d) anAHC2d;
- Standard_Real tf, tl;
- gp_Lin2d aL;
- // It is assumed that 2d curve is 2d line (rectangular surface domain)
- if(theRL->IsArcOnS1())
- {
- aGAHS = theHS1;
- anAHC2d = theRL->ArcOnS1();
- theRL->ParamOnS1(tf, tl);
- theC2d1 = Geom2dAdaptor::MakeCurve(theRL->ArcOnS1()->Curve2d());
- }
- else if (theRL->IsArcOnS2())
- {
- aGAHS = theHS2;
- anAHC2d = theRL->ArcOnS2();
- theRL->ParamOnS2(tf, tl);
- theC2d2 = Geom2dAdaptor::MakeCurve(theRL->ArcOnS2()->Curve2d());
- }
- else
- {
- return;
- }
- //
- //To provide sameparameter it is necessary to get 3d curve as
- //approximation of curve on surface.
- Standard_Integer aMaxDeg = 8;
- Standard_Integer aMaxSeg = 1000;
- Approx_CurveOnSurface anApp(anAHC2d, aGAHS, tf, tl, Precision::Confusion(),
- GeomAbs_C1, aMaxDeg, aMaxSeg,
- Standard_True, Standard_False);
- if(anApp.HasResult())
- {
- theC3d = anApp.Curve3d();
- theTolReached = anApp.MaxError3d();
- Standard_Real aTol = Precision::Confusion();
- if(theRL->IsArcOnS1() && theApprox2)
- {
- Handle(Geom_Surface) aS = GeomAdaptor::MakeSurface(theHS1->Surface());
- BuildPCurves (tf, tl, aTol,
- aS, theC3d, theC2d2);
- }
- if(theRL->IsArcOnS2() && theApprox1)
- {
- Handle(Geom_Surface) aS = GeomAdaptor::MakeSurface(theHS2->Surface());
- BuildPCurves (tf, tl, aTol,
- aS, theC3d, theC2d1);
- }
- theTolReached = Max(theTolReached, aTol);
- }
- //
-
-}
-//
-//=======================================================================
-//function : AdjustUPeriodic
-//purpose :
//=======================================================================
void AdjustUPeriodic (const Handle(Geom_Surface)& aS, Handle(Geom2d_Curve)& aC2D)
{
//
//
//=======================================================================
-//function : BuildPCurves
-//purpose :
-//=======================================================================
- void BuildPCurves (Standard_Real f, Standard_Real l,
- Standard_Real& Tol,
- const Handle(Geom_Surface)& S,
- const Handle(Geom_Curve)& C,
- Handle(Geom2d_Curve)& C2d)
-{
- if (C2d.IsNull())
- {
- C2d = GeomProjLib::Curve2d(C,f,l,S,Tol);
- if (S->IsUPeriodic())
- {
- Standard_Real umin,umax,vmin,vmax;
- S->Bounds(umin,umax,vmin,vmax);
- // Recadre dans le domaine UV de la face
- const Standard_Real period = S->UPeriod();
- gp_Pnt2d Pf=C2d->Value(f);
- //
- Standard_Real U0=Pf.X();
- //
- const Standard_Real aEpsilon=Epsilon(10.);//1.77e-15
- if (fabs(U0)<aEpsilon)
- U0=0.;
- if (fabs(U0-period)<aEpsilon)
- U0=period;
- //
- const Standard_Real aEps=Precision::PConfusion();//1.e-9
- Standard_Real du=0.;
- while(U0 <(umin-aEps)) {
- U0+=period;
- du+=period;
- }
- while(U0>(umax+aEps)) {
- U0-=period;
- du-=period;
- }
- if (du!=0.) {
- gp_Vec2d T1(du, 0.);
- C2d->Translate(T1);
- }
- }
- }
-}
-//
-//=======================================================================
//function : GetQuadric
//purpose :
//=======================================================================
return Standard_False;
}
-/*
-static
- void DumpWLine (const Handle(IntPatch_WLine)& theWLine);
//=======================================================================
-//function : DumpWLine
+//function : TreatRLine
+//purpose : Approx of Restriction line
+//=======================================================================
+void GeomInt_IntSS::TreatRLine(const Handle(IntPatch_RLine)& theRL,
+ const Handle(GeomAdaptor_HSurface)& theHS1,
+ const Handle(GeomAdaptor_HSurface)& theHS2,
+ Handle(Geom_Curve)& theC3d,
+ Handle(Geom2d_Curve)& theC2d1,
+ Handle(Geom2d_Curve)& theC2d2,
+ Standard_Real& theTolReached)
+{
+ Handle(GeomAdaptor_HSurface) aGAHS;
+ Handle(Adaptor2d_HCurve2d) anAHC2d;
+ Standard_Real tf, tl;
+ gp_Lin2d aL;
+ // It is assumed that 2d curve is 2d line (rectangular surface domain)
+ if(theRL->IsArcOnS1())
+ {
+ aGAHS = theHS1;
+ anAHC2d = theRL->ArcOnS1();
+ theRL->ParamOnS1(tf, tl);
+ theC2d1 = Geom2dAdaptor::MakeCurve(anAHC2d->Curve2d());
+ }
+ else if (theRL->IsArcOnS2())
+ {
+ aGAHS = theHS2;
+ anAHC2d = theRL->ArcOnS2();
+ theRL->ParamOnS2(tf, tl);
+ theC2d2 = Geom2dAdaptor::MakeCurve(anAHC2d->Curve2d());
+ }
+ else
+ {
+ return;
+ }
+ //
+ //To provide sameparameter it is necessary to get 3d curve as
+ //approximation of curve on surface.
+ Standard_Integer aMaxDeg = 8;
+ Standard_Integer aMaxSeg = 1000;
+ Approx_CurveOnSurface anApp(anAHC2d, aGAHS, tf, tl, Precision::Confusion(),
+ GeomAbs_C1, aMaxDeg, aMaxSeg,
+ Standard_True, Standard_False);
+ if(!anApp.HasResult())
+ return;
+
+ theC3d = anApp.Curve3d();
+ theTolReached = anApp.MaxError3d();
+ Standard_Real aTol = Precision::Confusion();
+ if(theRL->IsArcOnS1())
+ {
+ Handle(Geom_Surface) aS = GeomAdaptor::MakeSurface(theHS2->Surface());
+ BuildPCurves (tf, tl, aTol,
+ aS, theC3d, theC2d2);
+ }
+ if(theRL->IsArcOnS2())
+ {
+ Handle(Geom_Surface) aS = GeomAdaptor::MakeSurface(theHS1->Surface());
+ BuildPCurves (tf, tl, aTol,
+ aS, theC3d, theC2d1);
+ }
+ theTolReached = Max(theTolReached, aTol);
+}
+
+//=======================================================================
+//function : BuildPCurves
//purpose :
//=======================================================================
- void DumpWLine (const Handle(IntPatch_WLine)& theWLine)
+void GeomInt_IntSS::BuildPCurves (Standard_Real f,
+ Standard_Real l,
+ Standard_Real& Tol,
+ const Handle (Geom_Surface)& S,
+ const Handle (Geom_Curve)& C,
+ Handle (Geom2d_Curve)& C2d)
{
- Standard_Integer i, nbp;
- Standard_Real u1,v1,u2,v2;
+ if (!C2d.IsNull()) {
+ return;
+ }
+ //
+ Standard_Real umin,umax,vmin,vmax;
+ //
+ S->Bounds(umin, umax, vmin, vmax);
+ // in class ProjLib_Function the range of parameters is shrank by 1.e-09
+ if((l - f) > 2.e-09) {
+ C2d = GeomProjLib::Curve2d(C,f,l,S,umin,umax,vmin,vmax,Tol);
+ //
+ if (C2d.IsNull()) {
+ // proj. a circle that goes through the pole on a sphere to the sphere
+ Tol += Precision::Confusion();
+ C2d = GeomProjLib::Curve2d(C,f,l,S,Tol);
+ }
+ }
+ else {
+ if((l - f) > Epsilon(Abs(f))) {
+ GeomAPI_ProjectPointOnSurf aProjector1, aProjector2;
+ gp_Pnt P1 = C->Value(f);
+ gp_Pnt P2 = C->Value(l);
+ aProjector1.Init(P1, S);
+ aProjector2.Init(P2, S);
+
+ if(aProjector1.IsDone() && aProjector2.IsDone()) {
+ Standard_Real U=0., V=0.;
+ aProjector1.LowerDistanceParameters(U, V);
+ gp_Pnt2d p1(U, V);
+
+ aProjector2.LowerDistanceParameters(U, V);
+ gp_Pnt2d p2(U, V);
+
+ if(p1.Distance(p2) > gp::Resolution()) {
+ TColgp_Array1OfPnt2d poles(1,2);
+ TColStd_Array1OfReal knots(1,2);
+ TColStd_Array1OfInteger mults(1,2);
+ poles(1) = p1;
+ poles(2) = p2;
+ knots(1) = f;
+ knots(2) = l;
+ mults(1) = mults(2) = 2;
+
+ C2d = new Geom2d_BSplineCurve(poles,knots,mults,1);
+
+ // compute reached tolerance.begin
+ gp_Pnt PMid = C->Value((f + l) * 0.5);
+ aProjector1.Perform(PMid);
+
+ if(aProjector1.IsDone()) {
+ aProjector1.LowerDistanceParameters(U, V);
+ gp_Pnt2d pmidproj(U, V);
+ gp_Pnt2d pmidcurve2d = C2d->Value((f + l) * 0.5);
+ Standard_Real adist = pmidcurve2d.Distance(pmidproj);
+ Tol = (adist > Tol) ? adist : Tol;
+ }
+ // compute reached tolerance.end
+ }
+ }
+ }
+ }
//
- nbp=theWLine->NbPnts();
- printf(" nbp=%d\n", nbp);
- for(i=1;i<=nbp;i++) {
- const IntSurf_PntOn2S& aPoint = theWLine->Point(i);
- const gp_Pnt& aP=aPoint.Value();
- aPoint.Parameters(u1,v1,u2,v2);
- printf("point i%d %lf %lf %lf [ %lf %lf ] [ %lf %lf ]\n",
- i, aP.X(), aP.Y(), aP.Z(), u1, v1, u2, v2);
+ if (S->IsUPeriodic() && !C2d.IsNull()) {
+ // Recadre dans le domaine UV de la face
+ Standard_Real aTm, U0, aEps, period, du, U0x;
+ Standard_Boolean bAdjust;
+ //
+ aEps = Precision::PConfusion();
+ period = S->UPeriod();
+ //
+ aTm = .5*(f + l);
+ gp_Pnt2d pm = C2d->Value(aTm);
+ U0 = pm.X();
+ //
+ bAdjust =
+ GeomInt::AdjustPeriodic(U0, umin, umax, period, U0x, du, aEps);
+ if (bAdjust) {
+ gp_Vec2d T1(du, 0.);
+ C2d->Translate(T1);
+ }
+ }
+}
+
+//=======================================================================
+//function : TrimILineOnSurfBoundaries
+//purpose : This function finds intersection points of given curves with
+// surface boundaries and fills theArrayOfParameters by parameters
+// along the given curves corresponding of these points.
+//=======================================================================
+void GeomInt_IntSS::TrimILineOnSurfBoundaries(const Handle(Geom2d_Curve)& theC2d1,
+ const Handle(Geom2d_Curve)& theC2d2,
+ const Bnd_Box2d& theBound1,
+ const Bnd_Box2d& theBound2,
+ GeomInt_VectorOfReal& theArrayOfParameters)
+{
+ //Rectangular boundaries of two surfaces: [0]:U=Ufirst, [1]:U=Ulast,
+ // [2]:V=Vfirst, [3]:V=Vlast
+ const Standard_Integer aNumberOfCurves = 4;
+ Handle(Geom2d_Curve) aCurS1Bounds[aNumberOfCurves];
+ Handle(Geom2d_Curve) aCurS2Bounds[aNumberOfCurves];
+
+ Standard_Real aU1f=0.0, aV1f=0.0, aU1l=0.0, aV1l=0.0;
+ Standard_Real aU2f=0.0, aV2f=0.0, aU2l=0.0, aV2l=0.0;
+
+ theBound1.Get(aU1f, aV1f, aU1l, aV1l);
+ theBound2.Get(aU2f, aV2f, aU2l, aV2l);
+
+ Standard_Real aDelta = aV1l-aV1f;
+ if(Abs(aDelta) > RealSmall())
+ {
+ if(!Precision::IsInfinite(aU1f))
+ {
+ aCurS1Bounds[0] = new Geom2d_Line(gp_Pnt2d(aU1f, aV1f), gp_Dir2d(0.0, 1.0));
+
+ if(!Precision::IsInfinite(aDelta))
+ aCurS1Bounds[0] = new Geom2d_TrimmedCurve(aCurS1Bounds[0], 0, aDelta);
+ }
+
+ if(!Precision::IsInfinite(aU1l))
+ {
+ aCurS1Bounds[1] = new Geom2d_Line(gp_Pnt2d(aU1l, aV1f), gp_Dir2d(0.0, 1.0));
+ if(!Precision::IsInfinite(aDelta))
+ aCurS1Bounds[1] = new Geom2d_TrimmedCurve(aCurS1Bounds[1], 0, aDelta);
+ }
+ }
+
+ aDelta = aU1l-aU1f;
+ if(Abs(aDelta) > RealSmall())
+ {
+ if(!Precision::IsInfinite(aV1f))
+ {
+ aCurS1Bounds[2] = new Geom2d_Line(gp_Pnt2d(aU1f, aV1f), gp_Dir2d(1.0, 0.0));
+ if(!Precision::IsInfinite(aDelta))
+ aCurS1Bounds[2] = new Geom2d_TrimmedCurve(aCurS1Bounds[2], 0, aDelta);
+ }
+
+ if(!Precision::IsInfinite(aV1l))
+ {
+ aCurS1Bounds[3] = new Geom2d_Line(gp_Pnt2d(aU1l, aV1l), gp_Dir2d(1.0, 0.0));
+ if(!Precision::IsInfinite(aDelta))
+ aCurS1Bounds[3] = new Geom2d_TrimmedCurve(aCurS1Bounds[3], 0, aDelta);
+ }
+ }
+
+ aDelta = aV2l-aV2f;
+ if(Abs(aDelta) > RealSmall())
+ {
+ if(!Precision::IsInfinite(aU2f))
+ {
+ aCurS2Bounds[0] = new Geom2d_Line(gp_Pnt2d(aU2f, aV2f), gp_Dir2d(0.0, 1.0));
+ if(!Precision::IsInfinite(aDelta))
+ aCurS2Bounds[0] = new Geom2d_TrimmedCurve(aCurS2Bounds[0], 0, aDelta);
+ }
+
+ if(!Precision::IsInfinite(aU2l))
+ {
+ aCurS2Bounds[1] = new Geom2d_Line(gp_Pnt2d(aU2l, aV2f), gp_Dir2d(0.0, 1.0));
+ if(!Precision::IsInfinite(aDelta))
+ aCurS2Bounds[1] = new Geom2d_TrimmedCurve(aCurS2Bounds[1], 0, aDelta);
+ }
+ }
+
+ aDelta = aU2l-aU2f;
+ if(Abs(aDelta) > RealSmall())
+ {
+ if(!Precision::IsInfinite(aV2f))
+ {
+ aCurS2Bounds[2] = new Geom2d_Line(gp_Pnt2d(aU2f, aV2f), gp_Dir2d(1.0, 0.0));
+ if(!Precision::IsInfinite(aDelta))
+ aCurS2Bounds[2] = new Geom2d_TrimmedCurve(aCurS2Bounds[2], 0, aDelta);
+ }
+
+ if(!Precision::IsInfinite(aV2l))
+ {
+ aCurS2Bounds[3] = new Geom2d_Line(gp_Pnt2d(aU2l, aV2l), gp_Dir2d(1.0, 0.0));
+ if(!Precision::IsInfinite(aDelta))
+ aCurS2Bounds[3] = new Geom2d_TrimmedCurve(aCurS2Bounds[3], 0, aDelta);
+ }
+ }
+
+ Geom2dAPI_InterCurveCurve anIntCC2d;
+
+ if(!theC2d1.IsNull())
+ {
+ for(Standard_Integer aCurID = 0; aCurID < aNumberOfCurves; aCurID++)
+ {
+ if(aCurS1Bounds[aCurID].IsNull())
+ continue;
+
+ anIntCC2d.Init(theC2d1, aCurS1Bounds[aCurID]);
+
+ for (Standard_Integer aPntID = 1; aPntID <= anIntCC2d.NbPoints(); aPntID++)
+ {
+ const Standard_Real aParam = anIntCC2d.Intersector().Point(aPntID).ParamOnFirst();
+ theArrayOfParameters.Append(aParam);
+ }
+
+ for (Standard_Integer aSegmID = 1; aSegmID <= anIntCC2d.NbSegments(); aSegmID++)
+ {
+ Handle(Geom2d_Curve) aCS, aCSTemp;
+ anIntCC2d.Segment(aSegmID, aCS, aCSTemp);
+ theArrayOfParameters.Append(aCS->FirstParameter());
+ theArrayOfParameters.Append(aCS->LastParameter());
+ }
+ }
}
+
+ if(!theC2d2.IsNull())
+ {
+ for(Standard_Integer aCurID = 0; aCurID < aNumberOfCurves; aCurID++)
+ {
+ if(aCurS2Bounds[aCurID].IsNull())
+ continue;
+
+ anIntCC2d.Init(theC2d2, aCurS2Bounds[aCurID]);
+
+ for (Standard_Integer aPntID = 1; aPntID <= anIntCC2d.NbPoints(); aPntID++)
+ {
+ const Standard_Real aParam = anIntCC2d.Intersector().Point(aPntID).ParamOnFirst();
+ theArrayOfParameters.Append(aParam);
+ }
+
+ for (Standard_Integer aSegmID = 1; aSegmID <= anIntCC2d.NbSegments(); aSegmID++)
+ {
+ Handle(Geom2d_Curve) aCS, aCSTemp;
+ anIntCC2d.Segment(aSegmID, aCS, aCSTemp);
+ theArrayOfParameters.Append(aCS->FirstParameter());
+ theArrayOfParameters.Append(aCS->LastParameter());
+ }
+ }
+ }
+
+ std::sort(theArrayOfParameters.begin(), theArrayOfParameters.end());
}
-*/
--- /dev/null
+// Created on: 2015-02-18
+// Created by: Nikolai BUKHALOV
+// Copyright (c) 2003-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.
+
+#ifndef GeomInt_VectorOfReal_HeaderFile
+#define GeomInt_VectorOfReal_HeaderFile
+
+#include <NCollection_Vector.hxx>
+
+typedef NCollection_Vector<Standard_Real> GeomInt_VectorOfReal;
+
+#endif
\ No newline at end of file
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;
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
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;
#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,
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,
}
}
+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
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();
} //-- 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++)
}
//purpose :
//=======================================================================
IntPatch_ImpImpIntersection::IntPatch_ImpImpIntersection ():
- done(Standard_False)
+ done(Standard_False)
{
}
//=======================================================================
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
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();
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 {
#define No_Standard_OutOfRange
#endif
-
#include <math_Vector.hxx>
#include <math_Matrix.hxx>
#include <TopTrans_CurveTransition.hxx>
#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,
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 :
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;
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();
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));
}
}
}
//
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();
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);
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);
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);
}
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()) {
// 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())
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);
}
}
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);
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) {
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);
}
}// 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;
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))
{
return;
slin.Clear();
- for(i = 1; i <= dslin.Length(); i++ )
+ for(Standard_Integer i = 1; i <= dslin.Length(); i++ )
slin.Append(dslin(i));
}
}
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;
}
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;
}
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;
}
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;
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;
}
-*/
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;
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;
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;
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;
{
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
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)
{
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();
else
{
GeomGeomPerfom(theS1, theD1, theS2, theD2,
- theTolArc, theTolTang, theListOfPnts, RestrictLine, theTyps1, theTyps2);
+ theTolArc, theTolTang, theListOfPnts,
+ RestrictLine, theTyps1, theTyps2, theIsReqToKeepRLine);
}
}
HVertex from Adaptor3d,
HCurve2d from Adaptor2d,
PntOn2S from IntSurf,
- Line from IntPatch,
Transition from IntSurf,
Pnt from gp
--- /dev/null
+-- 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;
--- /dev/null
+// 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)
+{}
+
+
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.
#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;
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;
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;
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.
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;
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;
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;
#include <Geom2dAPI_InterCurveCurve.hxx>
#include <Geom2dInt_GInter.hxx>
+#include <Geom2dAdaptor.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <IntSurf_ListIteratorOfListOfPntOn2S.hxx>
#include <GeomInt.hxx>
+#include <Approx_CurveOnSurface.hxx>
+#include <GeomAdaptor.hxx>
+#include <GeomInt_IntSS.hxx>
+
static
void RefineVector(gp_Vec2d& aV2D);
#ifdef OCCT_DEBUG_DUMPWLINE
Standard_Real&,
Standard_Real&);
-static
- void BuildPCurves (Standard_Real f,Standard_Real l,Standard_Real& Tol,
- const Handle (Geom_Surface)& S,
- const Handle (Geom_Curve)& C,
- Handle (Geom2d_Curve)& C2d);
-
static
void CorrectSurfaceBoundaries(const TopoDS_Face& theFace,
const Standard_Real theTolerance,
Standard_Real& theumax,
Standard_Real& thevmin,
Standard_Real& thevmax);
+
static
Standard_Boolean NotUseSurfacesForApprox
(const TopoDS_Face& aF1,
bAvoidLineConstructor = Standard_False;
}
}
+
+ typl=L->ArcType();
+
//
// Line Constructor
if(!bAvoidLineConstructor) {
myLConstruct.Perform(L);
//
bDone=myLConstruct.IsDone();
- aNbParts=myLConstruct.NbParts();
- if (!bDone|| !aNbParts) {
+ if(!bDone)
+ {
return;
}
+
+ if(typl != IntPatch_Restriction)
+ {
+ aNbParts=myLConstruct.NbParts();
+ if (aNbParts <= 0)
+ {
+ return;
+ }
+ }
}
- //
// Do the Curve
- //
+
+
switch (typl) {
//########################################
// Line, Parabola, Hyperbola
Standard_Boolean bFNIt, bLPIt;
//
myLConstruct.Part(i, fprm, lprm);
- //
+ //
bFNIt=Precision::IsNegativeInfinite(fprm);
bLPIt=Precision::IsPositiveInfinite(lprm);
//
aCurve.SetCurve(new Geom_TrimmedCurve(newc, fprm, lprm));
if(myApprox1) {
Handle (Geom2d_Curve) C2d;
- BuildPCurves(fprm, lprm, Tolpc, myHS1->ChangeSurface().Surface(), newc, C2d);
+ GeomInt_IntSS::BuildPCurves(fprm, lprm, Tolpc,
+ myHS1->ChangeSurface().Surface(), newc, C2d);
if(Tolpc>myTolReached2d || myTolReached2d==0.) {
myTolReached2d=Tolpc;
}
//
if(myApprox2) {
Handle (Geom2d_Curve) C2d;
- BuildPCurves(fprm,lprm,Tolpc,myHS2->ChangeSurface().Surface(),newc,C2d);
+ GeomInt_IntSS::BuildPCurves(fprm, lprm, Tolpc,
+ myHS2->ChangeSurface().Surface(), newc, C2d);
if(Tolpc>myTolReached2d || myTolReached2d==0.) {
myTolReached2d=Tolpc;
}
if (typl == IntPatch_Circle || typl == IntPatch_Ellipse) {////
if(myApprox1) {
Handle (Geom2d_Curve) C2d;
- BuildPCurves(fprm,lprm,Tolpc,myHS1->ChangeSurface().Surface(),newc,C2d);
+ GeomInt_IntSS::BuildPCurves(fprm, lprm, Tolpc,
+ myHS1->ChangeSurface().Surface(), newc, C2d);
if(Tolpc>myTolReached2d || myTolReached2d==0) {
myTolReached2d=Tolpc;
}
if(myApprox2) {
Handle (Geom2d_Curve) C2d;
- BuildPCurves(fprm,lprm,Tolpc,myHS2->ChangeSurface().Surface(),newc,C2d);
+ GeomInt_IntSS::BuildPCurves(fprm,lprm,Tolpc,
+ myHS2->ChangeSurface().Surface(),newc,C2d);
if(Tolpc>myTolReached2d || myTolReached2d==0) {
myTolReached2d=Tolpc;
}
if(myApprox1) {
Handle (Geom2d_Curve) C2d;
- BuildPCurves(fprm,lprm,Tolpc,myHS1->ChangeSurface().Surface(),newc,C2d);
+ GeomInt_IntSS::BuildPCurves(fprm,lprm,Tolpc,
+ myHS1->ChangeSurface().Surface(),newc,C2d);
if(Tolpc>myTolReached2d || myTolReached2d==0) {
myTolReached2d=Tolpc;
}
if(myApprox2) {
Handle (Geom2d_Curve) C2d;
- BuildPCurves(fprm,lprm,Tolpc,myHS2->ChangeSurface().Surface(),newc,C2d);
+ GeomInt_IntSS::BuildPCurves(fprm,lprm,Tolpc,
+ myHS2->ChangeSurface().Surface(),newc,C2d);
if(Tolpc>myTolReached2d || myTolReached2d==0) {
myTolReached2d=Tolpc;
}
if(myApprox1) {
Handle (Geom2d_Curve) C2d;
- BuildPCurves(fprm, lprm, Tolpc, myHS1->ChangeSurface().Surface(), newc, C2d);
+ GeomInt_IntSS::BuildPCurves(fprm, lprm, Tolpc,
+ myHS1->ChangeSurface().Surface(), newc, C2d);
if(Tolpc>myTolReached2d || myTolReached2d==0) {
myTolReached2d=Tolpc;
}
if(myApprox2) {
Handle (Geom2d_Curve) C2d;
- BuildPCurves(fprm, lprm, Tolpc,myHS2->ChangeSurface().Surface(), newc, C2d);
+ GeomInt_IntSS::BuildPCurves(fprm, lprm, Tolpc,
+ myHS2->ChangeSurface().Surface(), newc, C2d);
if(Tolpc>myTolReached2d || myTolReached2d==0) {
myTolReached2d=Tolpc;
}
Handle(Geom2d_Curve) C2d;
Standard_Real aTol = myTolApprox;
- BuildPCurves(fprm, lprm, aTol, myHS1->ChangeSurface().Surface(), BS, C2d);
+ GeomInt_IntSS::BuildPCurves(fprm, lprm, aTol,
+ myHS1->ChangeSurface().Surface(), BS, C2d);
BS1 = Handle(Geom2d_BSplineCurve)::DownCast(C2d);
aCurve.SetFirstCurve2d(BS1);
}
Handle(Geom2d_Curve) C2d;
Standard_Real aTol = myTolApprox;
- BuildPCurves(fprm, lprm, aTol, myHS2->ChangeSurface().Surface(), BS, C2d);
+ GeomInt_IntSS::BuildPCurves(fprm, lprm, aTol,
+ myHS2->ChangeSurface().Surface(), BS, C2d);
BS2 = Handle(Geom2d_BSplineCurve)::DownCast(C2d);
aCurve.SetSecondCurve2d(BS2);
}
break;
case IntPatch_Restriction:
- break;
- default:
- break;
+ {
+ GeomAbs_SurfaceType typS1 = myHS1->Surface().GetType();
+ GeomAbs_SurfaceType typS2 = myHS2->Surface().GetType();
+ Standard_Boolean isAnalS1 = Standard_False;
+ switch (typS1)
+ {
+ case GeomAbs_Plane:
+ case GeomAbs_Cylinder:
+ case GeomAbs_Sphere:
+ case GeomAbs_Cone:
+ case GeomAbs_Torus: isAnalS1 = Standard_True; break;
+ default: break;
+ }
- }
-}
+ Standard_Integer isAnalS2 = Standard_False;
+ switch (typS2)
+ {
+ case GeomAbs_Plane:
+ case GeomAbs_Cylinder:
+ case GeomAbs_Sphere:
+ case GeomAbs_Cone:
+ case GeomAbs_Torus: isAnalS2 = Standard_True; break;
+ default: break;
+ }
-//=======================================================================
-//function : BuildPCurves
-//purpose :
-//=======================================================================
-void BuildPCurves (Standard_Real f,
- Standard_Real l,
- Standard_Real& Tol,
- const Handle (Geom_Surface)& S,
- const Handle (Geom_Curve)& C,
- Handle (Geom2d_Curve)& C2d)
-{
- if (!C2d.IsNull()) {
- return;
- }
- //
- Standard_Real umin,umax,vmin,vmax;
- //
- S->Bounds(umin, umax, vmin, vmax);
- // in class ProjLib_Function the range of parameters is shrank by 1.e-09
- if((l - f) > 2.e-09) {
- C2d = GeomProjLib::Curve2d(C,f,l,S,umin,umax,vmin,vmax,Tol);
- //
- if (C2d.IsNull()) {
- // proj. a circle that goes through the pole on a sphere to the sphere
- Tol += Precision::Confusion();
- C2d = GeomProjLib::Curve2d(C,f,l,S,Tol);
- }
- }
- else {
- if((l - f) > Epsilon(Abs(f))) {
- GeomAPI_ProjectPointOnSurf aProjector1, aProjector2;
- gp_Pnt P1 = C->Value(f);
- gp_Pnt P2 = C->Value(l);
- aProjector1.Init(P1, S);
- aProjector2.Init(P2, S);
-
- if(aProjector1.IsDone() && aProjector2.IsDone()) {
- Standard_Real U=0., V=0.;
- aProjector1.LowerDistanceParameters(U, V);
- gp_Pnt2d p1(U, V);
-
- aProjector2.LowerDistanceParameters(U, V);
- gp_Pnt2d p2(U, V);
+ Handle(IntPatch_RLine) RL =
+ Handle(IntPatch_RLine)::DownCast(L);
+ Handle(Geom_Curve) aC3d;
+ Handle(Geom2d_Curve) aC2d1, aC2d2;
+ Standard_Real aTolReached;
+ GeomInt_IntSS::TreatRLine(RL, myHS1, myHS2, aC3d,
+ aC2d1, aC2d2, aTolReached);
+
+ if(aC3d.IsNull())
+ break;
+
+ Bnd_Box2d aBox1, aBox2;
+
+ const Standard_Real aU1f = myHS1->FirstUParameter(),
+ aV1f = myHS1->FirstVParameter(),
+ aU1l = myHS1->LastUParameter(),
+ aV1l = myHS1->LastVParameter();
+ const Standard_Real aU2f = myHS2->FirstUParameter(),
+ aV2f = myHS2->FirstVParameter(),
+ aU2l = myHS2->LastUParameter(),
+ aV2l = myHS2->LastVParameter();
+
+ aBox1.Add(gp_Pnt2d(aU1f, aV1f));
+ aBox1.Add(gp_Pnt2d(aU1l, aV1l));
+ aBox2.Add(gp_Pnt2d(aU2f, aV2f));
+ aBox2.Add(gp_Pnt2d(aU2l, aV2l));
+
+ GeomInt_VectorOfReal anArrayOfParameters;
- if(p1.Distance(p2) > gp::Resolution()) {
- TColgp_Array1OfPnt2d poles(1,2);
- TColStd_Array1OfReal knots(1,2);
- TColStd_Array1OfInteger mults(1,2);
- poles(1) = p1;
- poles(2) = p2;
- knots(1) = f;
- knots(2) = l;
- mults(1) = mults(2) = 2;
-
- C2d = new Geom2d_BSplineCurve(poles,knots,mults,1);
-
- // compute reached tolerance.begin
- gp_Pnt PMid = C->Value((f + l) * 0.5);
- aProjector1.Perform(PMid);
-
- if(aProjector1.IsDone()) {
- aProjector1.LowerDistanceParameters(U, V);
- gp_Pnt2d pmidproj(U, V);
- gp_Pnt2d pmidcurve2d = C2d->Value((f + l) * 0.5);
- Standard_Real adist = pmidcurve2d.Distance(pmidproj);
- Tol = (adist > Tol) ? adist : Tol;
- }
- // compute reached tolerance.end
+ //We consider here that the intersection line is same-parameter-line
+ anArrayOfParameters.Append(aC3d->FirstParameter());
+ anArrayOfParameters.Append(aC3d->LastParameter());
+
+ GeomInt_IntSS::
+ TrimILineOnSurfBoundaries(aC2d1, aC2d2, aBox1, aBox2, anArrayOfParameters);
+
+ const Standard_Integer aNbIntersSolutionsm1 = anArrayOfParameters.Length() - 1;
+
+ //Trim RLine found.
+ for(Standard_Integer anInd = 0; anInd < aNbIntersSolutionsm1; anInd++)
+ {
+ const Standard_Real aParF = anArrayOfParameters(anInd),
+ aParL = anArrayOfParameters(anInd+1);
+
+ if((aParL - aParF) <= Precision::PConfusion())
+ continue;
+
+ const Standard_Real aPar = 0.5*(aParF + aParL);
+ gp_Pnt2d aPt;
+
+ Handle(Geom2d_Curve) aCurv2d1, aCurv2d2;
+ if(!aC2d1.IsNull())
+ {
+ aC2d1->D0(aPar, aPt);
+
+ if(aBox1.IsOut(aPt))
+ continue;
+
+ if(myApprox1)
+ aCurv2d1 = new Geom2d_TrimmedCurve(aC2d1, aParF, aParL);
+ }
+
+ if(!aC2d2.IsNull())
+ {
+ aC2d2->D0(aPar, aPt);
+
+ if(aBox2.IsOut(aPt))
+ continue;
+
+ if(myApprox2)
+ aCurv2d2 = new Geom2d_TrimmedCurve(aC2d2, aParF, aParL);
}
+
+ Handle(Geom_Curve) aCurv3d = new Geom_TrimmedCurve(aC3d, aParF, aParL);
+
+ IntTools_Curve aIC(aCurv3d, aCurv2d1, aCurv2d2);
+ mySeqOfCurve.Append(aIC);
}
}
- }
- //
- if (S->IsUPeriodic() && !C2d.IsNull()) {
- // Recadre dans le domaine UV de la face
- Standard_Real aTm, U0, aEps, period, du, U0x;
- Standard_Boolean bAdjust;
- //
- aEps = Precision::PConfusion();
- period = S->UPeriod();
- //
- aTm = .5*(f + l);
- gp_Pnt2d pm = C2d->Value(aTm);
- U0 = pm.X();
- //
- bAdjust =
- GeomInt::AdjustPeriodic(U0, umin, umax, period, U0x, du, aEps);
- if (bAdjust) {
- gp_Vec2d T1(du, 0.);
- C2d->Translate(T1);
- }
+ break;
+ default:
+ break;
+
}
}
//
if(!isuperiodic && enlarge) {
- if((theumin - uinf) > delta )
+ if(!Precision::IsInfinite(theumin) &&
+ ((theumin - uinf) > delta))
theumin -= delta;
else {
theumin = uinf;
}
- if((usup - theumax) > delta )
+ if(!Precision::IsInfinite(theumax) &&
+ ((usup - theumax) > delta))
theumax += delta;
else
theumax = usup;
}
//
if(!isvperiodic && enlarge) {
- if((thevmin - vinf) > delta ) {
+ if(!Precision::IsInfinite(thevmin) &&
+ ((thevmin - vinf) > delta)) {
thevmin -= delta;
}
else {
thevmin = vinf;
}
- if((vsup - thevmax) > delta ) {
+ if(!Precision::IsInfinite(thevmax) &&
+ ((vsup - thevmax) > delta)) {
thevmax += delta;
}
else {
#endif
myIntersector.SetTolerances(myTol1,myTol2,MaxUV,Deflection);
- myIntersector.Perform(mySurface1,myDomain1,mySurface2,myDomain2,myTol1,myTol2);
+ myIntersector.Perform(mySurface1,myDomain1,mySurface2,myDomain2,
+ myTol1,myTol2,Standard_True,Standard_True);
#ifdef OCCT_DEBUG
if (TopOpeBRepTool_GettraceKRO()) KRO_DSFILLER_INTFF.Stop();
inline Standard_Real gp_Lin2d::SquareDistance (const gp_Lin2d& Other) const
{
Standard_Real D = 0.0;
- if (pos.IsParallel (Other.pos, gp::Resolution())) {
- D = Other.Distance(pos.Location());
- D *= D;return D * D;
- }
+ if (pos.IsParallel (Other.pos, gp::Resolution()))
+ D = Other.SquareDistance(pos.Location());
return D;
}
bop a b
bopsection result
-set length 546.82
+set length 530.82
restore [locate_data_file CIN001_b15.rle] b
bsection result a b
-set length 546.82
+set length 530.82
# Wrong intersection curves obtained for a surface of revolution and a plane.
##############################################################
+set GoodNbCurv 1
+
restore [locate_data_file bug24650_fz1365.brep] b1
restore [locate_data_file bug24650_fz2495.brep] b2
mksurface sb2 b2
trimu sb1tu sb1 0.242 0.291
-set N [intersect i sb1tu sb2]
+clear
+
+set N [intersect res sb1tu sb2]
+
+set che [whatis res]
+set ind [string first "3d curve" $che]
+if {${ind} >= 0} {
+ #Only variable "res" exists
+ renamevar res res_1
+}
+
+
+set ic 1
+set AllowRepeate 1
+while { $AllowRepeate != 0 } {
+ set che [whatis res_$ic]
+ set ind [string first "3d curve" $che]
+ if {${ind} < 0} {
+ set AllowRepeate 0
+ } else {
+ display res_$ic
+
+ bounds res_$ic U1 U2
+
+ dval U1
+ dval U2
+
+ if {[dval U2-U1] < 1.0e-20} {
+ puts "Error: Wrong curve's range!"
+ }
+
+ dlog reset
+ dlog on
+ xdistcs res_$ic sb1tu U1 U2 10
+ set Log1 [dlog get]
+ set List1 [split ${Log1} {TD= \t\n}]
+ set Tolerance 1.0e-7
+ set Limit_Tol 1.0e-7
+ set D_good 0.
+ checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
+
+ dlog reset
+ dlog on
+ xdistcs res_$ic sb2 U1 U2 10
+ set Log1 [dlog get]
+ set List1 [split ${Log1} {TD= \t\n}]
+ set Tolerance 1.0e-7
+ set Limit_Tol 1.0e-7
+ set D_good 0.
+ checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
+
+ incr ic
+ }
+}
-if { [llength ${N}] != 1} {
- puts "Error : Wrong intersection curves"
+if {[expr {$ic - 1}] == $GoodNbCurv} {
+ puts "OK: Curve Number is good!"
} else {
- set info1 [dump i]
- set type_of_curve "BSplineCurve"
- if { [regexp ${type_of_curve} ${info1}] != 1 } {
- puts "Error : Wrong type of intersection curve"
- } else {
- puts "OK : Good type of intersection curve"
- }
+ puts "Error: Curve Number is bad!"
}
smallview
-donly i
fit
set only_screen_axo 1
-
--- /dev/null
+puts "================"
+puts "OCC25416"
+puts "================"
+puts ""
+#######################################################################
+# Wrong section curve
+#######################################################################
+
+# Check if list of xdistcs-command is valid
+proc checkList {List Tolerance D_good Limit_Tol} {
+ set L1 [llength ${List}]
+ set L2 10
+ set L3 5
+ set N [expr (${L1} - ${L2})/${L3} + 1]
+
+ for {set i 1} {${i} <= ${N}} {incr i} {
+ set j1 [expr ${L2} + (${i}-1)*${L3}]
+ set j2 [expr ${j1} + 2]
+ set T [lindex ${List} ${j1}]
+ set D [lindex ${List} ${j2}]
+ #puts "i=${i} j1=${j1} j2=${j2} T=${T} D=${D}"
+ if { [expr abs(${D} - ${D_good})] > ${Tolerance} } {
+ puts "Error: T=${T} D=${D}"
+ }
+
+ if { ${Tolerance} > ${Limit_Tol} } {
+ if { [expr abs(${D} - ${D_good})] > ${Limit_Tol}
+ && [expr abs(${D} - ${D_good})] <= ${Tolerance} } {
+ puts "Attention (critical value of tolerance) : T=${T} D=${D}"
+ }
+ }
+ }
+}
+
+
+puts "##############################"
+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
+puts "##############################"
+puts ""
+puts ""
+
+# bopcurves command
+
+restore [locate_data_file bug25416_f1.brep] f1
+restore [locate_data_file bug25416_f2.brep] f2
+
+#############################
+set log [bopcurves f1 f2 -2d]
+#############################
+
+regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
+
+#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid.
+set MaxTol 1.e-7
+
+#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid.
+set GoodNbCurv 1
+
+if {${Toler} > ${MaxTol}} {
+ puts "Error: Tolerance is too big!"
+}
+if {${NbCurv} != ${GoodNbCurv}} {
+ puts "Error: Curve Number is bad!"
+}
+
+#-------------
+
+mksurface s1 f1
+mksurface s2 f2
+
+erase s1 s2
+
+for {set i 1} {$i <= ${NbCurv}} {incr i} {
+ set log [dump c_$i]
+ set dumptrimres [regexp {Trimmed curve\nParameters : +([-0-9.+eE]+) +([-0-9.+eE]+)} ${log} full U1 U2]
+
+ if {${dumptrimres} == 0} {
+ regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
+
+ puts "Degree=${Degree}"
+ puts "Poles=${Poles}"
+ puts "KnotsPoles=${KnotsPoles}"
+ puts ""
+
+ set Knot 1
+ set exp_string "Knots :\n\n +${Knot} : +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
+ regexp ${exp_string} ${log} full U1 Mult1
+
+ set Knot ${KnotsPoles}
+ set exp_string " +${Knot} : +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
+ regexp ${exp_string} ${log} full U2 Mult2
+ }
+
+ puts "U1=${U1}"
+ puts "U2=${U2}"
+
+ if {[expr {$U2 - $U1}] < 1.0e-20} {
+ puts "Error: Wrong curve's range!"
+ }
+
+ dlog reset
+ dlog on
+ xdistcs c_$i s1 ${U1} ${U2} 10
+ set Log2 [dlog get]
+ set List2 [split ${Log2} {TD= \t\n}]
+ set Tolerance 1.0e-7
+ set Limit_Tol 1.0e-7
+ set D_good 0.
+ checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
+
+ dlog reset
+ dlog on
+ xdistcs c_$i s2 ${U1} ${U2} 10
+ set Log2 [dlog get]
+ set List2 [split ${Log2} {TD= \t\n}]
+ set Tolerance 1.0e-7
+ set Limit_Tol 1.0e-7
+ set D_good 0.
+ checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
+}
+
+smallview
+fit
+set only_screen_axo 1
--- /dev/null
+puts "================"
+puts "OCC25416"
+puts "================"
+puts ""
+#######################################################################
+# Wrong section curve
+#######################################################################
+
+# Check if list of xdistcs-command is valid
+proc checkList {List Tolerance D_good Limit_Tol} {
+ set L1 [llength ${List}]
+ set L2 10
+ set L3 5
+ set N [expr (${L1} - ${L2})/${L3} + 1]
+
+ for {set i 1} {${i} <= ${N}} {incr i} {
+ set j1 [expr ${L2} + (${i}-1)*${L3}]
+ set j2 [expr ${j1} + 2]
+ set T [lindex ${List} ${j1}]
+ set D [lindex ${List} ${j2}]
+ #puts "i=${i} j1=${j1} j2=${j2} T=${T} D=${D}"
+ if { [expr abs(${D} - ${D_good})] > ${Tolerance} } {
+ puts "Error: T=${T} D=${D}"
+ }
+
+ if { ${Tolerance} > ${Limit_Tol} } {
+ if { [expr abs(${D} - ${D_good})] > ${Limit_Tol}
+ && [expr abs(${D} - ${D_good})] <= ${Tolerance} } {
+ puts "Attention (critical value of tolerance) : T=${T} D=${D}"
+ }
+ }
+ }
+}
+
+puts "##############################"
+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
+puts "##############################"
+puts ""
+puts ""
+
+# bopcurves command
+
+restore [locate_data_file bug25416_f3.brep] f1
+restore [locate_data_file bug25416_f4.brep] f2
+
+mksurface s1 f1
+mksurface s2 f2
+
+#Trim according to "xbounds f1"
+trim s1 s1 -55.44 150.554 -98.1087 79.1766
+
+mkface ff1 s1
+donly ff1 f2
+
+#############################
+set log [bopcurves ff1 f2]
+#############################
+
+regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
+
+#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid.
+set MaxTol 1.e-7
+
+#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid.
+set GoodNbCurv 2
+
+if {${Toler} > ${MaxTol}} {
+ puts "Error: Tolerance is too big!"
+}
+if {${NbCurv} != ${GoodNbCurv}} {
+ puts "Error: Curve Number is bad!"
+}
+
+#-------------
+
+for {set i 1} {$i <= ${NbCurv}} {incr i} {
+ set log [dump c_$i]
+ set dumptrimres [regexp {Trimmed curve\nParameters : +([-0-9.+eE]+) +([-0-9.+eE]+)} ${log} full U1 U2]
+
+ if {${dumptrimres} == 0} {
+ regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
+
+ puts "Degree=${Degree}"
+ puts "Poles=${Poles}"
+ puts "KnotsPoles=${KnotsPoles}"
+ puts ""
+
+ set Knot 1
+ set exp_string "Knots :\n\n +${Knot} : +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
+ regexp ${exp_string} ${log} full U1 Mult1
+
+ set Knot ${KnotsPoles}
+ set exp_string " +${Knot} : +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
+ regexp ${exp_string} ${log} full U2 Mult2
+ }
+
+ puts "U1=${U1}"
+ puts "U2=${U2}"
+
+ if {[expr {$U2 - $U1}] < 1.0e-20} {
+ puts "Error: Wrong curve's range!"
+ }
+
+ dlog reset
+ dlog on
+ xdistcs c_$i s1 ${U1} ${U2} 10
+ set Log2 [dlog get]
+ set List2 [split ${Log2} {TD= \t\n}]
+ set Tolerance 1.0e-7
+ set Limit_Tol 1.0e-7
+ set D_good 0.
+ checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
+
+ dlog reset
+ dlog on
+ xdistcs c_$i s2 ${U1} ${U2} 10
+ set Log2 [dlog get]
+ set List2 [split ${Log2} {TD= \t\n}]
+ set Tolerance 1.0e-7
+ set Limit_Tol 1.0e-7
+ set D_good 0.
+ checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
+}
+
+smallview
+fit
+set only_screen_axo 1
--- /dev/null
+puts "================"
+puts "OCC25416"
+puts "================"
+puts ""
+#######################################################################
+# Wrong section curve
+#######################################################################
+
+#Check if intersection algorithm produces overlapped curves
+
+restore [locate_data_file bug25416_s1.brep] s1
+restore [locate_data_file bug25416_s2.brep] s2
+
+set ll [intersect ii s1 s2]
+
+set status 0
+if { [llength $ll] < 1 } {
+ set status 1
+}
+
+foreach i $ll {
+ foreach j $ll {
+ if { $i >= $j } continue
+
+ decho off
+ mkedge e1 $i
+ mkedge e2 $j
+ set coe [checkoverlapedges e1 e2]
+ decho on
+
+ puts "$i<->$j: $coe"
+ if { [regexp "Edges is not overlaped" $coe] != 1 } {
+ set status 2
+ }
+ }
+}
+
+decho on
+
+if { $status != 0 } {
+ puts "Wrong section. Error with code $status"
+} else {
+ puts "OK: Good section"
+}