diff --git a/src/IntPolyh/FILES b/src/IntPolyh/FILES index 92f175fac3..94227e60e6 100755 --- a/src/IntPolyh/FILES +++ b/src/IntPolyh/FILES @@ -1,3 +1,3 @@ IntPolyh_Intersection_1.cxx -IntPolyh_MaillageAffinage_1.cxx + diff --git a/src/IntPolyh/IntPolyh_MaillageAffinage.cxx b/src/IntPolyh/IntPolyh_MaillageAffinage.cxx index 1ff1384446..2fb23f992e 100755 --- a/src/IntPolyh/IntPolyh_MaillageAffinage.cxx +++ b/src/IntPolyh/IntPolyh_MaillageAffinage.cxx @@ -14,67 +14,140 @@ // Modified by skv - Thu Sep 25 17:42:42 2003 OCC567 // modified by ofv Thu Apr 8 14:58:13 2004 fip -//#ifndef _maillIso_HeaderFile -//#define _maillIso_HeaderFile -//#endif -#include - -#include +#include #include -#include +#include +#include + +#include + +#include +#include + +#include + +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include +static Standard_Real MyTolerance=10.0e-7; +static Standard_Real MyConfusionPrecision=10.0e-12; +static Standard_Real SquareMyConfusionPrecision=10.0e-24; +// +static + inline Standard_Real maxSR(const Standard_Real a, + const Standard_Real b, + const Standard_Real c); -# ifdef DEB -#include -#include -#include -#include -#include -#include -#ifdef DRAW -#include -#endif -# endif +static + inline Standard_Real minSR(const Standard_Real a, + const Standard_Real b, + const Standard_Real c); +static + Standard_Integer project6(const IntPolyh_Point &ax, + const IntPolyh_Point &p1, + const IntPolyh_Point &p2, + const IntPolyh_Point &p3, + const IntPolyh_Point &q1, + const IntPolyh_Point &q2, + const IntPolyh_Point &q3); +static + void TestNbPoints(const Standard_Integer , + Standard_Integer &NbPoints, + Standard_Integer &NbPointsTotal, + const IntPolyh_StartPoint &Pt1, + const IntPolyh_StartPoint &Pt2, + IntPolyh_StartPoint &SP1, + IntPolyh_StartPoint &SP2); +static + void CalculPtsInterTriEdgeCoplanaires(const Standard_Integer TriSurfID, + const IntPolyh_Point &NormaleTri, + const IntPolyh_Point &PE1, + const IntPolyh_Point &PE2, + const IntPolyh_Point &Edge, + const IntPolyh_Point &PT1, + const IntPolyh_Point &PT2, + const IntPolyh_Point &Cote, + const Standard_Integer CoteIndex, + IntPolyh_StartPoint &SP1, + IntPolyh_StartPoint &SP2, + Standard_Integer &NbPoints); +static + void CalculPtsInterTriEdgeCoplanaires2(const Standard_Integer TriSurfID, + const IntPolyh_Point &NormaleTri, + const IntPolyh_Triangle &Tri1, + const IntPolyh_Triangle &Tri2, + const IntPolyh_Point &PE1, + const IntPolyh_Point &PE2, + const IntPolyh_Point &Edge, + const Standard_Integer EdgeIndex, + const IntPolyh_Point &PT1, + const IntPolyh_Point &PT2, + const IntPolyh_Point &Cote, + const Standard_Integer CoteIndex, + IntPolyh_StartPoint &SP1, + IntPolyh_StartPoint &SP2, + Standard_Integer &NbPoints); +static + Standard_Integer CheckCoupleAndGetAngle(const Standard_Integer T1, + const Standard_Integer T2, + Standard_Real& Angle, + IntPolyh_ArrayOfCouples &TTrianglesContacts); +static + Standard_Integer CheckCoupleAndGetAngle2(const Standard_Integer T1, + const Standard_Integer T2, + const Standard_Integer T11, + const Standard_Integer T22, + Standard_Integer &CT11, + Standard_Integer &CT22, + Standard_Real & Angle, + IntPolyh_ArrayOfCouples &TTrianglesContacts); +static + Standard_Integer CheckNextStartPoint(IntPolyh_SectionLine & SectionLine, + IntPolyh_ArrayOfTangentZones & TTangentZones, + IntPolyh_StartPoint & SP, + const Standard_Boolean Prepend=Standard_False); -//# ifdef DEB - //# define MYDEBUG DEB -Standard_Integer MYDRAW = 0; -//# else - //# define MYDEBUG 0 -//# endif - -Standard_Integer MYPRINTma = 0; - -#define MyTolerance 10.0e-7 -#define MyConfusionPrecision 10.0e-12 -#define SquareMyConfusionPrecision 10.0e-24 +//modified by NIZNHY-PKV Fri Jan 20 11:01:30 2012f +static + Standard_Boolean IsDegenerated(const Handle(Adaptor3d_HSurface)& aS, + const Standard_Integer aIndex, + const Standard_Real aTol2, + Standard_Real& aDegX); +static + void DegeneratedIndex(const TColStd_Array1OfReal& Xpars, + const Standard_Integer aNbX, + const Handle(Adaptor3d_HSurface)& aS, + const Standard_Integer aIsoDirection, + Standard_Integer& aI1, + Standard_Integer& aI2); +//modified by NIZNHY-PKV Fri Jan 20 11:01:32 2012t //======================================================================= //function : IntPolyh_MaillageAffinage //purpose : //======================================================================= - -IntPolyh_MaillageAffinage::IntPolyh_MaillageAffinage(const Handle(Adaptor3d_HSurface)& Surface1, - const Handle(Adaptor3d_HSurface)& Surface2, - const Standard_Integer PRINT): - MaSurface1(Surface1), MaSurface2(Surface2), - NbSamplesU1(10), NbSamplesU2(10), NbSamplesV1(10), NbSamplesV2(10), - FlecheMax1(0.0), FlecheMax2(0.0), FlecheMin1(0.0), FlecheMin2(0.0), - FlecheMoy1(0.0), FlecheMoy2(0.0), myEnlargeZone(Standard_False) +IntPolyh_MaillageAffinage::IntPolyh_MaillageAffinage + (const Handle(Adaptor3d_HSurface)& Surface1, + const Handle(Adaptor3d_HSurface)& Surface2, + const Standard_Integer ) +: + MaSurface1(Surface1), + MaSurface2(Surface2), + NbSamplesU1(10), + NbSamplesU2(10), + NbSamplesV1(10), + NbSamplesV2(10), + FlecheMax1(0.0), + FlecheMax2(0.0), + FlecheMin1(0.0), + FlecheMin2(0.0), + FlecheMoy1(0.0), + FlecheMoy2(0.0), + myEnlargeZone(Standard_False) { - MYPRINTma = PRINT; TPoints1.Init(10000); TEdges1.Init(30000); TTriangles1.Init(20000); @@ -85,26 +158,33 @@ IntPolyh_MaillageAffinage::IntPolyh_MaillageAffinage(const Handle(Adaptor3d_HSur TStartPoints.Init(10000); } - //======================================================================= //function : IntPolyh_MaillageAffinage //purpose : //======================================================================= - -IntPolyh_MaillageAffinage::IntPolyh_MaillageAffinage(const Handle(Adaptor3d_HSurface)& Surface1, - const Standard_Integer NbSU1, - const Standard_Integer NbSV1, - const Handle(Adaptor3d_HSurface)& Surface2, - const Standard_Integer NbSU2, - const Standard_Integer NbSV2, - const Standard_Integer PRINT): - MaSurface1(Surface1), MaSurface2(Surface2), - NbSamplesU1(NbSU1), NbSamplesU2(NbSU2), NbSamplesV1(NbSV1), NbSamplesV2(NbSV2), - FlecheMax1(0.0), FlecheMax2(0.0), FlecheMin1(0.0), FlecheMin2(0.0), - FlecheMoy1(0.0), FlecheMoy2(0.0), myEnlargeZone(Standard_False) +IntPolyh_MaillageAffinage::IntPolyh_MaillageAffinage + (const Handle(Adaptor3d_HSurface)& Surface1, + const Standard_Integer NbSU1, + const Standard_Integer NbSV1, + const Handle(Adaptor3d_HSurface)& Surface2, + const Standard_Integer NbSU2, + const Standard_Integer NbSV2, + const Standard_Integer ) +: + MaSurface1(Surface1), + MaSurface2(Surface2), + NbSamplesU1(NbSU1), + NbSamplesU2(NbSU2), + NbSamplesV1(NbSV1), + NbSamplesV2(NbSV2), + FlecheMax1(0.0), + FlecheMax2(0.0), + FlecheMin1(0.0), + FlecheMin2(0.0), + FlecheMoy1(0.0), + FlecheMoy2(0.0), + myEnlargeZone(Standard_False) { - MYPRINTma = PRINT; - TPoints1.Init(10000); TEdges1.Init(30000); TTriangles1.Init(20000); @@ -115,23 +195,26 @@ IntPolyh_MaillageAffinage::IntPolyh_MaillageAffinage(const Handle(Adaptor3d_HSur TStartPoints.Init(10000); } - - //======================================================================= //function : FillArrayOfPnt //purpose : Compute points on one surface and fill an array of points //======================================================================= -void IntPolyh_MaillageAffinage::FillArrayOfPnt(const Standard_Integer SurfID) +void IntPolyh_MaillageAffinage::FillArrayOfPnt + (const Standard_Integer SurfID) { - Handle(Adaptor3d_HSurface) MaSurface=(SurfID==1)? MaSurface1:MaSurface2; + Standard_Integer NbSamplesU, NbSamplesV; + Standard_Real u0, u1, v0, v1; + Handle(Adaptor3d_HSurface) MaSurface; + // + MaSurface=(SurfID==1)? MaSurface1:MaSurface2; IntPolyh_ArrayOfPoints &TPoints=(SurfID==1)? TPoints1:TPoints2; - Standard_Integer NbSamplesU=(SurfID==1)? NbSamplesU1:NbSamplesU2; - Standard_Integer NbSamplesV=(SurfID==1)? NbSamplesV1:NbSamplesV2; - - Standard_Real u0 = (MaSurface)->FirstUParameter(); - Standard_Real u1 = (MaSurface)->LastUParameter(); - Standard_Real v0 = (MaSurface)->FirstVParameter(); - Standard_Real v1 = (MaSurface)->LastVParameter(); + NbSamplesU=(SurfID==1)? NbSamplesU1:NbSamplesU2; + NbSamplesV=(SurfID==1)? NbSamplesV1:NbSamplesV2; + // + u0 = (MaSurface)->FirstUParameter(); + u1 = (MaSurface)->LastUParameter(); + v0 = (MaSurface)->FirstVParameter(); + v1 = (MaSurface)->LastVParameter(); if(myEnlargeZone) { if(MaSurface->GetType() == GeomAbs_BSplineSurface || @@ -150,42 +233,52 @@ void IntPolyh_MaillageAffinage::FillArrayOfPnt(const Standard_Integer SurfID) } } } - - Standard_Integer CpteurTabPnt=0; - Standard_Real itU=(u1-u0)/Standard_Real(NbSamplesU-1); - Standard_Real itV=(v1-v0)/Standard_Real(NbSamplesV-1); + // + Standard_Integer iCnt, BoucleU, BoucleV; + Standard_Real itU, itV, U, V, Tol; + Bnd_Box *PtrBox; + gp_Pnt PtXYZ; + // + iCnt=0; + itU=(u1-u0)/Standard_Real(NbSamplesU-1); + itV=(v1-v0)/Standard_Real(NbSamplesV-1); + PtrBox = (SurfID==1) ? (&MyBox1) : (&MyBox2); - Bnd_Box *PtrBox = (SurfID==1) ? (&MyBox1) : (&MyBox2); - - for(Standard_Integer BoucleU=0; BoucleUValue(U,V); - (TPoints[CpteurTabPnt]).Set(PtXYZ.X(), PtXYZ.Y(), PtXYZ.Z(), U, V); - CpteurTabPnt++; + for(BoucleU=0; BoucleUValue(U,V); + IntPolyh_Point& aIPnt=TPoints[iCnt]; + aIPnt.Set(PtXYZ.X(), PtXYZ.Y(), PtXYZ.Z(), U, V); + iCnt++; PtrBox->Add(PtXYZ); } } - TPoints.SetNbPoints(CpteurTabPnt); - - IntCurveSurface_ThePolyhedronOfHInter polyhedron(MaSurface,NbSamplesU,NbSamplesV,u0,v0,u1,v1); - Standard_Real Tol=polyhedron.DeflectionOverEstimation(); + TPoints.SetNbPoints(iCnt); + // + IntCurveSurface_ThePolyhedronOfHInter polyhedron(MaSurface, + NbSamplesU, + NbSamplesV, + u0,v0, + u1,v1); + Tol=polyhedron.DeflectionOverEstimation(); Tol*=1.2; - + // Standard_Real a1,a2,a3,b1,b2,b3; + // PtrBox->Get(a1,a2,a3,b1,b2,b3); PtrBox->Update(a1-Tol,a2-Tol,a3-Tol,b1+Tol,b2+Tol,b3+Tol); PtrBox->Enlarge(MyTolerance); } - //======================================================================= //function : FillArrayOfPnt //purpose : Compute points on one surface and fill an array of points // FILL AN ARRAY OF POINTS //======================================================================= -void IntPolyh_MaillageAffinage::FillArrayOfPnt(const Standard_Integer SurfID, - const Standard_Boolean isShiftFwd) +void IntPolyh_MaillageAffinage::FillArrayOfPnt + (const Standard_Integer SurfID, + const Standard_Boolean isShiftFwd) { Handle(Adaptor3d_HSurface) MaSurface=(SurfID==1)? MaSurface1:MaSurface2; @@ -216,7 +309,11 @@ void IntPolyh_MaillageAffinage::FillArrayOfPnt(const Standard_Integer SurfID, } } - IntCurveSurface_ThePolyhedronOfHInter polyhedron(MaSurface,NbSamplesU,NbSamplesV,u0,v0,u1,v1); + IntCurveSurface_ThePolyhedronOfHInter polyhedron(MaSurface, + NbSamplesU, + NbSamplesV, + u0,v0, + u1,v1); Standard_Real Tol=polyhedron.DeflectionOverEstimation(); Standard_Integer CpteurTabPnt=0; @@ -263,8 +360,170 @@ void IntPolyh_MaillageAffinage::FillArrayOfPnt(const Standard_Integer SurfID, PtrBox->Get(a1,a2,a3,b1,b2,b3); PtrBox->Update(a1-Tol,a2-Tol,a3-Tol,b1+Tol,b2+Tol,b3+Tol); PtrBox->Enlarge(MyTolerance); -}//fin FillArrayOfPnt +} +//======================================================================= +//function : FillArrayOfPnt +//purpose : Compute points on one surface and fill an array of points +//======================================================================= +void IntPolyh_MaillageAffinage::FillArrayOfPnt + (const Standard_Integer SurfID, + const TColStd_Array1OfReal& Upars, + const TColStd_Array1OfReal& Vpars) +{ + Standard_Boolean bDegI, bDeg; + Standard_Integer aNbU, aNbV, iCnt, i, j; + Standard_Integer aID1, aID2, aJD1, aJD2; + Standard_Real aTol, aU, aV, aX, aY, aZ, aDegX, aTol2; + gp_Pnt aP; + // + aNbU=(SurfID==1)? NbSamplesU1 : NbSamplesU2; + aNbV=(SurfID==1)? NbSamplesV1 : NbSamplesV2; + Bnd_Box& aBox = (SurfID==1) ? MyBox1 : MyBox2; + Handle(Adaptor3d_HSurface)& aS=(SurfID==1)? MaSurface1:MaSurface2; + IntPolyh_ArrayOfPoints &TPoints=(SurfID==1)? TPoints1:TPoints2; + // + //modified by NIZNHY-PKV Fri Jan 20 09:48:57 2012f + aJD1=0; + aJD2=0; + aID1=0; + aID2=0; + DegeneratedIndex(Vpars, aNbV, aS, 1, aJD1, aJD2); + if (!(aJD1 || aJD2)) { + DegeneratedIndex(Upars, aNbU, aS, 2, aID1, aID2); + } + //modified by NIZNHY-PKV Fri Jan 20 09:49:00 2012t + // + iCnt=0; + for(i=1; i<=aNbU; ++i){ + //modified by NIZNHY-PKV Fri Jan 20 13:59:15 2012f + bDegI=(aID1==i || aID2==i); + //modified by NIZNHY-PKV Fri Jan 20 13:59:17 2012t + aU=Upars(i); + for(j=1; j<=aNbV; ++j){ + aV=Vpars(j); + aP=aS->Value(aU, aV); + aP.Coord(aX, aY, aZ); + IntPolyh_Point& aIP=TPoints[iCnt]; + aIP.Set(aX, aY, aZ, aU, aV); + // + //modified by NIZNHY-PKV Fri Jan 20 13:59:06 2012f + bDeg=bDegI || (aJD1==j || aJD2==j); + if (bDeg) { + aIP.SetDegenerated(bDeg); + } + //modified by NIZNHY-PKV Fri Jan 20 13:59:02 2012t + ++iCnt; + aBox.Add(aP); + } + } + // + TPoints.SetNbPoints(iCnt); + // + IntCurveSurface_ThePolyhedronOfHInter polyhedron(aS, Upars, Vpars); + // + aTol=polyhedron.DeflectionOverEstimation(); + aTol*=1.2; + Standard_Real a1,a2,a3,b1,b2,b3; + // + aBox.Get(a1,a2,a3,b1,b2,b3); + aBox.Update(a1-aTol,a2-aTol,a3-aTol,b1+aTol,b2+aTol,b3+aTol); + aBox.Enlarge(MyTolerance); +} + +//======================================================================= +//function : FillArrayOfPnt +//purpose : Compute points on one surface and fill an array of points +// REMPLISSAGE DU TABLEAU DE POINTS +//======================================================================= +void IntPolyh_MaillageAffinage::FillArrayOfPnt + (const Standard_Integer SurfID, + const Standard_Boolean isShiftFwd, + const TColStd_Array1OfReal& Upars, + const TColStd_Array1OfReal& Vpars) +{ + Standard_Boolean bDegI, bDeg; + Standard_Integer aNbU, aNbV, iCnt, i, j; + Standard_Integer aID1, aID2, aJD1, aJD2; + Standard_Real Tol, resol, u0, v0, u1, v1, aU, aV, aMag; + Standard_Real aX, aY, aZ; + gp_Pnt aP; + gp_Vec aDU, aDV, aNorm; + // + aNbU=(SurfID==1)? NbSamplesU1:NbSamplesU2; + aNbV=(SurfID==1)? NbSamplesV1:NbSamplesV2; + Bnd_Box& aBox = (SurfID==1) ? MyBox1 : MyBox2; + Handle(Adaptor3d_HSurface) aS=(SurfID==1)? MaSurface1:MaSurface2; + IntPolyh_ArrayOfPoints &TPoints=(SurfID==1)? TPoints1:TPoints2; + // + resol = gp::Resolution(); + u0 = Upars(1); + v0 = Vpars(1); + u1 = Upars(aNbU); + v1 = Vpars(aNbV); + // + IntCurveSurface_ThePolyhedronOfHInter polyhedron(aS, Upars, Vpars); + Tol=polyhedron.DeflectionOverEstimation(); + //modified by NIZNHY-PKV Fri Jan 20 09:48:57 2012f + aJD1=0; + aJD2=0; + aID1=0; + aID2=0; + DegeneratedIndex(Vpars, aNbV, aS, 1, aJD1, aJD2); + if (!(aJD1 || aJD2)) { + DegeneratedIndex(Upars, aNbU, aS, 2, aID1, aID2); + } + //modified by NIZNHY-PKV Fri Jan 20 09:49:00 2012t + // + iCnt=0; + for(i=1; i<=aNbU; ++i){ + //modified by NIZNHY-PKV Fri Jan 20 13:59:15 2012f + bDegI=(aID1==i || aID2==i); + //modified by NIZNHY-PKV Fri Jan 20 13:59:17 2012t + aU = Upars(i); + for(j=1; j<=aNbV; ++j){ + aV = Vpars(j); + aS->D1(aU, aV, aP, aDU, aDV); + + aNorm = aDU.Crossed(aDV); + aMag = aNorm.Magnitude(); + if (aMag > resol) { + aNorm /= aMag; + aNorm.Multiply(Tol*1.5); + // + if (isShiftFwd) { + aP.Translate(aNorm); + } + else{ + aP.Translate(aNorm.Reversed()); + } + } + + IntPolyh_Point& aIP=TPoints[iCnt]; + aP.Coord(aX, aY, aZ); + aIP.Set(aX, aY, aZ, aU, aV); + // + //modified by NIZNHY-PKV Fri Jan 20 13:59:06 2012f + bDeg=bDegI || (aJD1==j || aJD2==j); + if (bDeg) { + aIP.SetDegenerated(bDeg); + } + //modified by NIZNHY-PKV Fri Jan 20 13:59:02 2012t + ++iCnt; + aBox.Add(aP); + } + } + // + TPoints.SetNbPoints(iCnt); + // + Tol*=1.2; + // + Standard_Real a1,a2,a3,b1,b2,b3; + // + aBox.Get(a1,a2,a3,b1,b2,b3); + aBox.Update(a1-Tol,a2-Tol,a3-Tol,b1+Tol,b2+Tol,b3+Tol); + aBox.Enlarge(MyTolerance); +} //======================================================================= //function : CommonBox //purpose : Compute the common box witch is the intersection @@ -273,64 +532,43 @@ void IntPolyh_MaillageAffinage::FillArrayOfPnt(const Standard_Integer SurfID, // REJECTION BOUNDING BOXES // DETERMINATION OF THE COMMON BOX //======================================================================= - -//void IntPolyh_MaillageAffinage::CommonBox(const Bnd_Box &MyB1,const Bnd_Box &MyB2, -void IntPolyh_MaillageAffinage::CommonBox(const Bnd_Box &,const Bnd_Box &, - Standard_Real &XMin,Standard_Real &YMin,Standard_Real &ZMin, - Standard_Real &XMax,Standard_Real &YMax,Standard_Real &ZMax) { +void IntPolyh_MaillageAffinage::CommonBox (const Bnd_Box &, + const Bnd_Box &, + Standard_Real &XMin, + Standard_Real &YMin, + Standard_Real &ZMin, + Standard_Real &XMax, + Standard_Real &YMax, + Standard_Real &ZMax) +{ Standard_Real x10,y10,z10,x11,y11,z11; Standard_Real x20,y20,z20,x21,y21,z21; MyBox1.Get(x10,y10,z10,x11,y11,z11); MyBox2.Get(x20,y20,z20,x21,y21,z21); - // modified by NIZHNY-MKK Mon Apr 2 12:09:10 2001.BEGIN XMin = 0.; YMin = 0.; ZMin = 0.; XMax = 0.; YMax = 0.; ZMax = 0.; - // modified by NIZHNY-MKK Mon Apr 2 12:09:16 2001.END if((x10>x21)||(x20>x11)||(y10>y21)||(y20>y11)||(z10>z21)||(z20>z11)) { -# if MYDEBUG -// printf("\nCommon Box from IntPolyh_MaillageAffinage : ERROR There is no intersection between boxes\n"); -#endif - // modified by NIZHNY-MKK Mon Apr 2 12:09:31 2001 - // x10=y10=z10=x11=y11=z11=x20=y20=z20=x21=y21=z21=0; } else { - // modified by NIZHNY-MKK Mon Apr 2 12:09:49 2001.BEGIN - // it is not neccessary to check some conditions, because of conditions of previous if operator - - // if((x11>x20)&&(x11<=x21)) XMax=x11; else { if((x21>x10)&&(x21<=x11)) XMax=x21;} if(x11<=x21) XMax=x11; else { if(x21<=x11) XMax=x21;} - // if((x10>=x20)&&(x10=x10)&&(x20y20)&&(y11<=y21)) YMax=y11; else { if((y21>y10)&&(y21<=y11)) YMax=y21;} if(y11<=y21) YMax=y11; else { if(y21<=y11) YMax=y21;} - // if((y10>=y20)&&(y10=y10)&&(y20z20)&&(z11<=z21)) ZMax=z11; else { if((z21>z10)&&(z21<=z11)) ZMax=z21;} if(z11<=z21) ZMax=z11; else { if(z21<=z11) ZMax=z21;} - // if((z10>=z20)&&(z10=z10)&&(z20XMax) { r=2; } else { r=0; } } - if(Pt1.Y()YMax) { r|=8; } } - if(Pt1.Z()ZMax) { r|=32;} } + if(Pt1.X()XMax) { + r=2; + } else { + r=0; + } + } + if(Pt1.Y()YMax) { + r|=8; + } + } + if(Pt1.Z()ZMax) { + r|=32; + } + } Pt1.SetPartOfCommon(r); } @@ -376,33 +634,43 @@ void IntPolyh_MaillageAffinage::CommonBox(const Bnd_Box &,const Bnd_Box &, for(Standard_Integer ii=0; iiXMax) { rr=2; } else { rr=0; } } - if(Pt2.Y()YMax) { rr|=8; } } - if(Pt2.Z()ZMax) { rr|=32;} } + if(Pt2.X()XMax) { + rr=2; + } else { + rr=0; + } + } + if(Pt2.Y()YMax) { + rr|=8; + } + } + if(Pt2.Z()ZMax) { + rr|=32; + } + } Pt2.SetPartOfCommon(rr); } -# if MYDEBUG - if (MYPRINTma) { -// printf("\n Surface1's points included in the Common Box\n"); - -// for(Standard_Integer ip=0;iChangeNodes(); - Poly_Array1OfTriangle & aPTrialgles = aPTriangulation->ChangeTriangles(); - - Standard_Integer i; - for (i=0; iTriangulation(aPTriangulation); - aFace.TShape(aTFace); - return aFace; -} -#endif - //======================================================================= //function : LinkEdges2Triangles //purpose : fill the edge fields in Triangle object for the // two array of triangles. //======================================================================= - -void IntPolyh_MaillageAffinage::LinkEdges2Triangles() { -#if MYDEBUG - const Standard_Integer FinTE1 = TEdges1.NbEdges(); - const Standard_Integer FinTE2 = TEdges2.NbEdges(); -#endif +void IntPolyh_MaillageAffinage::LinkEdges2Triangles() +{ const Standard_Integer FinTT1 = TTriangles1.NbTriangles(); const Standard_Integer FinTT2 = TTriangles2.NbTriangles(); @@ -672,41 +880,14 @@ void IntPolyh_MaillageAffinage::LinkEdges2Triangles() { MyTriangle2.SetEdgeandOrientation(3,TEdges2); } } -# if MYDEBUG - if (MYPRINTma) { -// printf("LinkEdges2Triangles() from IntPolyh_MaillageAffinage.cxx\n"); -// printf("\n Display Surface1's edges linked to triangles \n"); -// for(Standard_Integer ii1=0; ii1 0) { - //DBRep::Set("FinTri1", TriangleShape(TTriangles1,TPoints1)); - } - if (FinTT2 > 0) { - //DBRep::Set("FinTri2", TriangleShape(TTriangles2,TPoints2)); - } - } -# endif } - //======================================================================= //function : CommonPartRefinement //purpose : Refine systematicaly all marked triangles of both surfaces // REFINING OF THE COMMON //======================================================================= - -void IntPolyh_MaillageAffinage::CommonPartRefinement() { - +void IntPolyh_MaillageAffinage::CommonPartRefinement() +{ Standard_Integer FinInit1 = TTriangles1.NbTriangles(); for(Standard_Integer i=0; i deflection max // --> deflection min //======================================================================= - -void IntPolyh_MaillageAffinage::ComputeDeflections(const Standard_Integer SurfID){ - +void IntPolyh_MaillageAffinage::ComputeDeflections + (const Standard_Integer SurfID) +{ Handle(Adaptor3d_HSurface) MaSurface=(SurfID==1)? MaSurface1:MaSurface2; IntPolyh_ArrayOfPoints &TPoints=(SurfID==1)? TPoints1:TPoints2; IntPolyh_ArrayOfTriangles &TTriangles=(SurfID==1)? TTriangles1:TTriangles2; @@ -793,33 +951,19 @@ void IntPolyh_MaillageAffinage::ComputeDeflections(const Standard_Integer SurfID for(CpteurTabFleche=0; CpteurTabFleche FlecheMax) FlecheMax=Fleche; if (Fleche < FlecheMin) FlecheMin=Fleche; -# if MYDEBUG - FlecheMoy=FlecheMoy+Fleche; -# endif } } -# if MYDEBUG - FlecheMoy/=(Standard_Real)FinTT; - //ofv - //printf("fleche Mini: %f fleche Maxi: %f fleche Moyenne: %f\n", FlecheMin, FlecheMax, FlecheMoy); -# endif } - //======================================================================= //function : TrianglesDeflectionsRefinementBSB //purpose : Refine both surfaces using BoundSortBox as -- @@ -828,31 +972,22 @@ void IntPolyh_MaillageAffinage::ComputeDeflections(const Standard_Integer SurfID // bounding boxes (one surface may be very small // compared to the other) //======================================================================= - -void IntPolyh_MaillageAffinage::TrianglesDeflectionsRefinementBSB() { - +void IntPolyh_MaillageAffinage::TrianglesDeflectionsRefinementBSB() +{ const Standard_Integer FinTT1 = TTriangles1.NbTriangles(); const Standard_Integer FinTT2 = TTriangles2.NbTriangles(); - -# if MYDEBUG - Standard_Integer NbTriDepart1 = FinTT1; - Standard_Integer NbTriDepart2 = FinTT2; -# endif ComputeDeflections(1); - // To estimate a surface in general it can be interesting to calculate all deflections + // To estimate a surface in general it can be interesting + //to calculate all deflections //-- Check deflection at output Standard_Real FlecheCritique1; if(FlecheMin1>FlecheMax1) { -# if MYDEBUG -// printf("\n TrianglesDeflectionsRefinementBSB() from IntPolyh_MaillageAffinage :\n"); -// printf("ERROR FlecheMin1>FlecheMax1\n"); -# endif return; } - else { - FlecheCritique1 = FlecheMin1*0.2+FlecheMax1*0.8;//fleche min + (flechemax-flechemin) * 80/100 + else {//fleche min + (flechemax-flechemin) * 80/100 + FlecheCritique1 = FlecheMin1*0.2+FlecheMax1*0.8; } ComputeDeflections(2); @@ -860,14 +995,11 @@ void IntPolyh_MaillageAffinage::TrianglesDeflectionsRefinementBSB() { Standard_Real FlecheCritique2; if(FlecheMin2>FlecheMax2) { -# if MYDEBUG -// printf("\n TrianglesDeflectionsRefinementBSB() from IntPolyh_MaillageAffinage :\n"); -// printf("ERROR FlecheMin2>FlecheMax2\n"); -# endif + return; } - else { - FlecheCritique2 = FlecheMin2*0.2+FlecheMax2*0.8;//fleche min + (flechemax-flechemin) * 80/100 + else {//fleche min + (flechemax-flechemin) * 80/100 + FlecheCritique2 = FlecheMin2*0.2+FlecheMax2*0.8; } //Bounding boxes @@ -876,8 +1008,8 @@ void IntPolyh_MaillageAffinage::TrianglesDeflectionsRefinementBSB() { Standard_Real x0,y0,z0,x1,y1,z1; //The greatest of two bounding boxes created in FillArrayOfPoints is found. - //Then this value is weighted depending on the discretization (NbSamplesU and NbSamplesV) - + //Then this value is weighted depending on the discretization + //(NbSamplesU and NbSamplesV) MyBox1.Get(x0,y0,z0,x1,y1,z1); x0-=x1; y0-=y1; z0-=z1; diag1=x0*x0+y0*y0+z0*z0; @@ -950,7 +1082,8 @@ void IntPolyh_MaillageAffinage::TrianglesDeflectionsRefinementBSB() { Iter.More(); Iter.Next()) { Standard_Integer i_S2=Iter.Value()-1; - //if the box of s1 contacts with the boxes of s2 the arrow of the triangle is checked + //if the box of s1 contacts with the boxes of s2 + //the arrow of the triangle is checked IntPolyh_Triangle & Triangle2 = TTriangles2[i_S2]; if(Triangle2.IndiceIntersectionPossible()!=0) if(Triangle2.GetFleche()>FlecheCritique2) @@ -996,7 +1129,8 @@ void IntPolyh_MaillageAffinage::TrianglesDeflectionsRefinementBSB() { const TColStd_ListOfInteger& ListeOf2 = BndBSB.Compare(MyBox1); if((ListeOf2.IsEmpty())==0) { - //if the bounding box Be1 of s1 contacts with the boxes of s2 the deflection of triangle of s2 is checked + //if the bounding box Be1 of s1 contacts with + //the boxes of s2 the deflection of triangle of s2 is checked // Be1 is very small in relation to Be2 //The criterion of refining for surface2 depends on the size of Be1 @@ -1014,7 +1148,8 @@ void IntPolyh_MaillageAffinage::TrianglesDeflectionsRefinementBSB() { dd=dx; if (diag>dd) diag=dd; - //if Be1 contacts with the boxes of s2, the deflection of the triangles of s2 is checked (greater) + //if Be1 contacts with the boxes of s2, the deflection + //of the triangles of s2 is checked (greater) //in relation to the size of Be1 (smaller) for (TColStd_ListIteratorOfListOfInteger Iter(ListeOf2); Iter.More(); @@ -1138,11 +1273,13 @@ void IntPolyh_MaillageAffinage::TrianglesDeflectionsRefinementBSB() { const TColStd_ListOfInteger& ListeOf1 = BndBSB.Compare(MyBox2); if((ListeOf1.IsEmpty())==0) { - //if the bounding box Be2 of s2 contacts with boxes of s1 the deflection of the triangle of s1 is checked + //if the bounding box Be2 of s2 contacts + //with boxes of s1 the deflection of the triangle of s1 is checked // Be2 is very small compared to Be1 //The criterion of refining for surface1 depends on the size of Be2 - //As this criterion should be minimized, the smallest side of the bounding box is taken + //As this criterion should be minimized, + //the smallest side of the bounding box is taken Standard_Real x0,x1,y0,y1,z0,z1; MyBox2.Get(x0,y0,z0,x1,y1,z1); Standard_Real dx=Abs(x1-x0); @@ -1155,7 +1292,8 @@ void IntPolyh_MaillageAffinage::TrianglesDeflectionsRefinementBSB() { dd=dx; if (diag>dd) diag=dd; - //if Be2 contacts with boxes of s1, the deflection of triangles of s1 (greater) is checked + //if Be2 contacts with boxes of s1, the deflection of + //triangles of s1 (greater) is checked //comparatively to the size of Be2 (smaller). for (TColStd_ListIteratorOfListOfInteger Iter(ListeOf1); Iter.More(); @@ -1166,7 +1304,8 @@ void IntPolyh_MaillageAffinage::TrianglesDeflectionsRefinementBSB() { if(Triangle1.IndiceIntersectionPossible()) { //calculation of the criterion of refining - //The deflection of the greater is compared with the size of the smaller. + //The deflection of the greater is compared + //with the size of the smaller. Standard_Real CritereAffinage=0.0; Standard_Real DiagPonderation=0.5; CritereAffinage = diag*DiagPonderation;; @@ -1183,55 +1322,45 @@ void IntPolyh_MaillageAffinage::TrianglesDeflectionsRefinementBSB() { } } } -# if MYDEBUG - if (MYPRINTma) { -// printf("\n TrianglesDeflectionsRefinementBSB() from IntPolyh_MaillageAffinage :\n"); -// printf("At start NbTri1=%d NbTri2=%d\n", NbTriDepart1,NbTriDepart2); -// printf("After refinement NbTri1=%d NbTri2=%d\n", (1+FinTT1-(1+FinTT1-NbTriDepart1)/2), -// (1+FinTT2-(1+FinTT2-NbTriDepart2)/2)); -// printf("Nb of couples to try%d\n",(1+FinTT1-(1+FinTT1-NbTriDepart1)/2)*(1+FinTT2-(1+FinTT2-NbTriDepart2)/2)); - } - if (MYDRAW) { -// cout << "triangles FinTri1" << endl; -// DBRep::Set("FinTri1", TriangleShape(TTriangles1,TPoints1)); -// cout << "triangles FinTri2" << endl; -// DBRep::Set("FinTri2", TriangleShape(TTriangles2,TPoints2)); - } -# endif } - //======================================================================= //function : maxSR //purpose : This function is used for the function project6 //======================================================================= - -inline Standard_Real maxSR(const Standard_Real a,const Standard_Real b,const Standard_Real c){ +inline Standard_Real maxSR(const Standard_Real a, + const Standard_Real b, + const Standard_Real c) +{ Standard_Real t = a; if (b > t) t = b; if (c > t) t = c; return t; } - //======================================================================= //function : minSR //purpose : This function is used for the function project6 //======================================================================= - -inline Standard_Real minSR(const Standard_Real a,const Standard_Real b,const Standard_Real c){ +inline Standard_Real minSR(const Standard_Real a, + const Standard_Real b, + const Standard_Real c) +{ Standard_Real t = a; if (b < t) t = b; if (c < t) t = c; return t; } - //======================================================================= //function : project6 //purpose : This function is used for the function TriContact //======================================================================= - Standard_Integer project6(const IntPolyh_Point &ax, - const IntPolyh_Point &p1, const IntPolyh_Point &p2, const IntPolyh_Point &p3, - const IntPolyh_Point &q1, const IntPolyh_Point &q2, const IntPolyh_Point &q3){ + const IntPolyh_Point &p1, + const IntPolyh_Point &p2, + const IntPolyh_Point &p3, + const IntPolyh_Point &q1, + const IntPolyh_Point &q2, + const IntPolyh_Point &q3) +{ Standard_Real P1 = ax.Dot(p1); Standard_Real P2 = ax.Dot(p2); Standard_Real P3 = ax.Dot(p3); @@ -1248,18 +1377,21 @@ Standard_Integer project6(const IntPolyh_Point &ax, if (mn2 > mx1) return 0; return 1; } - //======================================================================= //function : TriContact //purpose : This fonction Check if two triangles are in // contact or no, return 1 if yes, return 0 // if no. //======================================================================= - -Standard_Integer IntPolyh_MaillageAffinage::TriContact( - const IntPolyh_Point &P1, const IntPolyh_Point &P2, const IntPolyh_Point &P3, - const IntPolyh_Point &Q1, const IntPolyh_Point &Q2, const IntPolyh_Point &Q3, - Standard_Real &Angle) const{ +Standard_Integer IntPolyh_MaillageAffinage::TriContact + (const IntPolyh_Point &P1, + const IntPolyh_Point &P2, + const IntPolyh_Point &P3, + const IntPolyh_Point &Q1, + const IntPolyh_Point &Q2, + const IntPolyh_Point &Q3, + Standard_Real &Angle) const +{ /** The first triangle is (p1,p2,p3). The other is (q1,q2,q3). The edges are (e1,e2,e3) and (f1,f2,f3). @@ -1351,42 +1483,33 @@ Standard_Integer IntPolyh_MaillageAffinage::TriContact( Standard_Real SqModn1=-1.0; Standard_Real SqModm1=-1.0; SqModn1=n1.SquareModulus(); - if (SqModn1>SquareMyConfusionPrecision) SqModm1=m1.SquareModulus(); - if (SqModm1>SquareMyConfusionPrecision) Angle=(n1.Dot(m1))/(sqrt(SqModn1)*sqrt(SqModm1)); - else { -# if MYDEBUG -// printf("\nTriContact() from IntPolyh_MaillageAffinage\n"); -// printf(" ERROR both normals are null\n"); -// if (MYPRINTma) { -// n1.Dump(1); -// m1.Dump(2); -// } -# endif + if (SqModn1>SquareMyConfusionPrecision){ + SqModm1=m1.SquareModulus(); + } + if (SqModm1>SquareMyConfusionPrecision) { + Angle=(n1.Dot(m1))/(sqrt(SqModn1)*sqrt(SqModm1)); } return 1; } - //======================================================================= //function : TestNbPoints //purpose : This function is used by StartingPointsResearch() to control // the number of points found keep the result in conformity (1 or 2 points) // void TestNbPoints(const Standard_Integer TriSurfID, //======================================================================= - void TestNbPoints(const Standard_Integer , Standard_Integer &NbPoints, Standard_Integer &NbPointsTotal, const IntPolyh_StartPoint &Pt1, const IntPolyh_StartPoint &Pt2, - IntPolyh_StartPoint &SP1,IntPolyh_StartPoint &SP2) { - + IntPolyh_StartPoint &SP1, + IntPolyh_StartPoint &SP2) +{ // already checked in TriangleEdgeContact2 // if( (NbPoints==2)&&(Pt1.CheckSameSP(Pt2)) ) NbPoints=1; if(NbPoints>2) { -# if MYDEBUG -// printf("TestNbPoints() in IntPolyh_MaillageAffinage.cxx : ERROR more than two start points\n"); -# endif + } else { if ( (NbPoints==1)&&(NbPointsTotal==0) ) { @@ -1429,21 +1552,17 @@ void TestNbPoints(const Standard_Integer , else NbPointsTotal=3; } } - //already checked - //It is checked if the points are not the same - // if ( (NbPointsTotal >1)&&(SP1.CheckSameSP(SP2)) ) - // NbPointsTotal=1; } - //======================================================================= //function : StartingPointsResearch //purpose : //======================================================================= - -Standard_Integer IntPolyh_MaillageAffinage::StartingPointsResearch(const Standard_Integer T1, - const Standard_Integer T2, - IntPolyh_StartPoint &SP1, - IntPolyh_StartPoint &SP2) const { +Standard_Integer IntPolyh_MaillageAffinage::StartingPointsResearch + (const Standard_Integer T1, + const Standard_Integer T2, + IntPolyh_StartPoint &SP1, + IntPolyh_StartPoint &SP2) const +{ const IntPolyh_Point &P1=TPoints1[TTriangles1[T1].FirstPoint()]; const IntPolyh_Point &P2=TPoints1[TTriangles1[T1].SecondPoint()]; const IntPolyh_Point &P3=TPoints1[TTriangles1[T1].ThirdPoint()]; @@ -1483,10 +1602,7 @@ Standard_Integer IntPolyh_MaillageAffinage::StartingPointsResearch(const Standar ///check T1 normal if(Abs(nn1modulus)1) { -# if MYDEBUG -// printf("\nNextStartingPointsResearch() from IntPolyh_MaillageAffinage.cxx : Warning,\n"); -// printf(" more than one next point NbPointsToTal=%d\n",NbPointsTotal); -// SPInit.Dump(0000); -// SP1.Dump(0001); -// SP2.Dump(0002); -# endif + } } SPNext.SetCoupleValue(T1,T2); return (NbPointsTotal); } - //======================================================================= //function : NextStartingPointsResearch2 //purpose : from two triangles and an intersection point I // seach the other point (if it exist). // This function is used by StartPointChain //======================================================================= - -Standard_Integer IntPolyh_MaillageAffinage::NextStartingPointsResearch2(const Standard_Integer T1, - const Standard_Integer T2, - const IntPolyh_StartPoint &SPInit, - IntPolyh_StartPoint &SPNext) const { +Standard_Integer IntPolyh_MaillageAffinage::NextStartingPointsResearch2 + (const Standard_Integer T1, + const Standard_Integer T2, + const IntPolyh_StartPoint &SPInit, + IntPolyh_StartPoint &SPNext) const +{ Standard_Integer NbPointsTotal=0; Standard_Integer EdgeInit1=SPInit.E1(); Standard_Integer EdgeInit2=SPInit.E2(); @@ -1872,11 +1960,7 @@ Standard_Integer IntPolyh_MaillageAffinage::NextStartingPointsResearch2(const St ///check T1 normal if(Abs(nn1modulus)1) { -# if MYDEBUG -// printf("\nNextStartingPointsResearch2() from IntPolyh_MaillageAffinage.cxx : Warning,\n"); -// printf(" more than one next point NbPointsToTal=%d\n",NbPointsTotal); -// SPInit.Dump(00000); -// SP1.Dump(00001); -// SP2.Dump(00002); -# endif + } } SPNext.SetCoupleValue(T1,T2); return (NbPointsTotal); } - //======================================================================= //function : CalculPtsInterTriEdgeCoplanaires //purpose : //======================================================================= - void CalculPtsInterTriEdgeCoplanaires(const Standard_Integer TriSurfID, const IntPolyh_Point &NormaleTri, const IntPolyh_Point &PE1, @@ -1975,7 +2047,8 @@ void CalculPtsInterTriEdgeCoplanaires(const Standard_Integer TriSurfID, const Standard_Integer CoteIndex, IntPolyh_StartPoint &SP1, IntPolyh_StartPoint &SP2, - Standard_Integer &NbPoints) { + Standard_Integer &NbPoints) +{ IntPolyh_Point TestParalleles; TestParalleles.Cross(Edge,Cote); if(sqrt(TestParalleles.SquareModulus())=p0p)&&(p2p<=p0p) )||( (p1p<=p0p)&&(p2p>=p0p) ) ) { Standard_Real lambda=(p1p-p0p)/(p1p-p2p); if (lambda<-MyConfusionPrecision) { -# if MYDEBUG -// printf("CalculPtsInterTriEdgeCoplanaires() in IntPolyh_MaillageAffinage.cxx: ERROR lambda<0\n"); -# endif + } IntPolyh_Point PIE=PE1+Edge*lambda; Standard_Real alpha=RealLast(); @@ -1997,14 +2068,10 @@ void CalculPtsInterTriEdgeCoplanaires(const Standard_Integer TriSurfID, else if (Cote.Y()!=0) alpha=(PIE.Y()-PT1.Y())/Cote.Y(); else if (Cote.Z()!=0) alpha=(PIE.Z()-PT1.Z())/Cote.Z(); else { -# if MYDEBUG -// printf("CalculPtsInterTriEdgeCoplanaires() in IntPolyh_MaillageAffinage.cxx: ERROR analysed triangle is flat\n"); -# endif + } if (alpha<-MyConfusionPrecision) { -# if MYDEBUG -// printf("CalculPtsInterTriEdgeCoplanaires() in IntPolyh_MaillageAffinage.cxx: ERROR alpha<0 alpha:%f\n",alpha); -#endif + } else { if (NbPoints==0) { @@ -2022,10 +2089,7 @@ void CalculPtsInterTriEdgeCoplanaires(const Standard_Integer TriSurfID, NbPoints++; } else { -# if MYDEBUG -// printf("CalculPtsInterTriEdgeCoplanaires() in IntPolyh_MaillageAffinage.cxx:\n"); -// printf(" ERROR no parallel TriSurfID!={1,2}\n"); -# endif + } } @@ -2044,17 +2108,12 @@ void CalculPtsInterTriEdgeCoplanaires(const Standard_Integer TriSurfID, NbPoints++; } else { -# if MYDEBUG -// printf("CalculPtsInterTriEdgeCoplanaires() in IntPolyh_MaillageAffinage.cxx:\n"); -// printf(" ERROR no parallel TriSurfID!={1,2}\n"); -# endif + } } else if( (NbPoints>2)||(NbPoints<0) ) { -# if MYDEBUG -// printf("CalculPtsInterTriEdgeCoplanaires() in IntPolyh_MaillageAffinage.cxx:ERROR per NbPoints >2 || <0\n"); -# endif + } } } @@ -2170,12 +2229,10 @@ void CalculPtsInterTriEdgeCoplanaires(const Standard_Integer TriSurfID, } } } - //======================================================================= //function : CalculPtsInterTriEdgeCoplanaires2 //purpose : //======================================================================= - void CalculPtsInterTriEdgeCoplanaires2(const Standard_Integer TriSurfID, const IntPolyh_Point &NormaleTri, const IntPolyh_Triangle &Tri1, @@ -2190,7 +2247,8 @@ void CalculPtsInterTriEdgeCoplanaires2(const Standard_Integer TriSurfID, const Standard_Integer CoteIndex, IntPolyh_StartPoint &SP1, IntPolyh_StartPoint &SP2, - Standard_Integer &NbPoints) { + Standard_Integer &NbPoints) + { IntPolyh_Point TestParalleles; TestParalleles.Cross(Edge,Cote); @@ -2205,9 +2263,7 @@ void CalculPtsInterTriEdgeCoplanaires2(const Standard_Integer TriSurfID, if ( ( (p1p>=p0p)&&(p0p>=p2p) )||( (p1p<=p0p)&&(p0p<=p2p) ) ) { Standard_Real lambda=(p1p-p0p)/(p1p-p2p); if (lambda<-MyConfusionPrecision) { -# if MYDEBUG -// printf("CalculPtsInterTriEdgeCoplanaires2() in IntPolyh_MaillageAffinage.cxx: ERROR lambda<0\n"); -# endif + } IntPolyh_Point PIE; if (Abs(lambda)2)||(NbPoints<0) ) { -# if MYDEBUG -// printf("CalculPtsInterTriEdgeCoplanaires2() in IntPolyh_MaillageAffinage.cxx:ERROR : NbPoints >2 || <0\n"); -# endif + } } } } - else { //Side and Edge are parallel, with previous rejections they are at the same side + else { + //Side and Edge are parallel, with previous + //rejections they are at the same side //The points are projected on that side Standard_Real pe1p= Cote.Dot(PE1); Standard_Real pe2p= Cote.Dot(PE2); @@ -2354,12 +2400,6 @@ void CalculPtsInterTriEdgeCoplanaires2(const Standard_Integer TriSurfID, #endif IntPolyh_Point PEP1,PTP1,PEP2,PTP2; - //PEP1 and PEP2 are the points of contact between the triangle and the edge in the direction UV of the edge - //PEP = PE1 + lambda*Edge - //PTP1 and PTP2 correspond respectively to PEP1 and PEP2 in the direction UV of the triangle - //PTP = PT1 + alpha*Cote - - if (pe1p>pe2p) { if ( (pt1p1)&&(Abs(SP2.U1()-SP1.U1())1)&&(Abs(SP1.U1()-SP2.U1())1)&&(Abs(SP2.U1()-SP1.U1())1)&&(Abs(SP2.U1()-SP1.U1())1)&&(Abs(SP2.U1()-SP1.U1())1)&&(Abs(SP2.U1()-SP1.U1())MyConfusionPrecision) { Standard_Real D=(Cote12.Y()-Cote12.X()*Cote23.Y()/Cote23.X()); if(D!=0) alpha = (PI.Y()-PT1.Y()-(PI.X()-PT1.X())*Cote23.Y()/Cote23.X())/D; else { -# if MYDEBUG -// printf("TriEdgeContact() from IntPolyh_MaillageAffinage.cxx : ERROR : TO DO 1\n"); -# endif + } if ((alpha<-MyConfusionPrecision)||(alpha>(1.0+MyConfusionPrecision))) return(0); else beta = (PI.X()-PT1.X()-alpha*Cote12.X())/Cote23.X(); @@ -2724,29 +2748,25 @@ IntPolyh_MaillageAffinage::TriangleEdgeContact(const Standard_Integer TriSurfID, else if (Abs(Cote23.Y())>MyConfusionPrecision) beta = (PI.Y()-PT1.Y()-alpha*Cote12.Y())/Cote23.Y(); else if (Abs(Cote23.Z())>MyConfusionPrecision) beta = (PI.Z()-PT1.Z()-alpha*Cote12.Z())/Cote23.Z(); else { -# if MYDEBUG -// printf("\nTriEdgeContact() from IntPolyh_MaillageAffinage.cxx : Warning : Edge PT2PT3 null 1\n"); -// PT2.Dump(2); -// PT3.Dump(3); -# endif + } } - else if (Abs(Cote23.Y())>MyConfusionPrecision) {//On a Cote23.X()==0 et Cote12.X()==0 ==> equation can't be used + else if (Abs(Cote23.Y())>MyConfusionPrecision) { + //On a Cote23.X()==0 et Cote12.X()==0 ==> equation can't be used Standard_Real D=(Cote12.Z()-Cote12.Y()*Cote23.Z()/Cote23.Y()); if(D!=0) alpha = (PI.Z()-PT1.Z()-(PI.Y()-PT1.Y())*Cote23.Z()/Cote23.Y())/D; else{ -# if MYDEBUG -// printf("TriEdgeContact() from IntPolyh_MaillageAffinage.cxx : ERROR : TO DO 2\n"); -# endif + } if ( (alpha<-MyConfusionPrecision)||(alpha>(1.0+MyConfusionPrecision)) ) return(0); else beta = (PI.Y()-PT1.Y()-alpha*Cote12.Y())/Cote23.Y(); } - else if (Abs(Cote12.Y())>MyConfusionPrecision) {//On a Cote23.X()==0, Cote12.X()==0 et Cote23.Y()==0 + else if (Abs(Cote12.Y())>MyConfusionPrecision) { + //On a Cote23.X()==0, Cote12.X()==0 et Cote23.Y()==0 alpha = (PI.Y()-PT1.Y())/Cote12.Y(); if ((Abs(alpha)MyConfusionPrecision) beta = (PI.Z()-PT1.Z()-alpha*Cote12.Z())/Cote23.Z(); else { -# if MYDEBUG -// printf("\nTriEdgeContact() from IntPolyh_MaillageAffinage.cxx : Warning : Edge PT2PT3 null 2\n"); -// PT2.Dump(2); -// PT3.Dump(3); -# endif + } } else { //two equations of three can't be used -# if MYDEBUG -// printf("\nTriEdgeContact() from IntPolyh_MaillageAffinage.cxx : Warning :\n"); -// printf("One equation, two unknown variables, system undeterminate\n"); -# endif + alpha=RealLast(); beta=RealLast(); } @@ -2833,9 +2846,7 @@ IntPolyh_MaillageAffinage::TriangleEdgeContact(const Standard_Integer TriSurfID, } } else{ -# if MYDEBUG -// printf("TriEdgeContact() from IntPolyh_MaillageAffinage.cxx : ERROR : Triangles no coplanar, TriSurfID!={1,2}\n"); -# endif + } } } @@ -2848,30 +2859,24 @@ IntPolyh_MaillageAffinage::TriangleEdgeContact(const Standard_Integer TriSurfID, //function : TriangleEdgeContact2 //purpose : //======================================================================= +Standard_Integer IntPolyh_MaillageAffinage::TriangleEdgeContact2 + (const Standard_Integer TriSurfID, + const Standard_Integer EdgeIndex, + const IntPolyh_Triangle &Tri1, + const IntPolyh_Triangle &Tri2, + const IntPolyh_Point &PT1, + const IntPolyh_Point &PT2, + const IntPolyh_Point &PT3, + const IntPolyh_Point &Cote12, + const IntPolyh_Point &Cote23, + const IntPolyh_Point &Cote31, + const IntPolyh_Point &PE1,const IntPolyh_Point &PE2, + const IntPolyh_Point &Edge, + const IntPolyh_Point &NormaleT, + IntPolyh_StartPoint &SP1,IntPolyh_StartPoint &SP2) const +{ -Standard_Integer -IntPolyh_MaillageAffinage::TriangleEdgeContact2(const Standard_Integer TriSurfID, - const Standard_Integer EdgeIndex, - const IntPolyh_Triangle &Tri1, - const IntPolyh_Triangle &Tri2, - const IntPolyh_Point &PT1, - const IntPolyh_Point &PT2, - const IntPolyh_Point &PT3, - const IntPolyh_Point &Cote12, - const IntPolyh_Point &Cote23, - const IntPolyh_Point &Cote31, - const IntPolyh_Point &PE1,const IntPolyh_Point &PE2, - const IntPolyh_Point &Edge, - const IntPolyh_Point &NormaleT, - IntPolyh_StartPoint &SP1,IntPolyh_StartPoint &SP2) - const { -#ifndef DEB Standard_Real lambda =0., alpha =0., beta =0.; -#else - Standard_Real lambda; - Standard_Real alpha; - Standard_Real beta; -#endif //One of edges on which the point is located is known if (TriSurfID==1) { @@ -2883,30 +2888,22 @@ IntPolyh_MaillageAffinage::TriangleEdgeContact2(const Standard_Integer TriSurfID SP2.SetEdge1(Tri1.GetEdgeNumber(EdgeIndex)); } else { -# if MYDEBUG -// printf("TriangleEdgeContact2() from IntPolyh_MaillageAffinage.cxx : ERROR : Bad TriSurfID in TriangleEdgeContact\n"); -# endif + } /**The edge is projected on the normal in the triangle if yes --> a free intersection (point I)--> Start point is found */ Standard_Integer NbPoints=0; if(NormaleT.SquareModulus()==0) { -# if MYDEBUG -// printf("TriangleEdgeContact2() from IntPolyh_MaillageAffinage.cxx : ERROR : Triangle's normale is null\n"); -# endif + } else if( (Cote12.SquareModulus()==0) ||(Cote23.SquareModulus()==0) ||(Cote31.SquareModulus()==0) ) { -# if MYDEBUG -// printf("TriangleEdgeContact2() from IntPolyh_MaillageAffinage.cxx : ERROR : Analysed triangle is flat 1\n"); -# endif + } else if(Edge.SquareModulus()==0) { -# if MYDEBUG -// printf("TriangleEdgeContact2() from IntPolyh_MaillageAffinage.cxx : ERROR : The edge is null\n"); -# endif + } else { Standard_Real pe1 = NormaleT.Dot(PE1); @@ -2917,10 +2914,7 @@ IntPolyh_MaillageAffinage::TriangleEdgeContact2(const Standard_Integer TriSurfID if( (Abs(pe1-pt1)=ppe1)&&(pp2<=ppe1)&&(pp3<=ppe1) ) || ( (pp1<=ppe1)&&(pp2>=ppe1)&&(pp3>=ppe1) ) ){ @@ -3003,9 +2995,7 @@ IntPolyh_MaillageAffinage::TriangleEdgeContact2(const Standard_Integer TriSurfID lambda=(pe1-pt1)/(pe1-pe2); IntPolyh_Point PI; if (lambda<-MyConfusionPrecision) { -# if MYDEBUG -// printf("TriangleEdgeContact2() from IntPolyh_MaillageAffinage.cxx : ERROR: lambda<0\n"); -# endif + } else if (Abs(lambda)MyConfusionPrecision) beta = (PI.Y()-PT1.Y()-alpha*Cote12.Y())/Cote23.Y(); else if (Abs(Cote23.Z())>MyConfusionPrecision) beta = (PI.Z()-PT1.Z()-alpha*Cote12.Z())/Cote23.Z(); else { -# if MYDEBUG -// printf("TriangleEdgeContact2() from IntPolyh_MaillageAffinage.cxx : ERROR:Edge PT2PT3 null 1\n"); -// PT2.Dump(2); -// PT3.Dump(3); -# endif + } } //Combination Eq1 and Eq3 @@ -3116,20 +3091,12 @@ IntPolyh_MaillageAffinage::TriangleEdgeContact2(const Standard_Integer TriSurfID else if (Abs(Cote23.X())>MyConfusionPrecision) beta = (PI.X()-PT1.X()-alpha*Cote12.X())/Cote23.X(); else { -# if MYDEBUG -// printf("TriangleEdgeContact2() from IntPolyh_MaillageAffinage.cxx : ERROR:Edge PT2PT3 null 2\n"); -// PT2.Dump(2); -// PT3.Dump(3); -# endif + } } else { //Particular case not processed ? -# if MYDEBUG -// printf("\nTriangleEdgeContact2() from IntPolyh_MaillageAffinage.cxx : ERROR: TODO \n"); -// Cote12.Dump(12); -// Cote23.Dump(23); -# endif + alpha=RealLast(); beta=RealLast(); } @@ -3215,9 +3182,7 @@ IntPolyh_MaillageAffinage::TriangleEdgeContact2(const Standard_Integer TriSurfID } } else { -# if MYDEBUG -// printf("TriangleEdgeContact2() from IntPolyh_MaillageAffinage.cxx : ERROR: Triangles non coplanar, TriSurfID!={1,2}\n"); -# endif + } } } @@ -3225,15 +3190,13 @@ IntPolyh_MaillageAffinage::TriangleEdgeContact2(const Standard_Integer TriSurfID } return (NbPoints); } - //======================================================================= //function : TriangleComparePSP //purpose : The same as TriangleCompare, plus compute the // StartPoints without chaining them. //======================================================================= - -Standard_Integer IntPolyh_MaillageAffinage::TriangleComparePSP () { - +Standard_Integer IntPolyh_MaillageAffinage::TriangleComparePSP () +{ Standard_Integer CpteurTab=0; Standard_Integer CpteurTabSP=0; Standard_Real CoupleAngle=-2.0; @@ -3256,10 +3219,7 @@ Standard_Integer IntPolyh_MaillageAffinage::TriangleComparePSP () { TPoints2[TTriangles2[i_S2].ThirdPoint()], CoupleAngle)){ -# if MYDEBUG - if (MYPRINTma) -// printf("TriangleComparePSP () from IntPolyh_MaillageAffinage.cxx %d %d %d\n", CpteurTab,i_S1, i_S2); -# endif + TTriangles1[i_S1].SetIndiceIntersection(1);//The triangle is cut by another TTriangles2[i_S2].SetIndiceIntersection(1); @@ -3267,67 +3227,27 @@ Standard_Integer IntPolyh_MaillageAffinage::TriangleComparePSP () { NbPoints=StartingPointsResearch(i_S1,i_S2,SP1, SP2); if (NbPoints==0) { -# if MYDEBUG -// printf("TriangleComparePSP () from IntPolyh_MaillageAffinage.cxx :problem NbPoints==0\n"); -// TPoints1[TTriangles1[i_S1].FirstPoint()].Dump(11); -// TPoints1[TTriangles1[i_S1].SecondPoint()].Dump(12); -// TPoints1[TTriangles1[i_S1].ThirdPoint()].Dump(13); -// TPoints2[TTriangles2[i_S2].FirstPoint()].Dump(21); -// TPoints2[TTriangles2[i_S2].SecondPoint()].Dump(22); -// TPoints2[TTriangles2[i_S2].ThirdPoint()].Dump(23); -# endif + } if ( (NbPoints>0)&&(NbPoints<3) ) { SP1.SetCoupleValue(i_S1,i_S2); TStartPoints[CpteurTabSP]=SP1; CpteurTabSP++; -#if MYDEBUG - gp_Pnt Pt11XYZ = (MaSurface1)->Value(SP1.U1(),SP1.V1()); - IntPolyh_Point PtCourant11(Pt11XYZ.X(), Pt11XYZ.Y(), Pt11XYZ.Z(),SP1.U1(),SP1.V1()); - gp_Pnt Pt21XYZ = (MaSurface2)->Value(SP1.U2(),SP1.V2()); - IntPolyh_Point PtCourant21(Pt21XYZ.X(), Pt21XYZ.Y(), Pt21XYZ.Z(),SP1.U2(),SP1.V2()); -#endif -# if MYDEBUG - if(MYPRINTma) { -// printf("TriangleComparePSP () from IntPolyh_MaillageAffinage.cxx : First StartPoint:\n"); -// SP1.Dump(); -// PtCourant11.Dump(); -// PtCourant21.Dump(); -// printf("\n"); - } -# endif + + } if(NbPoints==2) { SP2.SetCoupleValue(i_S1,i_S2); TStartPoints[CpteurTabSP]=SP2; CpteurTabSP++; -#if MYDEBUG - gp_Pnt Pt12XYZ = (MaSurface1)->Value(SP2.U1(),SP2.V1()); - IntPolyh_Point PtCourant12(Pt12XYZ.X(), Pt12XYZ.Y(), Pt12XYZ.Z(),SP2.U1(),SP2.V1()); - gp_Pnt Pt22XYZ = (MaSurface2)->Value(SP2.U2(),SP2.V2()); - IntPolyh_Point PtCourant22(Pt22XYZ.X(), Pt22XYZ.Y(), Pt22XYZ.Z(),SP2.U2(),SP2.V2()); -#endif -# if MYDEBUG - if (MYPRINTma) { -// printf("TriangleComparePSP () from IntPolyh_MaillageAffinage.cxx : Second StartPoint:\n"); -// SP2.Dump(); -// PtCourant12.Dump(); -// PtCourant22.Dump(); -// printf("\n"); - } -# endif + + } if(NbPoints>2) { -# if MYDEBUG -// printf("TriangleComparePSP () from IntPolyh_MaillageAffinage.cxx : ERROR : found more than two StartPoints\n"); -// TTriangles1[i_S1].Dump(i_S1); -// TTriangles2[i_S2].Dump(i_S2); -// SP1.Dump(); -// SP2.Dump(); -# endif + } CpteurTab++; } @@ -3336,7 +3256,6 @@ Standard_Integer IntPolyh_MaillageAffinage::TriangleComparePSP () { } return(CpteurTabSP); } - //======================================================================= //function : TriangleCompare //purpose : Analyze each couple of triangles from the two -- @@ -3344,13 +3263,10 @@ Standard_Integer IntPolyh_MaillageAffinage::TriangleComparePSP () { // contact, and compute the incidence. Then put // couples in contact in the array of couples //======================================================================= - -Standard_Integer IntPolyh_MaillageAffinage::TriangleCompare (){ +Standard_Integer IntPolyh_MaillageAffinage::TriangleCompare () +{ Standard_Integer CpteurTab=0; -#if MYDEBUG - Standard_Integer CpteurNbTestsInter=0; - Standard_Integer CpteurNbTestsInterOK=0; -#endif + const Standard_Integer FinTT1 = TTriangles1.NbTriangles(); const Standard_Integer FinTT2 = TTriangles2.NbTriangles(); @@ -3372,9 +3288,7 @@ Standard_Integer IntPolyh_MaillageAffinage::TriangleCompare (){ //If a triangle is dead or not in BSB, comparison is not possible IntPolyh_Triangle &Triangle1 = TTriangles1[i_S1]; IntPolyh_Triangle &Triangle2 = TTriangles2[i_S2]; -# if MYDEBUG - CpteurNbTestsInter++;//count the number of couples analysed -# endif + if (TriContact(TPoints1[Triangle1.FirstPoint()], TPoints1[Triangle1.SecondPoint()], TPoints1[Triangle1.ThirdPoint()], @@ -3382,18 +3296,11 @@ Standard_Integer IntPolyh_MaillageAffinage::TriangleCompare (){ TPoints2[Triangle2.SecondPoint()], TPoints2[Triangle2.ThirdPoint()], CoupleAngle)){ -# if MYDEBUG - CpteurNbTestsInterOK++; -# endif + if (CpteurTab >= NbTTC) { TTrianglesContacts.SetNbCouples(CpteurTab); -# if MYDEBUG - if (MYPRINTma) { - const Standard_Integer FinTTC = TTrianglesContacts.NbCouples(); - for(Standard_Integer ii=0; ii=0)&&(SP.E2()==-2) ) { //case if the point is on edge of T1 @@ -3836,10 +3694,7 @@ Standard_Integer if (NbPoints>1) CheckNextStartPoint(MySectionLine,TTangentZones,SPNext,Prepend); else { -# if MYDEBUG -// printf("\nGetNextChainStartPoint() from IntPolyh_MaillageAffinage.cxx\n"); -// printf(" Warning number of Next StartPoint = %2d Couple %5d %5d\n",NbPoints,NextTriangle1,SP.T2()); -# endif + NbPoints=0; } } @@ -3861,10 +3716,7 @@ Standard_Integer if (NbPoints>1) CheckNextStartPoint(MySectionLine,TTangentZones,SPNext,Prepend); else { -# if MYDEBUG -// printf("\nGetNextChainStartPoint() from IntPolyh_MaillageAffinage.cxx\n"); -// printf("\nWarning number of Next StartPoint = %2d Couple %5d %5d\n",NbPoints,SP.T1(),NextTriangle2); -# endif + NbPoints=0; } } @@ -3875,10 +3727,7 @@ Standard_Integer } else if( (SP.E1()==-2)&&(SP.E2()==-2) ) { ///no edge is touched or cut -# if MYDEBUG -// printf("\nGetNextChainStartPoint() from IntPolyh_MaillageAffinage.cxx\n"); -// printf("No Edges cut --> No StartPoint\n"); -# endif + NbPoints=0; } else if( (SP.E1()>=0)&&(SP.E2()>=0) ) { @@ -3894,7 +3743,9 @@ Standard_Integer else NextTriangle2=TEdges2[SP.E2()].SecondTriangle(); Standard_Real Angle= -2.0; - if (CheckCoupleAndGetAngle2(NextTriangle1,NextTriangle2,SP.T1(),SP.T2(),CpleT11,CpleT22,Angle,TTrianglesContacts)) { + if (CheckCoupleAndGetAngle2(NextTriangle1,NextTriangle2, + SP.T1(),SP.T2(),CpleT11,CpleT22, + Angle,TTrianglesContacts)) { NbPoints=NextStartingPointsResearch2(NextTriangle1,NextTriangle2,SP,SPNext); if( NbPoints!=1 ) { if (NbPoints>1) { @@ -3902,10 +3753,7 @@ Standard_Integer if(CheckNextStartPoint(MySectionLine,TTangentZones,SPNext,Prepend)>0) { } else { -# if MYDEBUG -// printf("\nGetNextChainStartPoint() from IntPolyh_MaillageAffinage.cxx\n"); -// printf("\nWarning number of Next StartPoint = %2d Couple %5d %5d\n",NbPoints,NextTriangle1,NextTriangle2); -# endif + } } NbPoints=0; @@ -3915,17 +3763,11 @@ Standard_Integer //The couples (Ti,Tj) (Ti',Tj') are marked if (CpleT11>=0) TTrianglesContacts[CpleT11].SetAnalyseFlag(1); else { -# if MYDEBUG -// printf("\nGetNextChainStartPoint() from IntPolyh_MaillageAffinage.cxx\n"); -// printf("GetNextChainStartPoint CpleT11=%d\n",CpleT11); -# endif + } if (CpleT22>=0) TTrianglesContacts[CpleT22].SetAnalyseFlag(1); else { -# if MYDEBUG -// printf("\nGetNextChainStartPoint() from IntPolyh_MaillageAffinage.cxx\n"); -// printf("GetNextChainStartPoint CpleT22=%d\n",CpleT22); -# endif + } } } @@ -3937,35 +3779,35 @@ Standard_Integer } return(NbPoints); } - //======================================================================= //function : GetArrayOfPoints //purpose : //======================================================================= - -const IntPolyh_ArrayOfPoints& IntPolyh_MaillageAffinage::GetArrayOfPoints(const Standard_Integer SurfID)const{ +const IntPolyh_ArrayOfPoints& IntPolyh_MaillageAffinage::GetArrayOfPoints + (const Standard_Integer SurfID)const +{ if (SurfID==1) return(TPoints1); return(TPoints2); } - //======================================================================= //function : GetArrayOfEdges //purpose : //======================================================================= - -const IntPolyh_ArrayOfEdges& IntPolyh_MaillageAffinage::GetArrayOfEdges(const Standard_Integer SurfID)const{ +const IntPolyh_ArrayOfEdges& IntPolyh_MaillageAffinage::GetArrayOfEdges + (const Standard_Integer SurfID)const +{ if (SurfID==1) return(TEdges1); return(TEdges2); } - //======================================================================= //function : GetArrayOfTriangles //purpose : //======================================================================= - -const IntPolyh_ArrayOfTriangles& IntPolyh_MaillageAffinage::GetArrayOfTriangles(const Standard_Integer SurfID)const{ +const IntPolyh_ArrayOfTriangles& + IntPolyh_MaillageAffinage::GetArrayOfTriangles + (const Standard_Integer SurfID)const{ if (SurfID==1) return(TTriangles1); return(TTriangles2); @@ -3975,8 +3817,8 @@ const IntPolyh_ArrayOfTriangles& IntPolyh_MaillageAffinage::GetArrayOfTriangles( //function : GetBox //purpose : //======================================================================= - -Bnd_Box IntPolyh_MaillageAffinage::GetBox(const Standard_Integer SurfID)const{ +Bnd_Box IntPolyh_MaillageAffinage::GetBox(const Standard_Integer SurfID) const +{ if (SurfID==1) return(MyBox1); return(MyBox2); @@ -3986,37 +3828,204 @@ Bnd_Box IntPolyh_MaillageAffinage::GetBox(const Standard_Integer SurfID)const{ //function : GetBoxDraw //purpose : //======================================================================= - -void IntPolyh_MaillageAffinage::GetBoxDraw(const Standard_Integer SurfID)const{ +void IntPolyh_MaillageAffinage::GetBoxDraw(const Standard_Integer SurfID)const +{ Standard_Real x0,y0,z0,x1,y1,z1; if (SurfID==1) { MyBox1.Get(x0,y0,z0,x1,y1,z1); - //printf("box mybox1 %f %f %f %f %f %f\n",x0,y0,z0,x1-x0,y1-y0,z1-z0); } else { MyBox2.Get(x0,y0,z0,x1,y1,z1); - //printf("box mybox2 %f %f %f %f %f %f\n",x0,y0,z0,x1-x0,y1-y0,z1-z0); } } - -// Modified by skv - Thu Sep 25 17:24:25 2003 OCC567 Begin //======================================================================= //function : GetArrayOfCouples //purpose : //======================================================================= - IntPolyh_ArrayOfCouples &IntPolyh_MaillageAffinage::GetArrayOfCouples() { return TTrianglesContacts; } -// Modified by skv - Thu Sep 25 17:24:28 2003 OCC567 End - +//======================================================================= +//function : SetEnlargeZone +//purpose : +//======================================================================= void IntPolyh_MaillageAffinage::SetEnlargeZone(Standard_Boolean& EnlargeZone) { myEnlargeZone = EnlargeZone; } - +//======================================================================= +//function : GetEnlargeZone +//purpose : +//======================================================================= Standard_Boolean IntPolyh_MaillageAffinage::GetEnlargeZone() const { return myEnlargeZone; } +//modified by NIZNHY-PKV Fri Jan 20 10:06:13 2012f +//======================================================================= +//function : DegeneratedIndex +//purpose : +//======================================================================= +void DegeneratedIndex(const TColStd_Array1OfReal& aXpars, + const Standard_Integer aNbX, + const Handle(Adaptor3d_HSurface)& aS, + const Standard_Integer aIsoDirection, + Standard_Integer& aI1, + Standard_Integer& aI2) +{ + Standard_Integer i; + Standard_Boolean bDegX1, bDegX2; + Standard_Real aDegX1, aDegX2, aTol2, aX; + // + aI1=0; + aI2=0; + aTol2=MyTolerance*MyTolerance; + // + if (aIsoDirection==1){ // V=const + bDegX1=IsDegenerated(aS, 1, aTol2, aDegX1); + bDegX2=IsDegenerated(aS, 2, aTol2, aDegX2); + } + else if (aIsoDirection==2){ // U=const + bDegX1=IsDegenerated(aS, 3, aTol2, aDegX1); + bDegX2=IsDegenerated(aS, 4, aTol2, aDegX2); + } + else { + return; + } + // + if (!(bDegX1 || bDegX2)) { + return; + } + // + for(i=1; i<=aNbX; ++i) { + aX=aXpars(i); + if (bDegX1) { + if (fabs(aX-aDegX1) < MyTolerance) { + aI1=i; + } + } + if (bDegX2) { + if (fabs(aX-aDegX2) < MyTolerance) { + aI2=i; + } + } + } +} +//======================================================================= +//function : IsDegenerated +//purpose : +//======================================================================= +Standard_Boolean IsDegenerated(const Handle(Adaptor3d_HSurface)& aS, + const Standard_Integer aIndex, + const Standard_Real aTol2, + Standard_Real& aDegX) +{ + Standard_Boolean bRet; + Standard_Integer i, aNbP; + Standard_Real aU, dU, aU1, aU2, aV, dV, aV1, aV2, aD2; + gp_Pnt aP1, aP2; + // + bRet=Standard_False; + aNbP=3; + aDegX=99; + // + aU1=aS->FirstUParameter(); + aU2=aS->LastUParameter(); + aV1=aS->FirstVParameter(); + aV2=aS->LastVParameter(); + // + if (aIndex<3) { // V=const + aV=aV1; + if (aIndex==2) { + aV=aV2; + } + dU=(aU2-aU1)/(aNbP-1); + aU=aU1; + aP1=aS->Value(aU, aV); + for (i=1; iValue(aU, aV); + aD2=aP1.SquareDistance(aP2); + if (aD2>aTol2) { + return bRet; + } + aP1=aP2; + } + aDegX=aV; + bRet=!bRet; + } + else {// U=const + aU=aU1; + if (aIndex==4) { + aU=aU2; + } + dV=(aV2-aV1)/(aNbP-1); + aV=aV1; + aP1=aS->Value(aU, aV); + for (i=1; iValue(aU, aV); + aD2=aP1.SquareDistance(aP2); + if (aD2>aTol2) { + return bRet; + } + aP1=aP2; + } + bRet=!bRet; + aDegX=aU; + } + // + return bRet; +} +//modified by NIZNHY-PKV Fri Jan 20 10:06:15 2012t +#ifdef DEB + +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : TriangleShape +//purpose : shape with triangulation containing triangles +//======================================================================= +static TopoDS_Shape TriangleShape(const IntPolyh_ArrayOfTriangles & TTriangles, + const IntPolyh_ArrayOfPoints & TPoints) +{ + TopoDS_Face aFace; + if (TPoints.NbPoints() < 1 || TTriangles.NbTriangles() < 1) return aFace; + + Handle(Poly_Triangulation) aPTriangulation = + new Poly_Triangulation(TPoints.NbPoints(),TTriangles.NbTriangles(),Standard_False); + TColgp_Array1OfPnt & aPNodes = aPTriangulation->ChangeNodes(); + Poly_Array1OfTriangle & aPTrialgles = aPTriangulation->ChangeTriangles(); + + Standard_Integer i; + for (i=0; iTriangulation(aPTriangulation); + aFace.TShape(aTFace); + return aFace; +} +#endif + +//#define MyTolerance 10.0e-7 +//#define MyConfusionPrecision 10.0e-12 +//#define SquareMyConfusionPrecision 10.0e-24 diff --git a/src/IntPolyh/IntPolyh_MaillageAffinage_1.cxx b/src/IntPolyh/IntPolyh_MaillageAffinage_1.cxx deleted file mode 100755 index f84506a92e..0000000000 --- a/src/IntPolyh/IntPolyh_MaillageAffinage_1.cxx +++ /dev/null @@ -1,184 +0,0 @@ -// File: IntPolyh_MaillageAffinage.cxx -// Created: Fri Mar 5 01:52:52 1999 -// Author: Fabrice SERVANT -// - -// modified by Edward AGAPOV (eap) Tue Jan 22 2002 (bug occ53) -// - improve SectionLine table management (avoid memory reallocation) -// - some protection against arrays overflow - -// modified by Edward AGAPOV (eap) Thu Feb 14 2002 (occ139) -// - make Section Line parts rightly connected (prepend 2nd part to the 1st) -// - TriangleShape() for debugging purpose - -// Modified by skv - Thu Sep 25 17:42:42 2003 OCC567 -// modified by ofv Thu Apr 8 14:58:13 2004 fip - -//#ifndef _maillIso_HeaderFile -//#define _maillIso_HeaderFile - -//#endif -#include - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -# ifdef DEB -#include -#include -#include -#include -#include -#include -#ifdef DRAW -#include -#endif -# endif - -# ifdef DEB - # define MYDEBUG DEB -Standard_Integer MYDRAW1 = 0; -# else - # define MYDEBUG 0 -# endif - -Standard_Integer MYPRINTma1 = 0; - -#define MyTolerance 10.0e-7 -#define MyConfusionPrecision 10.0e-12 -#define SquareMyConfusionPrecision 10.0e-24 - - - - -//======================================================================= -//function : FillArrayOfPnt -//purpose : Compute points on one surface and fill an array of points -//======================================================================= -void IntPolyh_MaillageAffinage::FillArrayOfPnt(const Standard_Integer SurfID, - const TColStd_Array1OfReal& Upars, - const TColStd_Array1OfReal& Vpars) -{ - Handle(Adaptor3d_HSurface) MaSurface=(SurfID==1)? MaSurface1:MaSurface2; - IntPolyh_ArrayOfPoints &TPoints=(SurfID==1)? TPoints1:TPoints2; - Standard_Integer NbSamplesU=(SurfID==1)? NbSamplesU1:NbSamplesU2; - Standard_Integer NbSamplesV=(SurfID==1)? NbSamplesV1:NbSamplesV2; - Bnd_Box *PtrBox = (SurfID==1) ? (&MyBox1) : (&MyBox2); - Standard_Integer CpteurTabPnt=0; - Standard_Real Tol; - - //cout << "Nb : " << NbSamplesU << " " << NbSamplesV << endl; - - Standard_Real u0 = Upars(1); - Standard_Real v0 = Vpars(1); - Standard_Real u1 = Upars(NbSamplesU); - Standard_Real v1 = Vpars(NbSamplesV); - IntCurveSurface_ThePolyhedronOfHInter polyhedron(MaSurface, Upars, Vpars); - Tol=polyhedron.DeflectionOverEstimation(); - - for(Standard_Integer BoucleU=1; BoucleU<=NbSamplesU; BoucleU++){ - Standard_Real U = Upars(BoucleU); - for(Standard_Integer BoucleV=1; BoucleV<=NbSamplesV; BoucleV++){ - Standard_Real V = Vpars(BoucleV); - gp_Pnt PtXYZ = (MaSurface)->Value(U,V); - (TPoints[CpteurTabPnt]).Set(PtXYZ.X(), PtXYZ.Y(), PtXYZ.Z(), U, V); - CpteurTabPnt++; - PtrBox->Add(PtXYZ); - } - } - - - - TPoints.SetNbPoints(CpteurTabPnt); - - Tol*=1.2; - - Standard_Real a1,a2,a3,b1,b2,b3; - PtrBox->Get(a1,a2,a3,b1,b2,b3); - PtrBox->Update(a1-Tol,a2-Tol,a3-Tol,b1+Tol,b2+Tol,b3+Tol); - PtrBox->Enlarge(MyTolerance); - //cout << "End Fill Array 1" << endl; -} - -//======================================================================= -//function : FillArrayOfPnt -//purpose : Compute points on one surface and fill an array of points -// REMPLISSAGE DU TABLEAU DE POINTS -//======================================================================= -void IntPolyh_MaillageAffinage::FillArrayOfPnt(const Standard_Integer SurfID, - const Standard_Boolean isShiftFwd, - const TColStd_Array1OfReal& Upars, - const TColStd_Array1OfReal& Vpars) -{ - - Handle(Adaptor3d_HSurface) MaSurface=(SurfID==1)? MaSurface1:MaSurface2; - IntPolyh_ArrayOfPoints &TPoints=(SurfID==1)? TPoints1:TPoints2; - Standard_Integer NbSamplesU=(SurfID==1)? NbSamplesU1:NbSamplesU2; - Standard_Integer NbSamplesV=(SurfID==1)? NbSamplesV1:NbSamplesV2; - Bnd_Box *PtrBox = (SurfID==1) ? (&MyBox1) : (&MyBox2); - Standard_Integer CpteurTabPnt=0; - Standard_Real Tol; - - //cout << "FillArrayOfPnt 2" << endl; - //cout << "??????????????" << endl; - Standard_Real resol = gp::Resolution(); - Standard_Real u0 = Upars(1); - Standard_Real v0 = Vpars(1); - Standard_Real u1 = Upars(NbSamplesU); - Standard_Real v1 = Vpars(NbSamplesV); - IntCurveSurface_ThePolyhedronOfHInter polyhedron(MaSurface, Upars, Vpars); - Tol=polyhedron.DeflectionOverEstimation(); - - for(Standard_Integer BoucleU=1; BoucleU<=NbSamplesU; BoucleU++){ - Standard_Real U = Upars(BoucleU); - for(Standard_Integer BoucleV=1; BoucleV<=NbSamplesV; BoucleV++){ - Standard_Real V = Vpars(BoucleV); - - gp_Pnt PtXYZ; - gp_Vec aDU; - gp_Vec aDV; - gp_Vec aNorm; - - MaSurface->D1(U, V, PtXYZ, aDU, aDV); - - aNorm = aDU.Crossed(aDV); - Standard_Real aMag = aNorm.Magnitude(); - if (aMag > resol) { - aNorm /= aMag; - aNorm.Multiply(Tol*1.5); - - if (isShiftFwd) - PtXYZ.Translate(aNorm); - else - PtXYZ.Translate(aNorm.Reversed()); - } - - (TPoints[CpteurTabPnt]).Set(PtXYZ.X(), PtXYZ.Y(), PtXYZ.Z(), U, V); - CpteurTabPnt++; - PtrBox->Add(PtXYZ); - } - } - - TPoints.SetNbPoints(CpteurTabPnt); - - Tol*=1.2; - - Standard_Real a1,a2,a3,b1,b2,b3; - PtrBox->Get(a1,a2,a3,b1,b2,b3); - PtrBox->Update(a1-Tol,a2-Tol,a3-Tol,b1+Tol,b2+Tol,b3+Tol); - PtrBox->Enlarge(MyTolerance); -}//fin FillArrayOfPnt - diff --git a/src/IntPolyh/IntPolyh_Point.cdl b/src/IntPolyh/IntPolyh_Point.cdl index 46e3bfdd47..37cd157405 100755 --- a/src/IntPolyh/IntPolyh_Point.cdl +++ b/src/IntPolyh/IntPolyh_Point.cdl @@ -111,12 +111,22 @@ is is static; Dump(me; i: Integer from Standard) - is static; - + is static; + +--modified by NIZNHY-PKV Fri Jan 20 12:11:36 2012 f + SetDegenerated(me:out; + theFlag:Boolean from Standard); + + Degenerated(me) + returns Boolean from Standard; +--modified by NIZNHY-PKV Fri Jan 20 12:12:07 2012t + fields - x,y,z,u,v : Real from Standard; - POC : Integer from Standard; + POC : Integer from Standard; + --modified by NIZNHY-PKV Fri Jan 20 12:17:39 2012f + myDegenerated : Boolean from Standard; + --modified by NIZNHY-PKV Fri Jan 20 12:17:41 2012t end Point from IntPolyh; diff --git a/src/IntPolyh/IntPolyh_Point.cxx b/src/IntPolyh/IntPolyh_Point.cxx index aabdf53a3b..7f8f400771 100755 --- a/src/IntPolyh/IntPolyh_Point.cxx +++ b/src/IntPolyh/IntPolyh_Point.cxx @@ -9,44 +9,164 @@ #include -IntPolyh_Point::IntPolyh_Point() : x(0),y(0),z(0),u(0),v(0),POC(1) { +//======================================================================= +//function : IntPolyh_Point +//purpose : +//======================================================================= +IntPolyh_Point::IntPolyh_Point() +: + x(0),y(0),z(0),u(0),v(0),POC(1), + myDegenerated(Standard_False) +{ } +//======================================================================= +//function : IntPolyh_Point +//purpose : +//======================================================================= IntPolyh_Point::IntPolyh_Point(const Standard_Real _x, const Standard_Real _y, const Standard_Real _z, const Standard_Real _u, - const Standard_Real _v):POC(1) { + const Standard_Real _v) +: + POC(1), + myDegenerated(Standard_False) +{ x=_x; y=_y; z=_z; u=_u; v=_v; } - -Standard_Real IntPolyh_Point::X() const { return(x); } -Standard_Real IntPolyh_Point::Y() const { return(y); } -Standard_Real IntPolyh_Point::Z() const { return(z); } -Standard_Real IntPolyh_Point::U() const { return(u); } -Standard_Real IntPolyh_Point::V() const { return(v); } -Standard_Integer IntPolyh_Point::PartOfCommon() const {return(POC);} - - -void IntPolyh_Point::Set(const Standard_Real _x,const Standard_Real _y, const Standard_Real _z, - const Standard_Real _u, const Standard_Real _v, const Standard_Integer II) { - x=_x; y=_y; z=_z; u=_u; v=_v; POC=II;} - -void IntPolyh_Point::Equal(const IntPolyh_Point &Pt) { +//======================================================================= +//function : X +//purpose : +//======================================================================= +Standard_Real IntPolyh_Point::X() const +{ + return x; +} +//======================================================================= +//function : Y +//purpose : +//======================================================================= +Standard_Real IntPolyh_Point::Y() const +{ + return y; +} +//======================================================================= +//function : Z +//purpose : +//======================================================================= +Standard_Real IntPolyh_Point::Z() const +{ + return z; + } +//======================================================================= +//function : U +//purpose : +//======================================================================= +Standard_Real IntPolyh_Point::U() const +{ + return u; +} +//======================================================================= +//function : V +//purpose : +//======================================================================= +Standard_Real IntPolyh_Point::V() const +{ + return v; +} +//======================================================================= +//function : PartOfCommon +//purpose : +//======================================================================= +Standard_Integer IntPolyh_Point::PartOfCommon() const +{ + return POC; +} +//======================================================================= +//function : Set +//purpose : +//======================================================================= +void IntPolyh_Point::Set(const Standard_Real _x, + const Standard_Real _y, + const Standard_Real _z, + const Standard_Real _u, + const Standard_Real _v, + const Standard_Integer II) +{ + x=_x; + y=_y; + z=_z; + u=_u; + v=_v; + POC=II; +} +//======================================================================= +//function : Equal +//purpose : +//======================================================================= +void IntPolyh_Point::Equal(const IntPolyh_Point &Pt) +{ x = Pt.x; y = Pt.y; z = Pt.z; u = Pt.u; v = Pt.v; } +//======================================================================= +//function : SetX +//purpose : +//======================================================================= +void IntPolyh_Point::SetX(const Standard_Real _x) +{ + x=_x; +} +//======================================================================= +//function : SetY +//purpose : +//======================================================================= +void IntPolyh_Point::SetY(const Standard_Real _y) +{ + y=_y; +} +//======================================================================= +//function : SetZ +//purpose : +//======================================================================= +void IntPolyh_Point::SetZ(const Standard_Real _z) +{ + z=_z; +} +//======================================================================= +//function : SetU +//purpose : +//======================================================================= +void IntPolyh_Point::SetU(const Standard_Real _u) +{ + u=_u; +} +//======================================================================= +//function : SetV +//purpose : +//======================================================================= +void IntPolyh_Point::SetV(const Standard_Real _v) +{ + v=_v; +} +//======================================================================= +//function : SetPartOfCommon +//purpose : +//======================================================================= +void IntPolyh_Point::SetPartOfCommon(const Standard_Integer ii) +{ + POC=ii; +} -void IntPolyh_Point::SetX(const Standard_Real _x) { x=_x; } -void IntPolyh_Point::SetY(const Standard_Real _y) { y=_y; } -void IntPolyh_Point::SetZ(const Standard_Real _z) { z=_z; } -void IntPolyh_Point::SetU(const Standard_Real _u) { u=_u; } -void IntPolyh_Point::SetV(const Standard_Real _v) { v=_v; } -void IntPolyh_Point::SetPartOfCommon(const Standard_Integer ii) { POC=ii; } +//======================================================================= +//function : Middle +//purpose : +//======================================================================= void IntPolyh_Point::Middle(const Handle(Adaptor3d_HSurface)& MySurface, const IntPolyh_Point & Point1, const IntPolyh_Point & Point2){ @@ -59,30 +179,45 @@ void IntPolyh_Point::Middle(const Handle(Adaptor3d_HSurface)& MySurface, y=PtXYZ.Y(); z=PtXYZ.Z(); } - - -IntPolyh_Point IntPolyh_Point::Add(const IntPolyh_Point &P1)const{ +//======================================================================= +//function : Add +//purpose : +//======================================================================= +IntPolyh_Point IntPolyh_Point::Add(const IntPolyh_Point &P1)const +{ IntPolyh_Point res; + // res.SetX(x+P1.X()); res.SetY(y+P1.Y()); res.SetZ(z+P1.Z()); res.SetU(u+P1.U()); res.SetV(v+P1.V()); - return(res); + return res; } -IntPolyh_Point IntPolyh_Point::Sub(const IntPolyh_Point &P1)const{ +//======================================================================= +//function : Sub +//purpose : +//======================================================================= +IntPolyh_Point IntPolyh_Point::Sub(const IntPolyh_Point &P1)const +{ IntPolyh_Point res; + // res.SetX(x-P1.X()); res.SetY(y-P1.Y()); res.SetZ(z-P1.Z()); res.SetU(u-P1.U()); res.SetV(v-P1.V()); - return(res); + return res; } - -IntPolyh_Point IntPolyh_Point::Divide(const Standard_Real RR)const{ +//======================================================================= +//function : Divide +//purpose : +//======================================================================= +IntPolyh_Point IntPolyh_Point::Divide(const Standard_Real RR)const +{ IntPolyh_Point res; + // if (Abs(RR)>10.0e-20) { res.SetX(x/RR); res.SetY(y/RR); @@ -92,52 +227,94 @@ IntPolyh_Point IntPolyh_Point::Divide(const Standard_Real RR)const{ } else { printf("Division par zero RR=%f\n",RR); - //Dump(); } - return(res); + return res; } - -IntPolyh_Point IntPolyh_Point::Multiplication(const Standard_Real RR)const{ +//======================================================================= +//function : Multiplication +//purpose : +//======================================================================= +IntPolyh_Point IntPolyh_Point::Multiplication(const Standard_Real RR)const +{ IntPolyh_Point res; + // res.SetX(x*RR); res.SetY(y*RR); res.SetZ(z*RR); res.SetU(u*RR); res.SetV(v*RR); - return(res); + return res; } - -Standard_Real IntPolyh_Point::SquareModulus()const{ +//======================================================================= +//function : SquareModulus +//purpose : +//======================================================================= +Standard_Real IntPolyh_Point::SquareModulus()const +{ Standard_Real res=x*x+y*y+z*z; - return(res); + return res; } -Standard_Real IntPolyh_Point::SquareDistance(const IntPolyh_Point &P2)const{ +//======================================================================= +//function : SquareDistance +//purpose : +//======================================================================= +Standard_Real IntPolyh_Point::SquareDistance(const IntPolyh_Point &P2)const +{ Standard_Real res=(x-P2.x)*(x-P2.x)+(y-P2.y)*(y-P2.y)+(z-P2.z)*(z-P2.z); - return(res); + return res; } - -//inline -Standard_Real IntPolyh_Point::Dot(const IntPolyh_Point &b ) const{ +//======================================================================= +//function : Dot +//purpose : +//======================================================================= +Standard_Real IntPolyh_Point::Dot(const IntPolyh_Point &b ) const +{ Standard_Real t=x*b.x+y*b.y+z*b.z; - return(t); + return t; } - -//inline +//======================================================================= +//function : Cross +//purpose : +//======================================================================= void IntPolyh_Point::Cross(const IntPolyh_Point &a,const IntPolyh_Point &b){ x=a.y*b.z-a.z*b.y; y=a.z*b.x-a.x*b.z; z=a.x*b.y-a.y*b.x; -//u=? -//v=? } - -void IntPolyh_Point::Dump() const{ +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void IntPolyh_Point::Dump() const +{ printf("\nPoint : x=%+8.3eg y=%+8.3eg z=%+8.3eg u=%+8.3eg v=%+8.3eg\n",x,y,z,u,v); } - -void IntPolyh_Point::Dump(const Standard_Integer i) const{ - printf("\nPoint(%3d) : x=%+8.3eg y=%+8.3eg z=%+8.3eg u=%+8.3eg v=%+8.3eg poc=%3d\n",i,x,y,z,u,v,POC); +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void IntPolyh_Point::Dump(const Standard_Integer i) const +{ + printf("\nPoint(%3d) : x=%+8.3eg y=%+8.3eg z=%+8.3eg u=%+8.3eg v=%+8.3eg poc=%3d\n", + i,x,y,z,u,v,POC); +} +//modified by NIZNHY-PKV Fri Jan 20 12:13:03 2012f +//======================================================================= +//function : SetDegenerated +//purpose : +//======================================================================= +void IntPolyh_Point::SetDegenerated(const Standard_Boolean theFlag) +{ + myDegenerated=theFlag; +} +//======================================================================= +//function : Degenerated +//purpose : +//======================================================================= +Standard_Boolean IntPolyh_Point::Degenerated()const +{ + return myDegenerated; } diff --git a/src/IntPolyh/IntPolyh_Triangle.cxx b/src/IntPolyh/IntPolyh_Triangle.cxx index e22490f79b..85130b0eb2 100755 --- a/src/IntPolyh/IntPolyh_Triangle.cxx +++ b/src/IntPolyh/IntPolyh_Triangle.cxx @@ -15,45 +15,249 @@ #define MyConfusionPrecision 10.0e-12 #define SquareMyConfusionPrecision 10.0e-24 -//# ifdef DEB - //#define MYDEBUG DEB -//# else - //#define MYDEBUG 0 -//# endif +static + void GetInfoTA(const Standard_Integer numP1, + const Standard_Integer numP2, + const Standard_Integer numTA, + const IntPolyh_ArrayOfTriangles & TTriangles, + Standard_Integer & numP3b, + Standard_Integer & P3bIndex, + Standard_Integer & Edge2b, + Standard_Integer & Edge3b); +static + void NewTriangle(const Standard_Integer P1, + const Standard_Integer P2, + const Standard_Integer P3, + IntPolyh_ArrayOfTriangles &TTriangles, + const Handle(Adaptor3d_HSurface)& MySurface, + IntPolyh_ArrayOfPoints &TPoints); +static + void NewEdge(const Standard_Integer P1, + const Standard_Integer P2, + const Standard_Integer T1, + const Standard_Integer T2, + IntPolyh_ArrayOfEdges & TEdges); +static + void OldEdge(const Standard_Integer EdgeN, + const Standard_Integer NumTri, + const Standard_Integer NewTriNum, + IntPolyh_ArrayOfEdges & TEdges) ; +static + void TestOldEdgeB(const Standard_Integer NumTA, + const Standard_Integer numPtT1, + const Standard_Integer numPtT2, + const Standard_Integer T1, + const Standard_Integer T2, + const IntPolyh_ArrayOfTriangles & TTriangles, + const Standard_Integer Edge1, + const Standard_Integer Edge3, + IntPolyh_ArrayOfEdges & TEdges ); -IntPolyh_Triangle::IntPolyh_Triangle() : p1(-1),p2(-1),p3(-1), +//======================================================================= +//function : IntPolyh_Triangle +//purpose : +//======================================================================= +IntPolyh_Triangle::IntPolyh_Triangle() +: + p1(-1),p2(-1),p3(-1), e1(-1),oe1(0),e2(-1),oe2(0),e3(-1),oe3(0), - II(0),IP(1),Fleche(0.0) { } - -IntPolyh_Triangle::IntPolyh_Triangle(const Standard_Integer a,const Standard_Integer b, - const Standard_Integer c) : p1(a),p2(b),p3(c), - e1(-1),oe1(0),e2(-1),oe2(0),e3(-1),oe3(0),II(0),IP(1),Fleche(0.0) { } - -Standard_Integer IntPolyh_Triangle::FirstPoint() const { return(p1); } -Standard_Integer IntPolyh_Triangle::SecondPoint() const { return(p2); } -Standard_Integer IntPolyh_Triangle::ThirdPoint() const { return(p3); } -Standard_Integer IntPolyh_Triangle::FirstEdge() const { return(e1); } -Standard_Integer IntPolyh_Triangle::FirstEdgeOrientation() const { return(oe1); } -Standard_Integer IntPolyh_Triangle::SecondEdge() const { return(e2); } -Standard_Integer IntPolyh_Triangle::SecondEdgeOrientation() const { return(oe2); } -Standard_Integer IntPolyh_Triangle::ThirdEdge() const { return(e3); } -Standard_Integer IntPolyh_Triangle::ThirdEdgeOrientation() const { return(oe3); } -Standard_Real IntPolyh_Triangle::GetFleche() const { return(Fleche); } -Standard_Integer IntPolyh_Triangle::IndiceIntersectionPossible() const { return(IP); } -Standard_Integer IntPolyh_Triangle::IndiceIntersection() const { return(II); } - -void IntPolyh_Triangle::SetFirstPoint(const Standard_Integer a) { p1=a; } -void IntPolyh_Triangle::SetSecondPoint(const Standard_Integer b) { p2=b; } -void IntPolyh_Triangle::SetThirdPoint(const Standard_Integer c) { p3=c; } -void IntPolyh_Triangle::SetFirstEdge(const Standard_Integer e, const Standard_Integer oe) { e1=e; oe1=oe;} -void IntPolyh_Triangle::SetSecondEdge(const Standard_Integer f, const Standard_Integer of) { e2=f; oe2=of; } -void IntPolyh_Triangle::SetThirdEdge(const Standard_Integer g, const Standard_Integer og) { e3=g; oe3=og; } -void IntPolyh_Triangle::SetFleche(const Standard_Real A) { Fleche=A;} -void IntPolyh_Triangle::SetIndiceIntersectionPossible(const Standard_Integer I) { IP=I; } -void IntPolyh_Triangle::SetIndiceIntersection(const Standard_Integer I) { II=I; } - - -Standard_Integer IntPolyh_Triangle::GetEdgeNumber(const Standard_Integer EdgeIndex) const { + II(0),IP(1),Fleche(0.0) +{ +} +//======================================================================= +//function : IntPolyh_Triangle +//purpose : +//======================================================================= +IntPolyh_Triangle::IntPolyh_Triangle(const Standard_Integer a, + const Standard_Integer b, + const Standard_Integer c) +: + p1(a),p2(b),p3(c), + e1(-1),oe1(0),e2(-1),oe2(0),e3(-1),oe3(0), + II(0),IP(1),Fleche(0.0) +{ +} +//======================================================================= +//function : FirstPoint +//purpose : +//======================================================================= +Standard_Integer IntPolyh_Triangle::FirstPoint() const +{ + return(p1); +} +//======================================================================= +//function : SecondPoint +//purpose : +//======================================================================= +Standard_Integer IntPolyh_Triangle::SecondPoint() const +{ + return(p2); +} +//======================================================================= +//function : ThirdPoint +//purpose : +//======================================================================= +Standard_Integer IntPolyh_Triangle::ThirdPoint() const +{ + return(p3); +} +//======================================================================= +//function : FirstEdge +//purpose : +//======================================================================= +Standard_Integer IntPolyh_Triangle::FirstEdge() const +{ + return(e1); +} +//======================================================================= +//function : FirstEdgeOrientation +//purpose : +//======================================================================= +Standard_Integer IntPolyh_Triangle::FirstEdgeOrientation() const +{ + return(oe1); +} +//======================================================================= +//function : SecondEdge +//purpose : +//======================================================================= +Standard_Integer IntPolyh_Triangle::SecondEdge() const +{ + return(e2); +} +//======================================================================= +//function : SecondEdgeOrientation +//purpose : +//======================================================================= +Standard_Integer IntPolyh_Triangle::SecondEdgeOrientation() const +{ + return(oe2); +} +//======================================================================= +//function : ThirdEdge +//purpose : +//======================================================================= +Standard_Integer IntPolyh_Triangle::ThirdEdge() const +{ + return(e3); +} +//======================================================================= +//function : ThirdEdgeOrientation +//purpose : +//======================================================================= +Standard_Integer IntPolyh_Triangle::ThirdEdgeOrientation() const +{ + return(oe3); +} +//======================================================================= +//function : GetFleche +//purpose : +//======================================================================= +Standard_Real IntPolyh_Triangle::GetFleche() const +{ + return(Fleche); +} +//======================================================================= +//function : IndiceIntersectionPossible +//purpose : +//======================================================================= +Standard_Integer IntPolyh_Triangle::IndiceIntersectionPossible() const +{ + return(IP); +} +//======================================================================= +//function : IndiceIntersection +//purpose : +//======================================================================= +Standard_Integer IntPolyh_Triangle::IndiceIntersection() const +{ + return(II); +} +//======================================================================= +//function : SetFirstPoint +//purpose : +//======================================================================= +void IntPolyh_Triangle::SetFirstPoint(const Standard_Integer a) +{ + p1=a; +} +//======================================================================= +//function : SetSecondPoint +//purpose : +//======================================================================= +void IntPolyh_Triangle::SetSecondPoint(const Standard_Integer b) +{ + p2=b; +} +//======================================================================= +//function : SetThirdPoint +//purpose : +//======================================================================= +void IntPolyh_Triangle::SetThirdPoint(const Standard_Integer c) +{ + p3=c; +} +//======================================================================= +//function : SetFirstEdge +//purpose : +//======================================================================= +void IntPolyh_Triangle::SetFirstEdge(const Standard_Integer e, + const Standard_Integer oe) +{ + e1=e; + oe1=oe; +} +//======================================================================= +//function : SetSecondEdge +//purpose : +//======================================================================= +void IntPolyh_Triangle::SetSecondEdge(const Standard_Integer f, + const Standard_Integer of) +{ + e2=f; + oe2=of; +} +//======================================================================= +//function : SetThirdEdge +//purpose : +//======================================================================= +void IntPolyh_Triangle::SetThirdEdge(const Standard_Integer g, + const Standard_Integer og) +{ + e3=g; + oe3=og; +} +//======================================================================= +//function : SetFleche +//purpose : +//======================================================================= +void IntPolyh_Triangle::SetFleche(const Standard_Real A) +{ + Fleche=A; +} +//======================================================================= +//function : SetIndiceIntersectionPossible +//purpose : +//======================================================================= +void IntPolyh_Triangle::SetIndiceIntersectionPossible(const Standard_Integer I) +{ + IP=I; +} +//======================================================================= +//function : SetIndiceIntersection +//purpose : +//======================================================================= +void IntPolyh_Triangle::SetIndiceIntersection(const Standard_Integer I) +{ + II=I; +} +//======================================================================= +//function : GetEdgeNumber +//purpose : +//======================================================================= +Standard_Integer + IntPolyh_Triangle::GetEdgeNumber(const Standard_Integer EdgeIndex) const +{ if(EdgeIndex==1) return(e1); if(EdgeIndex==2) @@ -62,11 +266,14 @@ Standard_Integer IntPolyh_Triangle::GetEdgeNumber(const Standard_Integer EdgeInd return(e3); return 0; - } - +//======================================================================= +//function : SetEdge +//purpose : +//======================================================================= void IntPolyh_Triangle::SetEdge(const Standard_Integer EdgeIndex, - const Standard_Integer EdgeNumber) { + const Standard_Integer EdgeNumber) +{ if(EdgeIndex==1) e1=EdgeNumber; if(EdgeIndex==2) @@ -74,8 +281,13 @@ void IntPolyh_Triangle::SetEdge(const Standard_Integer EdgeIndex, if(EdgeIndex==3) e3=EdgeNumber; } - -Standard_Integer IntPolyh_Triangle::GetEdgeOrientation(const Standard_Integer EdgeIndex) const { +//======================================================================= +//function : GetEdgeOrientation +//purpose : +//======================================================================= +Standard_Integer + IntPolyh_Triangle::GetEdgeOrientation(const Standard_Integer EdgeIndex) const +{ if(EdgeIndex==1) return(oe1); if(EdgeIndex==2) @@ -86,9 +298,13 @@ Standard_Integer IntPolyh_Triangle::GetEdgeOrientation(const Standard_Integer Ed return 0; } - +//======================================================================= +//function : SetEdgeOrientation +//purpose : +//======================================================================= void IntPolyh_Triangle::SetEdgeOrientation(const Standard_Integer EdgeIndex, - const Standard_Integer OrEd) { + const Standard_Integer OrEd) +{ if(EdgeIndex==1) oe1=OrEd; if(EdgeIndex==2) @@ -97,26 +313,47 @@ void IntPolyh_Triangle::SetEdgeOrientation(const Standard_Integer EdgeIndex, oe3=OrEd; } - /*Calcul de la fleche pour un triangle************** - Distance entre le plan forme par le triangle et - le barycentre situe sur la surface calcule avec les coordonnees Gu,Gv - (coordonnees du barycentre du triangle dans l'espace UV)*/ - + +//======================================================================= +//function : TriangleDeflection +//purpose : +/*Calcul de la fleche pour un triangle************** + Distance entre le plan forme par le triangle et + le barycentre situe sur la surface calcule avec les coordonnees Gu,Gv + (coordonnees du barycentre du triangle dans l'espace UV)*/ +//======================================================================= void IntPolyh_Triangle::TriangleDeflection(const Handle(Adaptor3d_HSurface)& MySurface, - const IntPolyh_ArrayOfPoints& TPoints){ - + const IntPolyh_ArrayOfPoints& TPoints) +{ const IntPolyh_Point & P1 = TPoints[p1]; const IntPolyh_Point & P2 = TPoints[p2]; const IntPolyh_Point & P3 = TPoints[p3]; - - Standard_Real Gu=(P1.U()+P2.U()+P3.U())/3.0; - Standard_Real Gv=(P1.V()+P2.V()+P3.V())/3.0; + // + //modified by NIZNHY-PKV Fri Jan 20 14:25:11 2012f + { + Standard_Integer iDeg1, iDeg2, iDeg3, iDeg; + // + iDeg1=(P1.Degenerated()) ? 1 : 0; + iDeg2=(P2.Degenerated()) ? 1 : 0; + iDeg3=(P3.Degenerated()) ? 1 : 0; + iDeg=iDeg1+iDeg2+iDeg3; + if (iDeg>1) { + Fleche=0.; + return; + } + } + //modified by NIZNHY-PKV Fri Jan 20 14:25:13 2012t + Standard_Real Gu, Gv, SqNorme; + gp_Pnt PtXYZ; + // + Gu=(P1.U()+P2.U()+P3.U())/3.0; + Gv=(P1.V()+P2.V()+P3.V())/3.0; - gp_Pnt PtXYZ = (MySurface)->Value( Gu, Gv); + PtXYZ = (MySurface)->Value( Gu, Gv); IntPolyh_Point BarycentreReel(PtXYZ.X(), PtXYZ.Y(), PtXYZ.Z(), Gu, Gv); IntPolyh_Point NormaleTri; NormaleTri.Cross(P2-P1,P3-P1); - Standard_Real SqNorme=NormaleTri.SquareModulus(); + SqNorme=NormaleTri.SquareModulus(); if (SqNorme > SquareMyConfusionPrecision) { NormaleTri=NormaleTri/sqrt(SqNorme); @@ -125,33 +362,10 @@ void IntPolyh_Triangle::TriangleDeflection(const Handle(Adaptor3d_HSurface)& MyS else { // On calcule la fleche sur le plus grand des edges // calcul des longueurs des cotes au carre - Standard_Real L12 = P1.SquareDistance(P2); Standard_Real L23 = P2.SquareDistance(P3); Standard_Real L31 = P3.SquareDistance(P1); - if (L12L23) && (L12>L31)) @@ -168,11 +382,17 @@ void IntPolyh_Triangle::TriangleDeflection(const Handle(Adaptor3d_HSurface)& MyS } } -Standard_Integer IntPolyh_Triangle::CheckCommonEdge(const Standard_Integer PT1, - const Standard_Integer PT2, - const Standard_Integer PT3, - const Standard_Integer Index, - const IntPolyh_ArrayOfTriangles &TTriangles) const { +//======================================================================= +//function : CheckCommonEdge +//purpose : +//======================================================================= +Standard_Integer + IntPolyh_Triangle::CheckCommonEdge(const Standard_Integer PT1, + const Standard_Integer PT2, + const Standard_Integer PT3, + const Standard_Integer Index, + const IntPolyh_ArrayOfTriangles &TTriangles) const +{ Standard_Integer P1,P2,P3,res=-1; P1=TTriangles[Index].FirstPoint(); P2=TTriangles[Index].SecondPoint(); @@ -188,10 +408,15 @@ Standard_Integer IntPolyh_Triangle::CheckCommonEdge(const Standard_Integer PT1, else res=-1; return(res); } - -Standard_Integer IntPolyh_Triangle::GetNextTriangle2(const Standard_Integer NumTri, - const Standard_Integer NumEdge, - const IntPolyh_ArrayOfEdges &TEdges) const { +//======================================================================= +//function : GetNextTriangle2 +//purpose : +//======================================================================= +Standard_Integer + IntPolyh_Triangle::GetNextTriangle2(const Standard_Integer NumTri, + const Standard_Integer NumEdge, + const IntPolyh_ArrayOfEdges &TEdges) const +{ Standard_Integer NumNextTri=-1; if (NumEdge==1) { const IntPolyh_Edge & Edge1=TEdges[e1]; @@ -214,26 +439,20 @@ Standard_Integer IntPolyh_Triangle::GetNextTriangle2(const Standard_Integer NumT else NumNextTri=Edge3.FirstTriangle(); } - else { -# if MYDEBUG - printf("\nTriangleDeflection() from IntPolyh_Triangle :\n"); - printf("Edge index != {1,2,3}, Edge Number=%d\n",NumEdge); -# endif - } return (NumNextTri); } +//======================================================================= +//function : LinkEdges2Triangle +//purpose : +//======================================================================= void IntPolyh_Triangle::LinkEdges2Triangle(const IntPolyh_ArrayOfEdges & TEdges, const Standard_Integer edge1, const Standard_Integer edge2, const Standard_Integer edge3) { if( (edge1<0)||(edge2<0)||(edge3<0) ) { -# if MYDEBUG - printf("LinkEdges2Triangle() from IntPolyh_Triangle.cxx :/n"); - printf("Some edges are unknown LinkEdges2Triangle impossible\n"); - printf("edge1=%d edge2=%d edge3=%d\n",edge1,edge2,edge3); -# endif + } else { e1=edge1; @@ -249,6 +468,10 @@ void IntPolyh_Triangle::LinkEdges2Triangle(const IntPolyh_ArrayOfEdges & TEdges, } } +//======================================================================= +//function : GetInfoTA +//purpose : +//======================================================================= void GetInfoTA(const Standard_Integer numP1, const Standard_Integer numP2, const Standard_Integer numTA, @@ -256,7 +479,8 @@ void GetInfoTA(const Standard_Integer numP1, Standard_Integer & numP3b, Standard_Integer & P3bIndex, Standard_Integer & Edge2b, - Standard_Integer & Edge3b) { + Standard_Integer & Edge3b) +{ /// On veut savoir quel est le troisieme point du triangle /// adjacent (TriAdj) et quel sont les edges partant de ce point const IntPolyh_Triangle & TriAdj=TTriangles[numTA]; @@ -306,13 +530,12 @@ void GetInfoTA(const Standard_Integer numP1, Edge3b=TriAdj.ThirdEdge(); } } - if(numP3b<0) { -# if MYDEBUG - printf("ERROR1 refinement with null Point\n"); -# endif - } } +//======================================================================= +//function : NewTriangle +//purpose : +//======================================================================= void NewTriangle(const Standard_Integer P1, const Standard_Integer P2, const Standard_Integer P3, @@ -327,16 +550,19 @@ void NewTriangle(const Standard_Integer P1, TTriangles.IncNbTriangles(); } +//======================================================================= +//function : NewEdge +//purpose : +//======================================================================= void NewEdge(const Standard_Integer P1, const Standard_Integer P2, const Standard_Integer T1, const Standard_Integer T2, - IntPolyh_ArrayOfEdges & TEdges) { -//#ifndef DEB + IntPolyh_ArrayOfEdges & TEdges) +{ + const Standard_Integer FinTE = TEdges.NbEdges(); -//#else -// const FinTE = TEdges.NbEdges(); -//#endif + TEdges[FinTE].SetFirstPoint(P1); TEdges[FinTE].SetSecondPoint(P2); TEdges[FinTE].SetFirstTriangle(T1); @@ -344,14 +570,27 @@ void NewEdge(const Standard_Integer P1, TEdges.IncNbEdges(); } +//======================================================================= +//function : OldEdge +//purpose : +//======================================================================= void OldEdge(const Standard_Integer EdgeN, const Standard_Integer NumTri, const Standard_Integer NewTriNum, - IntPolyh_ArrayOfEdges & TEdges) { - if(TEdges[EdgeN].FirstTriangle()==NumTri) TEdges[EdgeN].SetFirstTriangle(NewTriNum); - else TEdges[EdgeN].SetSecondTriangle(NewTriNum); + IntPolyh_ArrayOfEdges & TEdges) +{ + if(TEdges[EdgeN].FirstTriangle()==NumTri){ + TEdges[EdgeN].SetFirstTriangle(NewTriNum); + } + else{ + TEdges[EdgeN].SetSecondTriangle(NewTriNum); + } } +//======================================================================= +//function : TestOldEdgeB +//purpose : +//======================================================================= void TestOldEdgeB(const Standard_Integer NumTA, const Standard_Integer numPtT1, const Standard_Integer numPtT2, @@ -360,7 +599,8 @@ void TestOldEdgeB(const Standard_Integer NumTA, const IntPolyh_ArrayOfTriangles & TTriangles, const Standard_Integer Edge1, const Standard_Integer Edge3, - IntPolyh_ArrayOfEdges & TEdges ) { + IntPolyh_ArrayOfEdges & TEdges ) +{ if( (TEdges[Edge1].FirstPoint() == numPtT1) ||(TEdges[Edge1].SecondPoint()== numPtT1) ) { @@ -383,8 +623,10 @@ void TestOldEdgeB(const Standard_Integer NumTA, else TEdges[Edge1].SetSecondTriangle(T2); } } - - +//======================================================================= +//function : MiddleRefinement +//purpose : +//======================================================================= void IntPolyh_Triangle::MiddleRefinement(const Standard_Integer NumTri, const Handle(Adaptor3d_HSurface)& MySurface, IntPolyh_ArrayOfPoints &TPoints, @@ -679,6 +921,10 @@ void IntPolyh_Triangle::MiddleRefinement(const Standard_Integer NumTri, TPoints.IncNbPoints(); } +//======================================================================= +//function : MultipleMiddleRefinement +//purpose : +//======================================================================= void IntPolyh_Triangle::MultipleMiddleRefinement(const Standard_Integer NbAffinages, const Standard_Integer NumTri, const Handle(Adaptor3d_HSurface)& MySurface, @@ -720,6 +966,10 @@ void IntPolyh_Triangle::MultipleMiddleRefinement(const Standard_Integer NbAffina } } +//======================================================================= +//function : CompareBoxTriangle +//purpose : +//======================================================================= Standard_Integer IntPolyh_Triangle::CompareBoxTriangle(const Bnd_Box &b, const IntPolyh_ArrayOfPoints &TPoints) const{ Standard_Integer Test=0; @@ -742,6 +992,10 @@ Standard_Integer IntPolyh_Triangle::CompareBoxTriangle(const Bnd_Box &b, //Pour gagner du temps on pourrait envisager de garder la boite englobante dans la structure du triangle } +//======================================================================= +//function : MultipleMiddleRefinement2 +//purpose : +//======================================================================= void IntPolyh_Triangle::MultipleMiddleRefinement2(const Standard_Real CritereAffinage, const Bnd_Box &b,//boite englobante de l'autre surface const Standard_Integer NumTri, @@ -773,23 +1027,22 @@ void IntPolyh_Triangle::MultipleMiddleRefinement2(const Standard_Real CritereAff } } +//======================================================================= +//function : SetEdgeandOrientation +//purpose : +//======================================================================= void IntPolyh_Triangle::SetEdgeandOrientation(const Standard_Integer EdgeIndex, const IntPolyh_ArrayOfEdges &TEdges) { const Standard_Integer FinTE = TEdges.NbEdges(); -#ifndef DEB + Standard_Integer PE1 =0,PE2 =0; -#else - Standard_Integer PE1,PE2; -#endif + Standard_Integer Test=1; if (EdgeIndex==1) { PE1=p1; PE2=p2; } else if (EdgeIndex==2) { PE1=p2; PE2=p3; } else if (EdgeIndex==3) { PE1=p3; PE2=p1; } else { -# if MYDEBUG - printf("SetEdgeandOrientation() from IntPolyh_Triangle.cxx : No edge, No Edge\n"); -# endif Test=0; } if (Test!=0) { @@ -805,9 +1058,7 @@ void IntPolyh_Triangle::SetEdgeandOrientation(const Standard_Integer EdgeIndex, } } else { -# if MYDEBUG - printf("SetEdgeandOrientation() from IntPolyh_Triangle.cxx : WARNING NULL EDGE\n"); -# endif + Test=0; } } @@ -821,9 +1072,7 @@ void IntPolyh_Triangle::SetEdgeandOrientation(const Standard_Integer EdgeIndex, } } else { -# if MYDEBUG - printf("SetEdgeandOrientation() from IntPolyh_Triangle.cxx : WARNING NULL EDGE\n"); -# endif + } } } @@ -831,72 +1080,22 @@ void IntPolyh_Triangle::SetEdgeandOrientation(const Standard_Integer EdgeIndex, } -void IntPolyh_Triangle::Dump (const Standard_Integer i) const { +//======================================================================= +//function : Dump +//purpose : +//======================================================================= +void IntPolyh_Triangle::Dump (const Standard_Integer i) const +{ printf("\nTriangle(%3d) : Points %5d %5d %5d Edges %5d %5d %5d fleche: %8f intersection possible %8d intersection: %5d\n" ,i,p1,p2,p3,e1,e2,e3,Fleche,IP,II); } +//======================================================================= +//function : DumpFleche +//purpose : +//======================================================================= void IntPolyh_Triangle::DumpFleche (const Standard_Integer i) const { printf("\nTriangle(%3d) fleche: %5f\n",i,Fleche); } - - -/* Affinage par le barycentre - calcul du barycentre - remaillage - - void IntPolyh_MaillageAffinage::RefinementG(const Standard_Integer SurfID, - IntPolyh_Triangle& MonTriangle){ - - Handle(Adaptor3d_HSurface) MaSurface=(SurfID==1)? MaSurface1:MaSurface2; - IntPolyh_ArrayOfPoints &TPoints=(SurfID==1)? TPoints1:TPoints2; - IntPolyh_ArrayOfTriangles &TTriangles=(SurfID==1)? TTriangles1:TTriangles2; - Standard_Integer NbSamplesU=(SurfID==1)? NbSamplesU1:NbSamplesU2; - Standard_Integer NbSamplesV=(SurfID==1)? NbSamplesV1:NbSamplesV2; - - Standard_Integer FinTP = TPoints.NbPoints(); - Standard_Integer FinTT = TTriangles.NbTriangles(); - - - Standard_Integer P1 = MonTriangle.FirstPoint(); - Standard_Integer P2 = MonTriangle.SecondPoint(); - Standard_Integer P3 = MonTriangle.ThirdPoint(); - - - Standard_Real U,V,x,y,z; - U = (TPoints[P1].U()+TPoints[P2].U()+TPoints[P3].U())/3.0; - V = (TPoints[P1].V()+TPoints[P2].V()+TPoints[P3].V())/3.0; - - gp_Pnt PtXYZ = (MaSurface)->Value(U, V); - IntPolyh_Point BarycentreTriangleReel(PtXYZ.X(), PtXYZ.Y(), PtXYZ.Z(), U, V); - TPoints[FinTP]=BarycentreTriangleReel; - - TTriangles[FinTT].SetFirstPoint(P1); - TTriangles[FinTT].SetSecondPoint(P2); - TTriangles[FinTT].SetThirdPoint(FinTP); - (TTriangles[FinTT]).TriangleDeflection(MaSurface, TPoints); - FinTT++; - - TTriangles[FinTT].SetFirstPoint(P2); - TTriangles[FinTT].SetSecondPoint(P3); - TTriangles[FinTT].SetThirdPoint(FinTP); - (TTriangles[FinTT]).TriangleDeflection(MaSurface, TPoints); - FinTT++; - - TTriangles[FinTT].SetFirstPoint(P3); - TTriangles[FinTT].SetSecondPoint(P1); - TTriangles[FinTT].SetThirdPoint(FinTP); - (TTriangles[FinTT]).TriangleDeflection(MaSurface, TPoints); - FinTT++; - - // FinTP++; - TPoints.IncNbPoints(); - TTriangles.SetNbTriangles(FinTT); - // Le triangle traite est maintenant obsolete - MonTriangle.SetFleche(-1.0); - }*/ - - -