break;
}
}
-
- //-- --------------------------------------------------------
- //-- Check maximum yawn between 2 edges
- //--
- //-- Check distance from edges to the curve joining
- //-- the point of intersection with vertex (if exists)
- if (localok == Standard_False && !CommonVertices.IsEmpty()) {
-#ifdef DEB
- cout << "\n------------------------------------------------------\n" <<endl;
- cout << "\n--- BRepCheck Wire: AutoIntersection Phase1 -> Erreur \n" <<endl;
-
-#endif
- Standard_Real distauvtxleplusproche,VParaOnEdge1,VParaOnEdge2;
- gp_Pnt VertexLePlusProche;
- //
- VParaOnEdge1 =0.;
- VParaOnEdge2 =0.;
- distauvtxleplusproche=RealLast();
- //Find the nearest common vertex
- itl.Initialize( CommonVertices );
- for (; itl.More(); itl.Next()) {
- Standard_Real disptvtx;
- gp_Pnt p3dvtt;
- //
- const TopoDS_Vertex& vtt = TopoDS::Vertex(itl.Value());
- p3dvtt = BRep_Tool::Pnt(vtt);
- disptvtx = P3d.Distance(p3dvtt);
- if (disptvtx < distauvtxleplusproche) {
- VertexLePlusProche = p3dvtt;
- distauvtxleplusproche = disptvtx;
- VParaOnEdge1 = BRep_Tool::Parameter(vtt,E1);
- VParaOnEdge2 = BRep_Tool::Parameter(vtt,E2);
- }
- // eap: case of closed edge
- else if (IsEqual(distauvtxleplusproche, disptvtx)) {
- Standard_Real newVParaOnEdge1 = BRep_Tool::Parameter(vtt,E1);
- Standard_Real newVParaOnEdge2 = BRep_Tool::Parameter(vtt,E2);
- if (Abs(IP_ParamOnFirst - VParaOnEdge1) + Abs(IP_ParamOnSecond - VParaOnEdge2)
- >
- Abs(IP_ParamOnFirst - newVParaOnEdge1) + Abs(IP_ParamOnSecond - newVParaOnEdge2)) {
- VertexLePlusProche = p3dvtt;
- VParaOnEdge1 = newVParaOnEdge1;
- VParaOnEdge2 = newVParaOnEdge2;
- }
- }
- }
- //Patch: extraordinar situation (e.g. tolerance(v) == 0.)
- // Modified by skv - Wed Jul 23 12:28:11 2003 OCC1764 Begin
- // if (VertexLePlusProche.Distance( P3d ) <= gp::Resolution())
- if (VertexLePlusProche.Distance(P3d) <= gp::Resolution() ||
- VertexLePlusProche.Distance(P3d2) <= gp::Resolution()) {
- // Modified by skv - Wed Jul 23 12:28:12 2003 OCC1764 End
- localok = Standard_True;
- }
- else {
- gp_Lin Lig( VertexLePlusProche, gp_Vec(VertexLePlusProche,P3d) );
- Standard_Real du1 = 0.1*(IP_ParamOnFirst -VParaOnEdge1);
- Standard_Real du2 = 0.1*(IP_ParamOnSecond-VParaOnEdge2);
- Standard_Real maxd1 = 0., maxd2 = 0.;
- Standard_Integer k;
-
- localok = Standard_True;
- Standard_Real tole1 = BRep_Tool::Tolerance(E1);
- for (k = 2; localok && k < 9; k++) {
- Standard_Real u = VParaOnEdge1 + k*du1; // check if it works
- gp_Pnt P1;
- // Modified by Sergey KHROMOV - Mon Apr 15 12:34:22 2002 Begin
- if (!ConS.IsNull()) {
- P1 = ConS->Value(u);
- P1.Transform(L.Transformation());
- }
- else {
- gp_Pnt2d aP2d = C1.Value(u);
- P1 = HS->Value(aP2d.X(), aP2d.Y());
- }
- // Modified by Sergey KHROMOV - Mon Apr 15 12:34:22 2002 End
- Standard_Real d1 = Lig.Distance(P1);
- if (d1 > maxd1) {
- maxd1 = d1;
- }
- if (d1 > tole1*2.0){
- localok = Standard_False;
- }
- }
- //-- same for edge2
- // Modified by skv - Wed Jul 23 12:22:20 2003 OCC1764 Begin
- gp_Dir aTmpDir(P3d2.XYZ().Subtracted(VertexLePlusProche.XYZ()));
-
- Lig.SetDirection(aTmpDir);
- // Modified by skv - Wed Jul 23 12:22:23 2003 OCC1764 End
- Standard_Real tole2 = BRep_Tool::Tolerance(E2);
- for (k = 2; localok && k < 9; k++) {
- Standard_Real u = VParaOnEdge2 + k*du2; // check if it works
- gp_Pnt P2;
- // Modified by Sergey KHROMOV - Mon Apr 15 12:34:22 2002 Begin
- if (!ConS2.IsNull()) {
- P2 = ConS2->Value(u);
- P2.Transform(L2.Transformation());
- }
- else {
- gp_Pnt2d aP2d = C2.Value(u);
- P2 = HS->Value(aP2d.X(), aP2d.Y());
- }
- // Modified by Sergey KHROMOV - Mon Apr 15 12:34:22 2002 End
- Standard_Real d2 = Lig.Distance(P2);
- if (d2 > maxd2) {
- maxd2 = d2;
- }
- if (d2 > tole2*2.0){
- localok = Standard_False;
- }
- }
-#ifdef DEB
- if(localok) {
- printf("--- BRepCheck Wire: AutoIntersection Phase2 -> Bon \n");
- printf("--- distance Point Vertex : %10.7g (tol %10.7g)\n",distauvtxleplusproche,tolvtt);
- printf("--- Erreur Max sur E1 : %10.7g Tol_Edge:%10.7g\n",maxd1,tole1);
- printf("--- Erreur Max sur E2 : %10.7g Tol_Edge:%10.7g\n",maxd2,tole2);
- fflush(stdout);
- }
- else {
- printf("--- BRepCheck Wire: AutoIntersection Phase2 -> Erreur \n");
- printf("--- distance Point Vertex : %10.7g (tol %10.7g)\n",distauvtxleplusproche,tolvtt);
- printf("--- Erreur Max sur E1 : %10.7g Tol_Edge:%10.7g\n",maxd1,tole1);
- printf("--- Erreur Max sur E2 : %10.7g Tol_Edge:%10.7g\n",maxd2,tole2);
- fflush(stdout);
- }
-#endif
- } //end of else (construction of the line Lig)
- } //end of if (localok == Standard_False && !CommonVertices.IsEmpty())
+
//
if(localok==Standard_False) {
retE1=E1;