// Author: Jacques GOUSSARD
// Copyright: OPEN CASCADE 1992
+//modified by NIZNHY-PKV Thu Sep 15 11:09:12 2011
+static
+ void SeamPosition(const gp_Pnt& aPLoc,
+ const gp_Ax3& aPos,
+ gp_Ax2& aSeamPos);
+static
+ void AdjustToSeam (const gp_Cylinder& aQuad,
+ gp_Circ& aCirc);
+static
+ void AdjustToSeam (const gp_Sphere& aQuad,
+ gp_Circ& aCirc,
+ const Standard_Real aTolAng);
+static
+ void AdjustToSeam (const gp_Cone& aQuad,
+ gp_Circ& aCirc);
+//modified by NIZNHY-PKV Thu Sep 15 11:09:13 2011
+
+//=======================================================================
+//function : IntPP
+//purpose :
+// Traitement du cas Plan/Plan
+//=======================================================================
Standard_Boolean IntPP (const IntSurf_Quadric& Quad1,
const IntSurf_Quadric& Quad2,
const Standard_Real Tolang,
const Standard_Real TolTang,
Standard_Boolean& Same,
IntPatch_SequenceOfLine& slin)
-// Traitement du cas Plan/Plan
+
{
IntSurf_TypeTrans trans1,trans2;
IntAna_ResultType typint;
trans1 = IntSurf_In;
trans2 = IntSurf_Out;
}
- Handle(IntPatch_GLine) glig = new IntPatch_GLine (linsol,Standard_False,trans1,trans2);
+ Handle(IntPatch_GLine) glig =
+ new IntPatch_GLine (linsol,Standard_False,trans1,trans2);
slin.Append(glig);
}
return Standard_True;
}
-//====================================================================================
+//=======================================================================
+//function : IntPCy
+//purpose :
+// Traitement du cas Plan/Cylindre et reciproquement
+//=======================================================================
Standard_Boolean IntPCy (const IntSurf_Quadric& Quad1,
const IntSurf_Quadric& Quad2,
const Standard_Real Tolang,
Standard_Boolean& Empty,
IntPatch_SequenceOfLine& slin)
-// Traitement du cas Plan/Cylindre et reciproquement
{
gp_Pln Pl;
gp_Cylinder Cy;
switch (typint) {
- case IntAna_Empty :
- {
+ case IntAna_Empty : {
Empty = Standard_True;
}
- break;
+ break;
- case IntAna_Line:
- {
+ case IntAna_Line: {
gp_Lin linsol = inter.Line(1);
gp_Pnt orig(linsol.Location());
if (NbSol == 1) { // ligne de tangence
}
slin.Append(glig);
}
- else { // on a 2 droites. Il faut determiner les transitions
+ else {
+ // on a 2 droites. Il faut determiner les transitions
// de chacune.
if (linsol.Direction().DotCross(Quad2.Normale(orig),
trans1 = IntSurf_In;
trans2 = IntSurf_Out;
}
- Handle(IntPatch_GLine) glig = new IntPatch_GLine(linsol, Standard_False,trans1,trans2);
+ Handle(IntPatch_GLine) glig =
+ new IntPatch_GLine(linsol, Standard_False,trans1,trans2);
slin.Append(glig);
linsol = inter.Line(2);
slin.Append(glig);
}
}
- break;
-
- case IntAna_Circle:
- {
- gp_Circ cirsol = inter.Circle(1);
+ break;
+ //
+ case IntAna_Circle: {
+ gp_Circ cirsol;
gp_Pnt ptref;
gp_Vec Tgt;
+ //
+ cirsol = inter.Circle(1);
+ //modified by NIZNHY-PKV Thu Sep 15 11:30:03 2011f
+ AdjustToSeam(Cy, cirsol);
+ //modified by NIZNHY-PKV Thu Sep 15 11:30:15 2011t
ElCLib::D1(0.,cirsol,ptref,Tgt);
-
+
if (Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref)) > 0.0) {
trans1 = IntSurf_Out;
trans2 = IntSurf_In;
Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
slin.Append(glig);
}
- break;
-
- case IntAna_Ellipse:
- {
+ break;
+ //
+ case IntAna_Ellipse: {
gp_Elips elipsol = inter.Ellipse(1);
gp_Pnt ptref;
gp_Vec Tgt;
ElCLib::D1(0.,elipsol,ptref,Tgt);
-
+
if (Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref)) > 0.0) {
trans1 = IntSurf_Out;
trans2 = IntSurf_In;
Handle(IntPatch_GLine) glig = new IntPatch_GLine(elipsol,Standard_False,trans1,trans2);
slin.Append(glig);
}
- break;
-
- default:
- {
+ break;
+ //
+ default: {
return Standard_False; // on ne doit pas passer ici
}
}
return Standard_True;
}
-//====================================================================================
+//=======================================================================
+//function : IntPSp
+//purpose :
+// Traitement du cas Plan/Sphere et reciproquement
+//=======================================================================
Standard_Boolean IntPSp (const IntSurf_Quadric& Quad1,
const IntSurf_Quadric& Quad2,
+ //modified by NIZNHY-PKV Tue Sep 20 08:59:36 2011f
+ const Standard_Real Tolang,
+ //modified by NIZNHY-PKV Tue Sep 20 08:59:39 2011t
const Standard_Real TolTang,
const Standard_Boolean Reversed,
Standard_Boolean& Empty,
IntPatch_SequenceOfLine& slin,
IntPatch_SequenceOfPoint& spnt)
-// Traitement du cas Plan/Sphere et reciproquement
+
{
gp_Circ cirsol;
gp_Pln Pl;
Empty = Standard_False;
switch (typint) {
-
- case IntAna_Empty :
- {
+ case IntAna_Empty : {
Empty = Standard_True;
}
- break;
-
- case IntAna_Point:
- {
+ break;
+ //
+ case IntAna_Point: {
gp_Pnt psol = inter.Point(1);
Standard_Real U1,V1,U2,V2;
Quad1.Parameters(psol,U1,V1);
ptsol.SetParameters(U1,V1,U2,V2);
spnt.Append(ptsol);
}
- break;
-
- case IntAna_Circle:
- {
+ break;
+ //
+ case IntAna_Circle: {
cirsol = inter.Circle(1);
+ //modified by NIZNHY-PKV Thu Sep 15 11:30:03 2011f
+ AdjustToSeam(Sp, cirsol, Tolang);
+ //modified by NIZNHY-PKV Thu Sep 15 11:30:15 2011t
gp_Pnt ptref;
gp_Vec Tgt;
ElCLib::D1(0.,cirsol,ptref,Tgt);
Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
slin.Append(glig);
}
- break;
-
- default:
- {
+ break;
+
+ default: {
return Standard_False; // on ne doit pas passer ici
}
}
return Standard_True;
}
-//====================================================================================
+//=======================================================================
+//function : IntPCo
+//purpose :
+// Traitement du cas Plan/Cone et reciproquement
+//=======================================================================
Standard_Boolean IntPCo (const IntSurf_Quadric& Quad1,
const IntSurf_Quadric& Quad2,
const Standard_Real Tolang,
IntPatch_SequenceOfLine& slin,
IntPatch_SequenceOfPoint& spnt)
-// Traitement du cas Plan/Cone et reciproquement
+
{
gp_Pnt apex;
}
inter.Perform(Pl,Co,Tolang,TolTang);
- if (!inter.IsDone()) {return Standard_False;}
-
+ if (!inter.IsDone()) {
+ return Standard_False;
+ }
+ //
typint = inter.TypeInter();
Standard_Integer NbSol = inter.NbSolutions();
Empty = Standard_False;
switch (typint) {
-
- case IntAna_Point:
- {
+ case IntAna_Point: {
gp_Pnt psol = inter.Point(1);
Standard_Real U1,V1,U2,V2;
Quad1.Parameters(psol,U1,V1);
ptsol.SetParameters(U1,V1,U2,V2);
spnt.Append(ptsol);
}
- break;
-
- case IntAna_Line:
- {
+ break;
+
+ case IntAna_Line: {
gp_Lin linsol = inter.Line(1);
if (linsol.Direction().Dot(Co.Axis().Direction()) <0.) {
linsol.SetDirection(linsol.Direction().Reversed());
Standard_Real U1,V1,U2,V2;
Quad1.Parameters(apex,U1,V1);
Quad2.Parameters(apex,U2,V2);
-
+
if (NbSol == 1) { // ligne de tangence
IntPatch_Point ptsol;
ptsol.SetValue(apex,TolTang,Standard_False);
Normp = Quad2.Normale(ptbid);
Normco = Quad1.Normale(ptbid);
}
-
IntSurf_Situation situco,situco_otherside;
IntSurf_Situation situp,situp_otherside;
-
+
if (Normp.Dot(TestCurvature) > 0.) {
situco = IntSurf_Outside;
situco_otherside = IntSurf_Inside;
}
}
break;
-
- case IntAna_Circle:
- {
+
+ case IntAna_Circle: {
gp_Circ cirsol = inter.Circle(1);
-#if 0
- if (ElCLib::LineParameter(Co.Axis(),cirsol.Location()) <
- ElCLib::LineParameter(Co.Axis(),apex) ) {
- Empty = Standard_True;
+ //modified by NIZNHY-PKV Thu Sep 15 11:34:04 2011f
+ AdjustToSeam(Co, cirsol);
+ //modified by NIZNHY-PKV Thu Sep 15 11:36:08 2011t
+ gp_Pnt ptref;
+ gp_Vec Tgt;
+ ElCLib::D1(0.,cirsol,ptref,Tgt);
+
+ if (Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref)) >0.) {
+ trans1 = IntSurf_Out;
+ trans2 = IntSurf_In;
}
-#endif
- if(0) { }
else {
-
- gp_Pnt ptref;
- gp_Vec Tgt;
- ElCLib::D1(0.,cirsol,ptref,Tgt);
-
- if (Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref)) >0.) {
- trans1 = IntSurf_Out;
- trans2 = IntSurf_In;
- }
- else {
- trans1 = IntSurf_In;
- trans2 = IntSurf_Out;
- }
- Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
- slin.Append(glig);
+ trans1 = IntSurf_In;
+ trans2 = IntSurf_Out;
}
+ Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
+ slin.Append(glig);
}
- break;
-
- case IntAna_Ellipse:
- {
+ break;
+
+ case IntAna_Ellipse: {
gp_Elips elipsol = inter.Ellipse(1);
-#if 0
- if (ElCLib::LineParameter(Co.Axis(),elipsol.Location()) <
- ElCLib::LineParameter(Co.Axis(),apex) ) {
- Empty = Standard_True;
+ gp_Pnt ptref;
+ gp_Vec Tgt;
+ ElCLib::D1(0.,elipsol,ptref,Tgt);
+
+ if (Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref)) >0.) {
+ trans1 = IntSurf_Out;
+ trans2 = IntSurf_In;
}
-#endif
- if(0) { }
else {
- gp_Pnt ptref;
- gp_Vec Tgt;
- ElCLib::D1(0.,elipsol,ptref,Tgt);
-
- if (Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref)) >0.) {
- trans1 = IntSurf_Out;
- trans2 = IntSurf_In;
- }
- else {
- trans1 = IntSurf_In;
- trans2 = IntSurf_Out;
- }
- Handle(IntPatch_GLine) glig = new IntPatch_GLine(elipsol,Standard_False,trans1,trans2);
- slin.Append(glig);
+ trans1 = IntSurf_In;
+ trans2 = IntSurf_Out;
}
+ Handle(IntPatch_GLine) glig = new IntPatch_GLine(elipsol,Standard_False,trans1,trans2);
+ slin.Append(glig);
}
- break;
-
- case IntAna_Parabola:
- {
+ break;
+
+ case IntAna_Parabola: {
gp_Parab parabsol = inter.Parabola(1);
-#if 0
- if (ElCLib::LineParameter(Co.Axis(),parabsol.Focus()) <
- ElCLib::LineParameter(Co.Axis(),apex) ) {
- Empty = Standard_True;
+
+ gp_Vec Tgtorig(parabsol.YAxis().Direction());
+ Standard_Real ptran = Tgtorig.DotCross(Quad2.Normale(parabsol.Location()),
+ Quad1.Normale(parabsol.Location()));
+ if (ptran >0.00000001) {
+ trans1 = IntSurf_Out;
+ trans2 = IntSurf_In;
}
-#endif
- if(0) { }
- else {
-
- gp_Vec Tgtorig(parabsol.YAxis().Direction());
- Standard_Real ptran = Tgtorig.DotCross(Quad2.Normale(parabsol.Location()),
- Quad1.Normale(parabsol.Location()));
- if (ptran >0.00000001) {
- trans1 = IntSurf_Out;
- trans2 = IntSurf_In;
- }
- else if (ptran <-0.00000001) {
- trans1 = IntSurf_In;
- trans2 = IntSurf_Out;
- }
- else {
- trans1=trans2=IntSurf_Undecided;
- }
- Handle(IntPatch_GLine) glig = new IntPatch_GLine(parabsol,Standard_False,trans1,trans2);
- slin.Append(glig);
+ else if (ptran <-0.00000001) {
+ trans1 = IntSurf_In;
+ trans2 = IntSurf_Out;
}
+ else {
+ trans1=trans2=IntSurf_Undecided;
+ }
+ Handle(IntPatch_GLine) glig = new IntPatch_GLine(parabsol,Standard_False,trans1,trans2);
+ slin.Append(glig);
}
- break;
-
- case IntAna_Hyperbola:
- {
+ break;
+
+ case IntAna_Hyperbola: {
gp_Pnt tophypr;
gp_Vec Tgttop;
slin.Append(glig);
}
}
- break;
-
- default:
- {
+ break;
+
+ default: {
return Standard_False;
}
}
return Standard_True;
}
-//====================================================================================
+//
+//modified by NIZNHY-PKV Thu Sep 15 10:53:39 2011f
+//=======================================================================
+//function : AdjustToSeam
+//purpose :
+//=======================================================================
+void AdjustToSeam (const gp_Cone& aQuad,
+ gp_Circ& aCirc)
+{
+ gp_Ax2 aAx2;
+ //
+ const gp_Pnt& aPLoc=aCirc.Location();
+ const gp_Ax3& aAx3=aQuad.Position();
+ SeamPosition(aPLoc, aAx3, aAx2);
+ aCirc.SetPosition(aAx2);
+}
+//=======================================================================
+//function : AdjustToSeam
+//purpose :
+//=======================================================================
+void AdjustToSeam (const gp_Sphere& aQuad,
+ gp_Circ& aCirc,
+ const Standard_Real aTolAng)
+{
+ gp_Ax2 aAx2;
+ //
+ const gp_Ax1& aAx1C=aCirc.Axis();
+ const gp_Ax3& aAx3=aQuad.Position();
+ const gp_Ax1& aAx1Q=aAx3.Axis();
+ //
+ const gp_Dir& aDirC=aAx1C.Direction();
+ const gp_Dir& aDirQ=aAx1Q.Direction();
+ if (aDirC.IsParallel(aDirQ, aTolAng)) {
+ const gp_Pnt& aPLoc=aCirc.Location();
+ SeamPosition(aPLoc, aAx3, aAx2);
+ aCirc.SetPosition(aAx2);
+ }
+}
+//=======================================================================
+//function : AdjustToSeam
+//purpose :
+//=======================================================================
+void AdjustToSeam (const gp_Cylinder& aQuad,
+ gp_Circ& aCirc)
+{
+ gp_Ax2 aAx2;
+ //
+ const gp_Pnt& aPLoc=aCirc.Location();
+ const gp_Ax3& aAx3=aQuad.Position();
+ SeamPosition(aPLoc, aAx3, aAx2);
+ aCirc.SetPosition(aAx2);
+}
+//=======================================================================
+//function : SeamPosition
+//purpose :
+//=======================================================================
+void SeamPosition(const gp_Pnt& aPLoc,
+ const gp_Ax3& aPos,
+ gp_Ax2& aSeamPos)
+{
+ const gp_Dir& aDZ=aPos.Direction();
+ const gp_Dir& aDX=aPos.XDirection();
+ gp_Ax2 aAx2(aPLoc, aDZ, aDX);
+ aSeamPos=aAx2;
+}
+
+//modified by NIZNHY-PKV Thu Sep 15 10:53:41 2011t
myTolReached3d=1.1*myTolReached3d;
}
}// if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) ||
- //modified by NIZNHY-PKV Mon Sep 12 09:32:44 2011f
+ //
if ((aType1==GeomAbs_SurfaceOfRevolution && aType2==GeomAbs_Cylinder) ||
(aType2==GeomAbs_SurfaceOfRevolution && aType1==GeomAbs_Cylinder)) {
Standard_Boolean bIsDone;
if (aDSmax > aDS) {
myTolReached3d=sqrt(aDSmax);
}
- }// if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Torus) ||
- //modified by NIZNHY-PKV Mon Sep 12 09:32:46 2011t
+ }//if((aType1==GeomAbs_SurfaceOfRevolution ...
}
//=======================================================================
//function : MakeCurve
return new Geom2d_BSplineCurve(poles,knots,mults,1);
}
+//modified by NIZNHY-PKV Fri Sep 16 07:57:30 2011f
//=======================================================================
//function : PrepareLines3D
//purpose :
//=======================================================================
- void IntTools_FaceFace::PrepareLines3D()
+ void IntTools_FaceFace::PrepareLines3D(const Standard_Boolean bToSplit)
{
- Standard_Integer i, aNbCurves, j, aNbNewCurves;
+ Standard_Integer i, aNbCurves;
+ GeomAbs_SurfaceType aType1, aType2;
IntTools_SequenceOfCurves aNewCvs;
-
//
- // 1. Treatment of periodic and closed curves
+ // 1. Treatment closed curves
aNbCurves=mySeqOfCurve.Length();
- for (i=1; i<=aNbCurves; i++) {
+ for (i=1; i<=aNbCurves; ++i) {
const IntTools_Curve& aIC=mySeqOfCurve(i);
- // DEBUG
- // const Handle(Geom_Curve)& aC3D =aIC.Curve();
- // const Handle(Geom2d_Curve)& aC2D1=aIC.FirstCurve2d();
- // const Handle(Geom2d_Curve)& aC2D2=aIC.SecondCurve2d();
//
- IntTools_SequenceOfCurves aSeqCvs;
- aNbNewCurves=IntTools_Tools::SplitCurve(aIC, aSeqCvs);
-
- if (aNbNewCurves) {
- for (j=1; j<=aNbNewCurves; j++) {
- const IntTools_Curve& aICNew=aSeqCvs(j);
- aNewCvs.Append(aICNew);
+ if (bToSplit) {
+ Standard_Integer j, aNbC;
+ IntTools_SequenceOfCurves aSeqCvs;
+ //
+ aNbC=IntTools_Tools::SplitCurve(aIC, aSeqCvs);
+ if (aNbC) {
+ for (j=1; j<=aNbC; ++j) {
+ const IntTools_Curve& aICNew=aSeqCvs(j);
+ aNewCvs.Append(aICNew);
+ }
+ }
+ else {
+ aNewCvs.Append(aIC);
}
}
- //
else {
aNewCvs.Append(aIC);
}
}
//
// 2. Plane\Cone intersection when we had 4 curves
- GeomAbs_SurfaceType aType1, aType2;
- BRepAdaptor_Surface aBS1, aBS2;
-
- aBS1.Initialize(myFace1);
- aType1=aBS1.GetType();
-
- aBS2.Initialize(myFace2);
- aType2=aBS2.GetType();
-
+ aType1=myHS1->GetType();
+ aType2=myHS2->GetType();
+ aNbCurves=aNewCvs.Length();
+ //
if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Cone) ||
(aType2==GeomAbs_Plane && aType1==GeomAbs_Cone)) {
- aNbCurves=aNewCvs.Length();
if (aNbCurves==4) {
- GeomAbs_CurveType aCType1=aNewCvs(1).Type();
+ GeomAbs_CurveType aCType1;
+ //
+ aCType1=aNewCvs(1).Type();
if (aCType1==GeomAbs_Line) {
IntTools_SequenceOfCurves aSeqIn, aSeqOut;
//
- for (i=1; i<=aNbCurves; i++) {
+ for (i=1; i<=aNbCurves; ++i) {
const IntTools_Curve& aIC=aNewCvs(i);
aSeqIn.Append(aIC);
}
//
aNewCvs.Clear();
aNbCurves=aSeqOut.Length();
- for (i=1; i<=aNbCurves; i++) {
+ for (i=1; i<=aNbCurves; ++i) {
const IntTools_Curve& aIC=aSeqOut(i);
aNewCvs.Append(aIC);
}
- //
}
}
- }// end of if ((aType1==GeomAbs_Plane && ...
+ }// if ((aType1==GeomAbs_Plane && aType2==GeomAbs_Cone)...
//
// 3. Fill mySeqOfCurve
mySeqOfCurve.Clear();
aNbCurves=aNewCvs.Length();
- for (i=1; i<=aNbCurves; i++) {
+ for (i=1; i<=aNbCurves; ++i) {
const IntTools_Curve& aIC=aNewCvs(i);
mySeqOfCurve.Append(aIC);
}
-
}
-
-
+//modified by NIZNHY-PKV Fri Sep 16 07:57:32 2011t
//=======================================================================
//function : CorrectSurfaceBoundaries
//purpose :