// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <IntPatch_WLine.hxx>
+
static
Standard_Integer SetQuad(const Handle(Adaptor3d_HSurface)& theS,
GeomAbs_SurfaceType& theTS,
//purpose :
//=======================================================================
IntPatch_ImpImpIntersection::IntPatch_ImpImpIntersection ():
- done(Standard_False)
+myDone(IntStatus_Fail)
{
}
//=======================================================================
const Standard_Real TolTang,
const Standard_Boolean theIsReqToKeepRLine)
{
- Perform(S1,D1,S2,D2,TolArc,TolTang, Standard_False, theIsReqToKeepRLine);
+ Perform(S1,D1,S2,D2,TolArc,TolTang, theIsReqToKeepRLine);
}
//=======================================================================
//function : Perform
const Handle(Adaptor3d_TopolTool)& D2,
const Standard_Real TolArc,
const Standard_Real TolTang,
- const Standard_Boolean isTheTrimmed,
- const Standard_Boolean theIsReqToKeepRLine) {
- done = Standard_False;
- Standard_Boolean isTrimmed = isTheTrimmed;
+ const Standard_Boolean theIsReqToKeepRLine)
+{
+ myDone = IntStatus_Fail;
spnt.Clear();
slin.Clear();
+ Standard_Boolean isPostProcessingRequired = Standard_True;
+
empt = Standard_True;
tgte = Standard_False;
oppo = Standard_False;
const Standard_Integer iT2 = SetQuad(S2, typs2, quad2);
//
if (!iT1 || !iT2) {
- Standard_ConstructionError::Raise();
+ throw Standard_ConstructionError();
return;
}
//
//
case 22:
{ // Cylinder/Cylinder
- Standard_Boolean isDONE = Standard_False;
-
- if(!isTrimmed)
- {
- isDONE = IntCyCy(quad1, quad2, TolTang, empt,
- SameSurf, multpoint, slin, spnt);
- }
- else
- {
- Bnd_Box2d aBox1, aBox2;
+ Bnd_Box2d aBox1, aBox2;
- const Standard_Real aU1f = S1->FirstUParameter();
- Standard_Real aU1l = S1->LastUParameter();
- const Standard_Real aU2f = S2->FirstUParameter();
- Standard_Real aU2l = S2->LastUParameter();
+ const Standard_Real aU1f = S1->FirstUParameter();
+ Standard_Real aU1l = S1->LastUParameter();
+ const Standard_Real aU2f = S2->FirstUParameter();
+ Standard_Real aU2l = S2->LastUParameter();
- const Standard_Real anUperiod = 2.0*M_PI;
+ const Standard_Real anUperiod = 2.0*M_PI;
- if(aU1l - aU1f > anUperiod)
- aU1l = aU1f + anUperiod;
+ if(aU1l - aU1f > anUperiod)
+ aU1l = aU1f + anUperiod;
- if(aU2l - aU2f > anUperiod)
- aU2l = aU2f + anUperiod;
+ if(aU2l - aU2f > anUperiod)
+ aU2l = aU2f + anUperiod;
- aBox1.Add(gp_Pnt2d(aU1f, S1->FirstVParameter()));
- aBox1.Add(gp_Pnt2d(aU1l, S1->LastVParameter()));
- aBox2.Add(gp_Pnt2d(aU2f, S2->FirstVParameter()));
- aBox2.Add(gp_Pnt2d(aU2l, S2->LastVParameter()));
+ aBox1.Add(gp_Pnt2d(aU1f, S1->FirstVParameter()));
+ aBox1.Add(gp_Pnt2d(aU1l, S1->LastVParameter()));
+ aBox2.Add(gp_Pnt2d(aU2f, S2->FirstVParameter()));
+ aBox2.Add(gp_Pnt2d(aU2l, S2->LastVParameter()));
- const Standard_Real a2DTol = Min( S1->UResolution(TolTang),
- S2->UResolution(TolTang));
+ // Resolution is too big if the cylinder radius is
+ // too small. Therefore, we shall bind its value above.
+ // Here, we use simple constant.
+ const Standard_Real a2DTol = Min(1.0e-4, Min( S1->UResolution(TolTang),
+ S2->UResolution(TolTang)));
- Standard_Boolean isReversed = ((aU2l - aU2f) < (aU1l - aU1f));
+ myDone = IntCyCy(quad1, quad2, TolTang, a2DTol, aBox1, aBox2,
+ empt, SameSurf, multpoint, slin, spnt);
- if(isReversed)
- {
- isDONE = IntCyCyTrim(quad2, quad1, TolTang, a2DTol, aBox2, aBox1,
- isReversed, empt, slin, spnt);
- }
- else
- {
- isDONE = IntCyCyTrim(quad1, quad2, TolTang, a2DTol, aBox1, aBox2,
- isReversed, empt, slin, spnt);
- }
-
- if(!isDONE)
- {
- isDONE = IntCyCy(quad1, quad2, TolTang, empt,
- SameSurf, multpoint, slin, spnt);
- isTrimmed = Standard_False;
- }
- }
-
- if (!isDONE)
+ if (myDone == IntPatch_ImpImpIntersection::IntStatus_Fail)
{
return;
}
bEmpty = empt;
+ if(!slin.IsEmpty())
+ {
+ const Handle(IntPatch_WLine)& aWLine =
+ Handle(IntPatch_WLine)::DownCast(slin.Value(1));
+
+ if(!aWLine.IsNull())
+ {//No geometric solution
+ isPostProcessingRequired = Standard_False;
+ }
+ }
+
break;
}
//
}
//
default: {
- Standard_ConstructionError::Raise();
+ throw Standard_ConstructionError();
break;
}
}
//
if (bEmpty) {
- done = Standard_True;
+ if (myDone == IntStatus_Fail)
+ myDone = IntStatus_OK;
+
return;
}
//
- if(!isTrimmed)
+ if(isPostProcessingRequired)
{
if (!SameSurf) {
AFunc.SetQuadric(quad2);
}
nbpt = solrst.NbPoints();
nbseg= solrst.NbSegments();
- for (i=1; i<= nbpt; i++) {
- pnt1.Append(solrst.Point(i));
+ for (i = 1; i <= nbpt; i++)
+ {
+ const IntPatch_ThePathPointOfTheSOnBounds& aPt = solrst.Point(i);
+ pnt1.Append(aPt);
}
- for (i=1; i<= nbseg; i++) {
- edg1.Append(solrst.Segment(i));
+ for (i = 1; i <= nbseg; i++)
+ {
+ const IntPatch_TheSegmentOfTheSOnBounds& aSegm = solrst.Segment(i);
+ edg1.Append(aSegm);
}
nosolonS1 = (nbpt == 0) && (nbseg == 0);
if (solrst.AllArcSolution() && typs1 == typs2) {
all2 = Standard_True;
}
+
nbpt = solrst.NbPoints();
nbseg= solrst.NbSegments();
for (i=1; i<= nbpt; i++) {
- pnt2.Append(solrst.Point(i));
+ const IntPatch_ThePathPointOfTheSOnBounds& aPt = solrst.Point(i);
+ pnt2.Append(aPt);
}
for (i=1; i<= nbseg; i++) {
- edg2.Append(solrst.Segment(i));
+ const IntPatch_TheSegmentOfTheSOnBounds& aSegm = solrst.Segment(i);
+ edg2.Append(aSegm);
}
+
nosolonS2 = (nbpt == 0) && (nbseg == 0);
if (nosolonS2 && all2) { // cas de face sans restrictions
}
//
oppo = quad1.Normale(Ptreference).Dot(quad2.Normale(Ptreference)) < 0.0;
- done = Standard_True;
+ myDone = IntStatus_OK;
return;
}// if (SameSurf || (all1 && all2)) {
}
}
}
- done = Standard_True;
+ myDone = IntStatus_OK;
}
//=======================================================================