sprintf(name, "bc2d_%d_%d", indc, nbbc);
DrawTrSurf::Set(name, theBezier2d);
#endif
- gp_Vec2d FirstVec, SecondVec;
- FirstVec = gp_Vec2d(aPoles2d(1), aPoles2d(2));
- FirstVec.Normalize();
+ const Standard_Real aSqNormToler = Epsilon(1.0)*Epsilon(1.0);
+ gp_Vec2d FirstVec(aPoles2d(1), aPoles2d(2)), SecondVec;
+ Standard_Real aVecSqNorm = FirstVec.SquareMagnitude();
+ if (aVecSqNorm < aSqNormToler)
+ {
+ theIndbad = theIndfirst + 1;
+ return Standard_False;
+ }
+
+ FirstVec /= Sqrt(aSqNormToler);
gp_Pnt2d MidPnt = aPoles2d(2);
for (Standard_Integer k = 3; k <= aPoles2d.Upper(); k++)
{
- SecondVec = gp_Vec2d(MidPnt, aPoles2d(k));
- SecondVec.Normalize();
+ SecondVec.SetXY(aPoles2d(k).XY() - MidPnt.XY());
+ aVecSqNorm = SecondVec.SquareMagnitude();
+ if (aVecSqNorm < aSqNormToler)
+ {
+ theIndbad = theIndfirst + k - 1;
+ return Standard_False;
+ }
+
+ SecondVec /= Sqrt(aVecSqNorm);
Standard_Real ScalProd = FirstVec * SecondVec;
if (ScalProd < MinScalProd)
{
Standard_EXPORT BRepApprox_ApproxLine(const Handle(Geom_BSplineCurve)& CurveXYZ, const Handle(Geom2d_BSplineCurve)& CurveUV1, const Handle(Geom2d_BSplineCurve)& CurveUV2);
- Standard_EXPORT BRepApprox_ApproxLine(const Handle(IntSurf_LineOn2S)& lin, const Standard_Boolean Tang);
+ //! theTang variable has been entered only for compatibility with
+ //! the alias IntPatch_WLine. They are not used in this class.
+ Standard_EXPORT BRepApprox_ApproxLine(const Handle(IntSurf_LineOn2S)& lin, const Standard_Boolean theTang = Standard_False);
Standard_EXPORT Standard_Integer NbPnts() const;
for(i=1;i<nbvtx;i++) {
firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
- if(firstp!=lastp) {
- if(lastp != firstp+1) {
- const Standard_Integer pmid = (Standard_Integer )( (firstp+lastp)/2);
+ if(firstp!=lastp)
+ {
+ if (lastp != firstp + 1)
+ {
+ const Standard_Integer pmid = (Standard_Integer) ((firstp + lastp) / 2);
const IntSurf_PntOn2S& Pmid = WLine->Point(pmid);
Pmid.Parameters(u1,v1,u2,v2);
AdjustPeriodic(myHS1, myHS2, u1, v1, u2, v2);
- const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
- if(in1 != TopAbs_OUT) {
- const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
- if(in2 != TopAbs_OUT) {
+ const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1, v1), Tol);
+ if (in1 != TopAbs_OUT)
+ {
+ const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2, v2), Tol);
+ if (in2 != TopAbs_OUT)
+ {
seqp.Append(firstp);
seqp.Append(lastp);
}
}
}
- else {
- const IntSurf_PntOn2S& Pfirst = WLine->Point((Standard_Integer)(firstp));
- Pfirst.Parameters(u1,v1,u2,v2);
- AdjustPeriodic(myHS1, myHS2, u1, v1, u2, v2);
- TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
- if(in1 != TopAbs_OUT) { //-- !=ON donne Pb
- TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
- if(in2 != TopAbs_OUT) { //-- !=ON
- const IntSurf_PntOn2S& Plast = WLine->Point((Standard_Integer)(lastp));
- Plast.Parameters(u1,v1,u2,v2);
- AdjustPeriodic(myHS1, myHS2, u1, v1, u2, v2);
- in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
- if(in1 != TopAbs_OUT) { //-- !=ON donne Pb
- in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
- if(in2 != TopAbs_OUT) {
- seqp.Append(firstp);
- seqp.Append(lastp);
+ else
+ {
+ if (WLine->GetCreatingWay() == IntPatch_WLine::IntPatch_WLImpPrm)
+ {
+ //The fix #29972.
+ //Implicit-Parametric intersector does not respect domain of
+ //the quadric surface (it takes into account the domain of the
+ //parametric surface only). It means that we cannot warrant that
+ //we have a point exactly in the quadric boundary.
+ //E.g. in the test cases "bugs modalg_5 bug25697_2",
+ //"bugs modalg_5 bug23948", "boolean bopfuse_complex G9",
+ //"boolean bopcommon_complex H7", "boolean bopcut_complex I7" etc.
+ //the WLine contains 2 points and one is out of the quadric's domain.
+ //In order to process these cases correctly, we classify a middle
+ //(between these two) point (obtained by interpolation).
+
+ //Other types of intersector take into account the domains of both surfaces.
+ //So, they require to reject all "outboundaried" parts of WLine. As result,
+ //more strict check (all two points of WLine are checksed) is
+ //applied in this case.
+
+ Standard_Real aU21, aV21, aU22, aV22;
+ const IntSurf_PntOn2S& aPfirst = WLine->Point((Standard_Integer) (firstp));
+ const IntSurf_PntOn2S& aPlast = WLine->Point((Standard_Integer) (lastp));
+ aPfirst.Parameters(u1, v1, u2, v2);
+ AdjustPeriodic(myHS1, myHS2, u1, v1, u2, v2);
+ aPlast.Parameters(aU21, aV21, aU22, aV22);
+ AdjustPeriodic(myHS1, myHS2, aU21, aV21, aU22, aV22);
+
+ u1 = 0.5*(u1 + aU21);
+ v1 = 0.5*(v1 + aV21);
+ u2 = 0.5*(u2 + aU22);
+ v2 = 0.5*(v2 + aV22);
+
+ const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1, v1), Tol);
+ if (in1 != TopAbs_OUT)
+ {
+ const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2, v2), Tol);
+ if (in2 != TopAbs_OUT)
+ {
+ seqp.Append(firstp);
+ seqp.Append(lastp);
+ }
+ }
+ }
+ else
+ {
+ const IntSurf_PntOn2S& Pfirst = WLine->Point((Standard_Integer) (firstp));
+ Pfirst.Parameters(u1, v1, u2, v2);
+ AdjustPeriodic(myHS1, myHS2, u1, v1, u2, v2);
+ TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1, v1), Tol);
+ if (in1 != TopAbs_OUT)
+ {
+ TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2, v2), Tol);
+ if (in2 != TopAbs_OUT)
+ {
+ const IntSurf_PntOn2S& Plast = WLine->Point((Standard_Integer) (lastp));
+ Plast.Parameters(u1, v1, u2, v2);
+ AdjustPeriodic(myHS1, myHS2, u1, v1, u2, v2);
+ in1 = myDom1->Classify(gp_Pnt2d(u1, v1), Tol);
+ if (in1 != TopAbs_OUT)
+ {
+ in2 = myDom2->Classify(gp_Pnt2d(u2, v2), Tol);
+ if (in2 != TopAbs_OUT)
+ {
+ seqp.Append(firstp);
+ seqp.Append(lastp);
+ }
}
}
}
if(bIsEndOfLine) {
if(aLineOn2S->NbPoints() > 1) {
Handle(IntPatch_WLine) aNewWLine =
- new IntPatch_WLine(aLineOn2S, Standard_False);
+ new IntPatch_WLine(aLineOn2S, Standard_False);
+ aNewWLine->SetCreatingWayInfo(theWLine->GetCreatingWay());
theNewLines.Append(aNewWLine);
}
aLineOn2S = new IntSurf_LineOn2S();
if(bIsEndOfLine) {
if(aLineOn2S->NbPoints() > 1) {
Handle(IntPatch_WLine) aNewWLine =
- new IntPatch_WLine(aLineOn2S, Standard_False);
+ new IntPatch_WLine(aLineOn2S, Standard_False);
+ aNewWLine->SetCreatingWayInfo(theWLine->GetCreatingWay());
theNewLines.Append(aNewWLine);
}
aLineOn2S = new IntSurf_LineOn2S();
if(aLineOn2S->NbPoints() > 1) {
Handle(IntPatch_WLine) aNewWLine =
- new IntPatch_WLine(aLineOn2S, Standard_False);
+ new IntPatch_WLine(aLineOn2S, Standard_False);
+ aNewWLine->SetCreatingWayInfo(theWLine->GetCreatingWay());
theNewLines.Append(aNewWLine);
}
}
aLineOn2S->Add(aP1);
aLineOn2S->Add(aP2);
Handle(IntPatch_WLine) aNewWLine =
- new IntPatch_WLine(aLineOn2S, Standard_False);
+ new IntPatch_WLine(aLineOn2S, Standard_False);
+ aNewWLine->SetCreatingWayInfo(theWLine->GetCreatingWay());
theNewLines.Append(aNewWLine);
}
}
continue;
}
- //-----------------------------------------------------------------
- //-- Computation of transitions of the line on two surfaces ---
- //-----------------------------------------------------------------
- IntSurf_TypeTrans trans1,trans2;
- {
- Standard_Integer indice1;
- Standard_Real dotcross;
- gp_Pnt aPP0, aPP1;
- //
- trans1=IntSurf_Undecided;
- trans2=IntSurf_Undecided;
- //
- indice1 = aLinOn2S->NbPoints()/3;
- if(indice1<=2) {
- indice1 = 2;
- }
- //
- aPP1=aLinOn2S->Value(indice1).Value();
- aPP0=aLinOn2S->Value(indice1-1).Value();
- //
- gp_Vec tgvalid(aPP0, aPP1);
- gp_Vec aNQ1 = myQuad1.Normale(aPP0);
- gp_Vec aNQ2 = myQuad2.Normale(aPP0);
- //
- dotcross = tgvalid.DotCross(aNQ2, aNQ1);
- if (dotcross > myTolTransition) {
- trans1 = IntSurf_Out;
- trans2 = IntSurf_In;
- }
- else if(dotcross < -myTolTransition) {
- trans1 = IntSurf_In;
- trans2 = IntSurf_Out;
- }
- }
-
//-----------------------------------------------------------------
//-- W L i n e c r e a t i o n ---
//-----------------------------------------------------------------
Handle(IntPatch_WLine) aWLine;
//
- if(theALine->TransitionOnS1() == IntSurf_Touch) {
- aWLine = new IntPatch_WLine(aLinOn2S,
+ if(theALine->TransitionOnS1() == IntSurf_Touch)
+ {
+ aWLine = new IntPatch_WLine(aLinOn2S,
theALine->IsTangent(),
theALine->SituationS1(),
theALine->SituationS2());
+ aWLine->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLImpImp);
}
- else if(theALine->TransitionOnS1() == IntSurf_Undecided) {
+ else if(theALine->TransitionOnS1() == IntSurf_Undecided)
+ {
aWLine = new IntPatch_WLine(aLinOn2S, theALine->IsTangent());
+ aWLine->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLImpImp);
}
- else {
+ else
+ {
+ //Computation of transitions of the line on two surfaces ---
+ const Standard_Integer indice1 = Max(aLinOn2S->NbPoints() / 3, 2);
+ const gp_Pnt &aPP0 = aLinOn2S->Value(indice1 - 1).Value(),
+ &aPP1 = aLinOn2S->Value(indice1).Value();
+ const gp_Vec tgvalid(aPP0, aPP1);
+ const gp_Vec aNQ1(myQuad1.Normale(aPP0)), aNQ2(myQuad2.Normale(aPP0));
+
+ const Standard_Real dotcross = tgvalid.DotCross(aNQ2, aNQ1);
+
+ IntSurf_TypeTrans trans1 = IntSurf_Undecided,
+ trans2 = IntSurf_Undecided;
+
+ if (dotcross > myTolTransition)
+ {
+ trans1 = IntSurf_Out;
+ trans2 = IntSurf_In;
+ }
+ else if (dotcross < -myTolTransition)
+ {
+ trans1 = IntSurf_In;
+ trans2 = IntSurf_Out;
+ }
+
aWLine = new IntPatch_WLine(aLinOn2S, theALine->IsTangent(),
- trans1, // aline->TransitionOnS1(),
- trans2); //aline->TransitionOnS2());
+ trans1, trans2);
+ aWLine->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLImpImp);
}
for(Standard_Integer i = aSeqVertex.Lower(); i <= aNewVertID; i++)
{
aL2S[i] = new IntSurf_LineOn2S();
aWLine[i] = new IntPatch_WLine(aL2S[i], Standard_False);
+ aWLine[i]->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLImpImp);
aWLFindStatus[i] = WLFStatus_Absent;
isAddingWLEnabled[i] = Standard_True;
aU2[i] = aV1[i] = aV2[i] = 0.0;
Handle(IntSurf_LineOn2S) aL2S = new IntSurf_LineOn2S();
Handle(IntPatch_WLine) aWLine = new IntPatch_WLine(aL2S, Standard_False);
+ aWLine->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLImpImp);
//Define the index of WLine, which lies the point aPnt2S in.
Standard_Integer anIndex = 0;
}
// <-A
wline = new IntPatch_WLine(thelin,Standard_False,trans1,trans2);
+ wline->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLImpPrm);
#ifdef INTPATCH_IMPPRMINTERSECTION_DEBUG
wline->Dump(0);
sline->Add(SLine->Value(ip));
Handle(IntPatch_WLine) wline = new IntPatch_WLine(sline,Tang,Trans1,Trans2);
+ wline->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLImpPrm);
gp_Pnt aSPnt;
IntPatch_Point TPntF,TPntL;
Handle(IntPatch_WLine) wline =
new IntPatch_WLine(sline,Standard_False,
theLine->TransitionOnS1(),theLine->TransitionOnS2());
+ wline->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLImpPrm);
Standard_Real aU1 = 0.0, aV1 = 0.0, aU2 = 0.0, aV2 = 0.0;
gp_Pnt aSPnt(sline->Value(1).Value());
newVtx.SetParameter(VPold.Value(ciV));
Handle(IntPatch_WLine) NWLine = new IntPatch_WLine(newL2s,Standard_False,theTrans1,theTrans2);
+ NWLine->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLPrmPrm);
Standard_Integer iV;
for( iV = 1; iV <= cnbV; iV++ )
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PW.Line(),Standard_False,trans1,trans2);
+ wline->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLPrmPrm);
+
//the method PutVertexOnLine can reduce the number of points in <wline>
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
if (wline->NbPnts() < 2)
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PW.Line(),Standard_False,trans1,trans2);
+ wline->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLPrmPrm);
+
//the method PutVertexOnLine can reduce the number of points in <wline>
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
if (wline->NbPnts() < 2)
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PWLine,Standard_False,trans1,trans2);
+ wline->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLPrmPrm);
+
const IntSurf_PntOn2S& POn2SDeb = wline->Point(1);
const IntSurf_PntOn2S& POn2SFin = wline->Point(wline->NbPnts());
if((POn2SDeb.Value()).Distance(POn2SFin.Value()) <= TolTangency) {
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PWLine,Standard_False,trans1,trans2);
+ wline->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLPrmPrm);
+
const IntSurf_PntOn2S& POn2SDeb = wline->Point(1);
const IntSurf_PntOn2S& POn2SFin = wline->Point(wline->NbPnts());
if((POn2SDeb.Value()).Distance(POn2SFin.Value()) <= TolTangency) {
ResultPntOn2SLine->Add(TheLine->Point(High));
- return(new IntPatch_WLine(ResultPntOn2SLine,Standard_False));
+ Handle(IntPatch_WLine) aRWL = new IntPatch_WLine(ResultPntOn2SLine, Standard_False);
+ aRWL->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLPrmPrm);
+
+ return(aRWL);
}
//==================================================================================
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PW.Line(),Standard_False,trans1,trans2);
+ wline->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLPrmPrm);
+
//the method PutVertexOnLine can reduce the number of points in <wline>
IntPatch_RstInt::PutVertexOnLine(wline, Surf1, D1, Surf2, Standard_True, TolTang);
if (wline->NbPnts() < 2)
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PW.Line(),Standard_False,trans1,trans2);
+ wline->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLPrmPrm);
+
//the method PutVertexOnLine can reduce the number of points in <wline>
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
if (wline->NbPnts() < 2)
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PW.Line(),Standard_False,trans1,trans2);
+ wline->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLPrmPrm);
wline->EnablePurging(!hasBeenAdded);
//the method PutVertexOnLine can reduce the number of points in <wline>
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PW.Line(),Standard_False,trans1,trans2);
+ wline->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLPrmPrm);
wline->EnablePurging(!hasBeenAdded);
//the method PutVertexOnLine can reduce the number of points in <wline>
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PW.Line(),Standard_False,trans1,trans2);
+ wline->SetCreatingWayInfo(IntPatch_WLine::IntPatch_WLPrmPrm);
+
//the method PutVertexOnLine can reduce the number of points in <wline>
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
if (wline->NbPnts() < 2)
const IntSurf_TypeTrans Trans2) :
IntPatch_PointLine(Tang,Trans1,Trans2),fipt(Standard_False),lapt(Standard_False),
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False),
- myIsPurgerAllowed(Standard_True)
+ myIsPurgerAllowed(Standard_True),
+ myCreationWay(IntPatch_WLUnknown)
{
typ = IntPatch_Walking;
curv = Line;
const IntSurf_Situation Situ2) :
IntPatch_PointLine(Tang,Situ1,Situ2),fipt(Standard_False),lapt(Standard_False),
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False),
- myIsPurgerAllowed(Standard_True)
+ myIsPurgerAllowed(Standard_True),
+ myCreationWay(IntPatch_WLUnknown)
{
typ = IntPatch_Walking;
curv = Line;
const Standard_Boolean Tang) :
IntPatch_PointLine(Tang),fipt(Standard_False),lapt(Standard_False),
hasArcOnS1(Standard_False),hasArcOnS2(Standard_False),
- myIsPurgerAllowed(Standard_True)
+ myIsPurgerAllowed(Standard_True),
+ myCreationWay(IntPatch_WLUnknown)
{
typ = IntPatch_Walking;
curv = Line;
public:
+ //! Enumeration of ways of WLine creation.
+ enum IntPatch_WLType
+ {
+ IntPatch_WLUnknown,
+ IntPatch_WLImpImp,
+ IntPatch_WLImpPrm,
+ IntPatch_WLPrmPrm
+ };
//! Creates a WLine as an intersection when the
//! transitions are In or Out.
//! Otherwise, prints list of 2d-points on the 2nd surface
Standard_EXPORT void Dump(const Standard_Integer theMode) const;
- //! Allows or forbides purging of existing WLine
+ //! Allows or forbids purging of existing WLine
void EnablePurging(const Standard_Boolean theIsEnabled)
{
myIsPurgerAllowed = theIsEnabled;
}
- //! Returns TRUE if purging is allowed or forbiden for existing WLine
+ //! Returns TRUE if purging is allowed or forbidden for existing WLine
Standard_Boolean IsPurgingAllowed()
{
return myIsPurgerAllowed;
}
+ //! Returns the way of <*this> creation.
+ IntPatch_WLType GetCreatingWay() const
+ {
+ return myCreationWay;
+ }
+
+ //! Sets the info about the way of <*this> creation.
+ void SetCreatingWayInfo(IntPatch_WLType theAlgo)
+ {
+ myCreationWay = theAlgo;
+ }
+
DEFINE_STANDARD_RTTIEXT(IntPatch_WLine,IntPatch_PointLine)
Handle(Adaptor2d_HCurve2d) theArcOnS2;
Standard_Boolean myIsPurgerAllowed;
+ //! identifies the way of <*this> creation
+ IntPatch_WLType myCreationWay;
};
Handle(IntSurf_LineOn2S) aPurgedLineOn2S = new IntSurf_LineOn2S();
Handle(IntPatch_WLine) aLocalWLine = new IntPatch_WLine(aPurgedLineOn2S, Standard_False);
+ aLocalWLine->SetCreatingWayInfo(theWLine->GetCreatingWay());
Standard_Integer anOldLineIdx = 1, aVertexIdx = 1, anIndexPrev = -1, anIdxOld = -1;
gp_Pnt aPPrev, aPOld;
for(i = 1; i <= thePointsHash.Upper(); i++)
Handle(IntPatch_WLine) aTmpWLine = theWLine;
Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S();
aLocalWLine = new IntPatch_WLine(aLineOn2S, Standard_False);
+ aLocalWLine->SetCreatingWayInfo(theWLine->GetCreatingWay());
for(i = 1; i <= nb; i++)
aLineOn2S->Add(theWLine->Point(i));
{
aTmpWLine = aLocalWLine;
aLocalWLine = new IntPatch_WLine(aLineOn2S, Standard_False);
+ aLocalWLine->SetCreatingWayInfo(theWLine->GetCreatingWay());
for(v = 1; v <= aTmpWLine->NbVertex(); v++)
{
return(out);
}
+//=======================================================================
+//function : Add
+//purpose :
+//=======================================================================
+void IntSurf_LineOn2S::Add(const IntSurf_PntOn2S& P)
+{
+ mySeq.Append(P);
+ if (!myBxyz.IsWhole())
+ {
+ myBxyz.Add(P.Value());
+ }
+
+ if (!myBuv1.IsWhole())
+ {
+ myBuv1.Add(P.ValueOnSurface(Standard_True));
+ }
+
+ if (!myBuv2.IsWhole())
+ {
+ myBuv2.Add(P.ValueOnSurface(Standard_False));
+ }
+}
+
+//=======================================================================
+//function : SetUV
+//purpose :
+//=======================================================================
+void IntSurf_LineOn2S::SetUV(const Standard_Integer Index,
+ const Standard_Boolean OnFirst,
+ const Standard_Real U,
+ const Standard_Real V)
+{
+ mySeq(Index).SetValue(OnFirst, U, V);
+
+ if (OnFirst && !myBuv1.IsWhole())
+ {
+ myBuv1.Add(gp_Pnt2d(U, V));
+ }
+ else if (!OnFirst && !myBuv2.IsWhole())
+ {
+ myBuv2.Add(gp_Pnt2d(U, V));
+ }
+}
Standard_EXPORT IntSurf_LineOn2S(const IntSurf_Allocator& theAllocator = 0);
//! Adds a point in the line.
- void Add (const IntSurf_PntOn2S& P);
+ Standard_EXPORT void Add(const IntSurf_PntOn2S& P);
//! Returns the number of points in the line.
Standard_Integer NbPoints() const;
//! Sets the parametric coordinates on one of the surfaces
//! of the point of range Index in the line.
- void SetUV (const Standard_Integer Index, const Standard_Boolean OnFirst, const Standard_Real U, const Standard_Real V);
+ Standard_EXPORT void SetUV(const Standard_Integer Index, const Standard_Boolean OnFirst, const Standard_Real U, const Standard_Real V);
void Clear();
#include <IntSurf_PntOn2S.hxx>
-
-
-
-inline void IntSurf_LineOn2S::Add(const IntSurf_PntOn2S& P) {
- mySeq.Append(P);
- if (!myBxyz.IsWhole())
- {
- myBxyz.Add(P.Value());
- }
-
- if (!myBuv1.IsWhole())
- {
- myBuv1.Add(P.ValueOnSurface(Standard_True));
- }
-
- if (!myBuv2.IsWhole())
- {
- myBuv2.Add(P.ValueOnSurface(Standard_False));
- }
-}
-
-
inline Standard_Integer IntSurf_LineOn2S::NbPoints() const {
return mySeq.Length();
mySeq(Index) = P;
}
-inline void IntSurf_LineOn2S::SetUV(const Standard_Integer Index,
- const Standard_Boolean OnFirst,
- const Standard_Real U,
- const Standard_Real V)
-{
- mySeq(Index).SetValue(OnFirst,U,V);
-
- if (OnFirst && !myBuv1.IsWhole())
- {
- myBuv1.Add(gp_Pnt2d(U,V));
- }
- else if (!OnFirst && !myBuv2.IsWhole())
- {
- myBuv2.Add(gp_Pnt2d(U,V));
- }
-}
-
inline void IntSurf_LineOn2S::Clear ()
{
mySeq.Clear();
if(aLineOn2S->NbPoints() > 1) {
Handle(IntPatch_WLine) aNewWLine =
new IntPatch_WLine(aLineOn2S, Standard_False);
+ aNewWLine->SetCreatingWayInfo(theWLine->GetCreatingWay());
theNewLines.Append(aNewWLine);
}
aLineOn2S = new IntSurf_LineOn2S();
if(aLineOn2S->NbPoints() > 1) {
Handle(IntPatch_WLine) aNewWLine =
new IntPatch_WLine(aLineOn2S, Standard_False);
+ aNewWLine->SetCreatingWayInfo(theWLine->GetCreatingWay());
theNewLines.Append(aNewWLine);
}
aLineOn2S = new IntSurf_LineOn2S();
if(aLineOn2S->NbPoints() > 1) {
Handle(IntPatch_WLine) aNewWLine =
new IntPatch_WLine(aLineOn2S, Standard_False);
+ aNewWLine->SetCreatingWayInfo(theWLine->GetCreatingWay());
theNewLines.Append(aNewWLine);
}
}
Handle(IntWalk_TheIWLine) CurrentLine; // line under construction
Standard_Boolean Tgtend;
- IntWalk_StatusDeflection aStatus, StatusPrecedent;
+ IntWalk_StatusDeflection aStatus = IntWalk_OK, StatusPrecedent = IntWalk_OK;
Standard_Integer NbDivision;
// number of divisions of step for each section
if (wd2[I].etat > 12) { //line closed good case
CurrentLine->AddStatusFirstLast(Standard_True,
Standard_False,Standard_False);
- CurrentLine->AddPoint(CurrentLine->Value(1));
+ CurrentLine->AddPoint(CurrentLine->Value(1));
}
- else if (N >0) { //point of stop given at input
+ else if ((N >0) && (Pnts1.Length() >= N))
+ {
+ //point of stop given at input
PathPnt = Pnts1.Value(N);
CurrentLine->AddStatusLast(Standard_True,N,PathPnt);
AddPointInCurrentLine(N,PathPnt,CurrentLine);
gp_Vec Corde(previousPoint.Value(), sp.Point());
- const Standard_Real Norme = Corde.SquareMagnitude(),
- aTol = epsilon*Precision::PConfusion();
+ const Standard_Real Norme = Corde.SquareMagnitude();
- //if ((++NbPointsConfondusConsecutifs < 10) && (Norme <= epsilon)) { // the square is already taken in the constructor
- if ((Norme <= epsilon) && ((Duv <= aTol) || (StatusPrecedent != IntWalk_OK)))
+ if ((Norme <= 4.0*Precision::SquareConfusion()) &&
+ ((Duv <= Precision::SquarePConfusion()) || (StatusPrecedent != IntWalk_OK)))
{ // the square is already taken in the constructor
aStatus = IntWalk_PointConfondu;
- if (StatusPrecedent == IntWalk_PasTropGrand) {
+ if (StatusPrecedent == IntWalk_PasTropGrand)
+ {
return IntWalk_ArretSurPointPrecedent;
}
}
- else {
+ else
+ {
Standard_Real Cosi = Corde * previousd3d;
Standard_Real Cosi2 = 0.0;
# Wrong intersection between a surface of revolution and a plane.
###########################################################
-set MaxTol 1.0e-4
+set MaxTol 1.0e-6
set NbCurv_OK 2
restore [locate_data_file bug22766_f1] f1
restore [locate_data_file bug22766_f2] f2
-set log [bopcurves f1 f2]
+set log [bopcurves f1 f2 -2d]
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
puts "Error: ${NbCurv_OK} curve(s) expected, but ${NbCurv} found."
}
-if {${Toler} > ${MaxTol}} {
- puts "Error: Tolerance is too big!"
+checkreal TolReached ${Toler} ${MaxTol} 0.0 0.1
+
+bclearobjects
+bcleartools
+
+for { set i 1 } { $i <= $NbCurv } { incr i } {
+ mkedge ee c_$i
+ baddobjects ee
}
+
+if { $NbCurv > 1 } {
+ bfillds
+ bbuild rs
+ checksection rs -r 2
+ checkmaxtol rs -ref $MaxTol
+ checkprops rs -l 111.803
+}
+
+smallview
+don c_*
+fit
+disp f1 f2
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
# Wrong intersection between a surface of revolution and a plane.
###########################################################
+foreach a [directory c_*] {unset $a}
+
restore [locate_data_file bug22766_f1] f1
restore [locate_data_file bug22766_f2] f2
-bopcurves f1 f2
-
mksurface s1 f1
mksurface s2 f2
-xdistcs c_1 s2 0 1 10 1e-3
+set log [bopcurves f1 f2]
+
+regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
+
+for { set i 1 } { $i <= $NbCurv } { incr i } {
+ bounds c_$i U1 U2
+
+ if {[dval U2-U1] < 1.0e-9} {
+ puts "Error: Wrong curve's range!"
+ }
+
+ xdistcs c_$i s1 0 1 10 2.0e-7
+ xdistcs c_$i s2 0 1 10 2.0e-7
+}
smallview
+don c_*
fit
+disp s1 s2
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
-set MaxTol 1.e-7
set GoodNbCurv 3
-if { ${Toler} > ${MaxTol} } {
- puts "Error: Tolerance is too big!"
-}
+checkreal TolReached ${Toler} 0.00027763280312203317 0.0 0.01
if { ${NbCurv} != ${GoodNbCurv} } {
puts "Error: Curve Number is bad!"
set nbshapes_expected "
Number of shapes in result
- VERTEX : 22
- EDGE : 30
+ VERTEX : 18
+ EDGE : 26
WIRE : 12
FACE : 11
SHELL : 1
SOLID : 1
COMPSOLID : 0
COMPOUND : 1
- SHAPE : 78
+ SHAPE : 70
"
checknbshapes result -ref ${nbshapes_expected} -t -m "Result obtained by Boolean cut operation"
fit
checkprops result -l 0.883462
-checknbshapes result -vertex 86 -edge 43
+checknbshapes result -vertex 84 -edge 42
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
fit
checkprops result -l 0.980943
-checknbshapes result -vertex 58 -edge 29
+checknbshapes result -vertex 60 -edge 30
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
fit
checkprops result -l 0.958458
-checknbshapes result -vertex 52 -edge 26
+checknbshapes result -vertex 54 -edge 27
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
fit
checkprops result -l 0.820309
-checknbshapes result -vertex 74 -edge 37
+checknbshapes result -vertex 70 -edge 35
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
-puts "TODO OCC24429 ALL: An exception was caught"
-puts "TODO OCC24429 ALL: \\*\\* Exception \\*\\*.*"
-puts "TODO OCC24429 ALL: TEST INCOMPLETE"
-
puts "========"
-puts "OCC24429"
+puts "OCC24429: Cylinder-torus intersection throws an ex-ception and produces no result"
puts "========"
puts ""
-##########################################################################
-# Cylinder-torus intersection throws an exception and produces no result
-##########################################################################
+
+puts "TODO OCC24429 ALL: Error: 0 vertices are expected but 2 are found."
+
+set GoodNbCurves 8
restore [locate_data_file bug24429_s1.draw] s1
restore [locate_data_file bug24429_s2.draw] s2
-intersect result s1 s2
+intersect res s1 s2
+
+if { [info exists res] } {
+ #Only variable "res" exists
+ renamevar res res_1
+}
+
+bclearobjects
+bcleartools
+
+set ic 1
+set AllowRepeat 1
+while { $AllowRepeat != 0 } {
+ if { ![info exists res_$ic] } {
+ set AllowRepeat 0
+ } else {
+ bounds res_$ic U1 U2
+
+ if {[dval U2-U1] < 1.0e-9} {
+ puts "Error: Wrong curve's range!"
+ }
+
+ xdistcs res_$ic s1 U1 U2 100 2.0e-6
+ xdistcs res_$ic s2 U1 U2 100 2.0e-6
+
+ mkedge ee res_$ic
+ baddobjects ee
+
+ incr ic
+ }
+}
+
+# Check of gaps between intersection curves
+bfillds
+bbuild rs
+
+checknbshapes rs -edge $GoodNbCurves
+checksection rs -r 0
+
+smallview
+don res_*
+
+fit
+don s1 s2
+disp res_*
+
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
mkcurve c $e
# in a loop, check that curve has increased Z value along its length
-set delta 0.001
+bounds c u1 u2
+set delta [dval (u2-u1)/1000.0]
cvalue c 0 xp yp zp
-for {set p 0} {$p <= 1} {set p [expr $p + $delta]} {
+for {set p [dval u1] } {$p <= [dval u2] } {set p [expr $p + $delta]} {
cvalue c $p x y z
if {[dval z] < [dval zp]} {
puts "Error on parameter $p"
--- /dev/null
+puts "========"
+puts "OCC29972: Intersection curve has a weird gap in the middle of it"
+puts "========"
+puts ""
+
+set GoodNbCurves 2
+
+foreach a [directory res*] {unset $a}
+
+restore [locate_data_file bug29972_s1.draw] s1
+cylinder s2 -120 54.2955104312028 -116 1 0 0 0 0 -1 28
+
+intersect res s1 s2
+
+set che [whatis res]
+set ind [string first "3d curve" $che]
+if {${ind} >= 0} {
+ #Only variable "res" exists
+ renamevar res res_1
+}
+
+bclearobjects
+bcleartools
+
+set ic 1
+set AllowRepeat 1
+while { $AllowRepeat != 0 } {
+ set che [whatis res_$ic]
+ set ind [string first "3d curve" $che]
+ if {${ind} < 0} {
+ set AllowRepeat 0
+ } else {
+
+ bounds res_$ic U1 U2
+
+ if {[dval U2-U1] < 1.0e-9} {
+ puts "Error: Wrong curve's range!"
+ }
+
+ xdistcs res_$ic s1 U1 U2 100 2.0e-6
+ xdistcs res_$ic s2 U1 U2 100 2.0e-6
+
+ mkedge ee res_$ic
+ baddobjects ee
+
+ incr ic
+ }
+}
+
+# Check of gaps between intersection curves
+bfillds
+bbuild rs
+
+checknbshapes rs -edge $GoodNbCurves
+checksection rs -r 0
+
+smallview
+don res_*
+
+fit
+don s1 s2
+clpoles s1
+disp res_*
+
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
--- /dev/null
+puts "========"
+puts "OCC29972: Intersection curve has a weird gap in the middle of it"
+puts "========"
+puts ""
+
+set GoodNbCurves 2
+
+foreach a [directory res*] {unset $a}
+
+restore [locate_data_file bug29972_s1.draw] s1
+cylinder s2 -120 54.2955104312028 -116 1 0 0 0 0 -1 28
+
+intersect res s1 s2 1.e-4
+
+set che [whatis res]
+set ind [string first "3d curve" $che]
+if {${ind} >= 0} {
+ #Only variable "res" exists
+ renamevar res res_1
+}
+
+bclearobjects
+bcleartools
+
+set ic 1
+set AllowRepeat 1
+while { $AllowRepeat != 0 } {
+ set che [whatis res_$ic]
+ set ind [string first "3d curve" $che]
+ if {${ind} < 0} {
+ set AllowRepeat 0
+ } else {
+
+ bounds res_$ic U1 U2
+
+ if {[dval U2-U1] < 1.0e-9} {
+ puts "Error: Wrong curve's range!"
+ }
+
+ xdistcs res_$ic s1 U1 U2 100 2.0e-5
+ xdistcs res_$ic s2 U1 U2 100 2.0e-5
+
+ mkedge ee res_$ic
+ baddobjects ee
+
+ incr ic
+ }
+}
+
+# Check of gaps between intersection curves
+bfillds
+bbuild rs
+
+checknbshapes rs -edge $GoodNbCurves
+checksection rs -r 0
+
+smallview
+don res_*
+
+fit
+don s1 s2
+clpoles s1
+disp res_*
+
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
--- /dev/null
+puts "========"
+puts "OCC29972: Intersection curve has a weird gap in the middle of it"
+puts "========"
+puts ""
+
+set GoodNbCurves 6
+
+foreach a [directory res*] {unset $a}
+
+torus s1 -127 84 100 0 0 -1 1 0 0 23 10
+cylinder s2 -132 61.5500556793564 131 0 0 -1 1 0 0 10
+
+intersect res s1 s2 1.0e-4
+
+if { [info exists res] } {
+ #Only variable "res" exists
+ renamevar res res_1
+}
+
+bclearobjects
+bcleartools
+
+set ic 1
+set AllowRepeat 1
+while { $AllowRepeat != 0 } {
+ if { ![info exists res_$ic] } {
+ set AllowRepeat 0
+ } else {
+ bounds res_$ic U1 U2
+
+ if {[dval U2-U1] < 1.0e-9} {
+ puts "Error: Wrong curve's range!"
+ }
+
+ xdistcs res_$ic s1 U1 U2 100 2.0e-7
+ xdistcs res_$ic s2 U1 U2 100 2.0e-7
+
+ mkedge ee res_$ic
+ baddobjects ee
+
+ incr ic
+ }
+}
+
+# Check of gaps between intersection curves
+bfillds
+bbuild rs
+
+checknbshapes rs -edge $GoodNbCurves
+
+regexp {nb alone Vertices : ([-0-9.+eE]+)} [ checksection rs -r 4 ] full nbv
+if { $nbv < 2 } {
+ puts "Error : The section is closed. The result is possible to better than on MASTER version. Please check carefully."
+} else {
+ for {set i 1} {$i < $nbv} {incr i} {
+ for {set j [expr $i +1] } {$j <= $nbv} {incr j} {
+ distmini dd alone_$i alone_$j;
+
+ if { [dval dd_val] > 3.0e-6 } {
+ puts "Error: The distance between alone_$i and alone_$j is too big"
+ }
+ }
+ }
+}
+
+smallview
+don res_*
+
+fit
+don s1 s2
+disp res_*
+
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
--- /dev/null
+puts "========"
+puts "OCC29972: Intersection curve has a weird gap in the middle of it"
+puts "========"
+puts ""
+
+set GoodNbCurves 1
+
+foreach a [directory res*] {unset $a}
+
+restore [locate_data_file bug29972_s3.draw] s1
+plane s2 41.3489013503538 536.047793220744 -145.944893918698 0.999990480720734 0 0.00436330928474653 0.00436330928474653 0 -0.999990480720734
+
+intersect res s1 s2 1.0e-4
+
+if { [info exists res] } {
+ #Only variable "res" exists
+ renamevar res res_1
+}
+
+bclearobjects
+bcleartools
+
+set ic 1
+set AllowRepeat 1
+while { $AllowRepeat != 0 } {
+ if { ![info exists res_$ic] } {
+ set AllowRepeat 0
+ } else {
+ bounds res_$ic U1 U2
+
+ if {[dval U2-U1] < 1.0e-9} {
+ puts "Error: Wrong curve's range!"
+ }
+
+ xdistcs res_$ic s1 U1 U2 100 0.01
+ xdistcs res_$ic s2 U1 U2 100 0.01
+
+ #check whether the curve has a loop
+ set delta [dval (U2-U1)/1000.0]
+ cvalue res_$ic [dval U1] xp yp zp dx1 dy1 dz1
+ for {set p [dval U1]} {$p <= [dval U2]} {set p [expr $p + $delta]} {
+ cvalue res_$ic $p xp yp zp dx2 dy2 dz2
+
+ #Check if the angle between the vectors {dx1 dy1 dz1} and {dx2 dy2 dz2} is less than 75deg.
+ set nv1 [ dval dx1*dx1+dy1*dy1+dz1*dz1 ]
+ set nv2 [ dval dx2*dx2+dy2*dy2+dz2*dz2 ]
+
+ set nv1 [ expr sqrt($nv1) ]
+ set nv2 [ expr sqrt($nv2) ]
+
+ set dp [ dval dx1*dx2+dy2*dy2+dz1*dz2 ]
+
+ if {$dp < [ expr 0.25881904510252076234889883762405 * $nv1 * $nv2 ] } {
+ puts "Error: The curve res_$ic is possible to have a bend at parameter $p. Please check carefully"
+ }
+
+ dset dx1 dx2
+ dset dy1 dy2
+ dset dz1 dz2
+ }
+
+ incr ic
+ }
+}
+
+incr ic -1
+
+if { $ic != $GoodNbCurves } {
+ puts "Error: $GoodNbCurves are expected but $ic ones are found"
+}
+
+smallview
+don res_*
+
+fit
+clpoles s1
+don s1 s2
+disp res_*
+
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
--- /dev/null
+puts "========"
+puts "OCC29972: Intersection curve has a weird gap in the middle of it"
+puts "========"
+puts ""
+
+puts "TODO OCC27243 ALL: Error: The curve res_1 possibly has a bend"
+
+set GoodNbCurves 2
+
+foreach a [directory res*] {unset $a}
+
+binrestore [locate_data_file bug29972_f1.bin] f1
+
+mksurface s1 f1
+plane s2 -145.136225014162, -136.038366, -73.563687 0 0 1 -1 0 0
+
+intersect res s1 s2
+
+if { [info exists res] } {
+ #Only variable "res" exists
+ renamevar res res_1
+}
+
+dset aLambda1 1.0e-5
+dset aLambda2 [dval 1-aLambda1]
+
+set ic 1
+set AllowRepeat 1
+while { $AllowRepeat != 0 } {
+ if { ![info exists res_$ic] } {
+ set AllowRepeat 0
+ } else {
+ bounds res_$ic U1 U2
+
+ if {[dval U2-U1] < 1.0e-9} {
+ puts "Error: Wrong curve's range!"
+ }
+
+ xdistcs res_$ic s1 U1 U2 100 1.0e-7
+ xdistcs res_$ic s2 U1 U2 100 1.0e-7
+
+ #check whether the curve has a loop
+ set aFpar [dval U1*aLambda1+aLambda2*U2]
+ set aLpar [dval U2]
+
+ set delta [expr ($aLpar-$aFpar)/10.0]
+ cvalue res_$ic $aFpar xp yp zp dx1 dy1 dz1
+ for {set p $aFpar} {$p <= $aLpar} {set p [expr $p + $delta]} {
+ cvalue res_$ic $p xp yp zp dx2 dy2 dz2
+
+ #Check if the angle between the vectors {dx1 dy1 dz1} and {dx2 dy2 dz2} is less than 40deg.
+ set nv1 [ dval dx1*dx1+dy1*dy1+dz1*dz1 ]
+ set nv2 [ dval dx2*dx2+dy2*dy2+dz2*dz2 ]
+
+ set nv1 [ expr sqrt($nv1) ]
+ set nv2 [ expr sqrt($nv2) ]
+
+ set dp [ dval dx1*dx2+dy2*dy2+dz1*dz2 ]
+
+ if {$dp < [ expr 0.76604444311897803520239265055542 * $nv1 * $nv2 ] } {
+ puts "Error: The curve res_$ic possibly has a bend at parameter $p. Please check carefully"
+ }
+
+ dset dx1 dx2
+ dset dy1 dy2
+ dset dz1 dz2
+ }
+
+ incr ic
+ }
+}
+
+incr ic -1
+
+if { $ic != $GoodNbCurves } {
+ puts "Error: $GoodNbCurves are expected but $ic ones are found"
+}
+
+smallview
+clear
+point p1 57.478209319525746 -120.6955841545726 -125.98789759526636
+point p2 57.478010564066473 -120.69677875685414 -125.98860176530741
+fit
+
+clpoles s1
+don s1 s2
+disp res_*
+
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
--- /dev/null
+puts "========"
+puts "OCC29972: Intersection curve has a weird gap in the middle of it"
+puts "========"
+puts ""
+
+puts "TODO OCC27243 ALL: Error: The curve res_1 possibly has a bend"
+
+set GoodNbCurves 2
+
+foreach a [directory res*] {unset $a}
+
+binrestore [locate_data_file bug29972_f1.bin] f1
+
+mksurface s1 f1
+plane s2 -145.136225014162, -136.038366, -73.563687 0 0 1 -1 0 0
+
+intersect res s1 s2 1.0e-4
+
+if { [info exists res] } {
+ #Only variable "res" exists
+ renamevar res res_1
+}
+
+dset aLambda1 1.0e-5
+dset aLambda2 [dval 1-aLambda1]
+
+set ic 1
+set AllowRepeat 1
+while { $AllowRepeat != 0 } {
+ if { ![info exists res_$ic] } {
+ set AllowRepeat 0
+ } else {
+ bounds res_$ic U1 U2
+
+ if {[dval U2-U1] < 1.0e-9} {
+ puts "Error: Wrong curve's range!"
+ }
+
+ xdistcs res_$ic s1 U1 U2 100 1.0e-7
+ xdistcs res_$ic s2 U1 U2 100 1.0e-7
+
+ #check whether the curve has a loop
+ set aFpar [dval U1*aLambda1+aLambda2*U2]
+ set aLpar [dval U2]
+
+ set delta [expr ($aLpar-$aFpar)/10.0]
+ cvalue res_$ic $aFpar xp yp zp dx1 dy1 dz1
+ for {set p $aFpar} {$p <= $aLpar} {set p [expr $p + $delta]} {
+ cvalue res_$ic $p xp yp zp dx2 dy2 dz2
+
+ #Check if the angle between the vectors {dx1 dy1 dz1} and {dx2 dy2 dz2} is less than 40deg.
+ set nv1 [ dval dx1*dx1+dy1*dy1+dz1*dz1 ]
+ set nv2 [ dval dx2*dx2+dy2*dy2+dz2*dz2 ]
+
+ set nv1 [ expr sqrt($nv1) ]
+ set nv2 [ expr sqrt($nv2) ]
+
+ set dp [ dval dx1*dx2+dy2*dy2+dz1*dz2 ]
+
+ if {$dp < [ expr 0.76604444311897803520239265055542 * $nv1 * $nv2 ] } {
+ puts "Error: The curve res_$ic possibly has a bend at parameter $p. Please check carefully"
+ }
+
+ dset dx1 dx2
+ dset dy1 dy2
+ dset dz1 dz2
+ }
+
+ incr ic
+ }
+}
+
+incr ic -1
+
+if { $ic != $GoodNbCurves } {
+ puts "Error: $GoodNbCurves are expected but $ic ones are found"
+}
+
+smallview
+clear
+point p1 57.478209319525746 -120.6955841545726 -125.98789759526636
+point p2 57.478010564066473 -120.69677875685414 -125.98860176530741
+fit
+
+clpoles s1
+don s1 s2
+disp res_*
+
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file