//
// This file is part of Open CASCADE Technology software library.
//
-// This library is free software; you can redistribute it and / or modify it
-// under the terms of the GNU Lesser General Public version 2.1 as published
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
TopoDS_Vertex V0 = sae.LastVertex (E1);
TopoDS_Vertex V1 = sae.FirstVertex (E2);
TopoDS_Vertex V2 = sae.LastVertex (E2);
+
+ if (Vp.IsNull() || V0.IsNull() || V1.IsNull() || V2.IsNull())
+ return Standard_False;
+
gp_Pnt pp = BRep_Tool::Pnt (Vp); //:i9
gp_Pnt p0 = BRep_Tool::Pnt (V0);
gp_Pnt p1 = BRep_Tool::Pnt (V1);
Standard_Real param2 = IP.ParamOnSecond();
gp_Pnt pi1 = GetPointOnEdge ( edge1, mySurf, Crv1, param1 ); //:h0: thesurf.Value ( Crv1->Value ( param1 ) );
gp_Pnt pi2 = GetPointOnEdge ( edge2, mySurf, Crv2, param2 );
- Standard_Boolean OK = Standard_False;
- for(Standard_Integer j=1; (j<=4)&&!OK; j++) {
+ Standard_Boolean OK1 = Standard_False;
+ Standard_Boolean OK2 = Standard_False;
+
+ for(Standard_Integer j=1; (j<=2)&&!OK1; j++) {
Standard_Real di1 = pi1.SquareDistance (vertexPoints(j));
+ if(di1 < vertexTolers(j) * vertexTolers(j))
+ OK1 = Standard_True;
+ }
+
+ for(Standard_Integer j=3; (j<=4)&&!OK2; j++) {
Standard_Real di2 = pi2.SquareDistance (vertexPoints(j));
- Standard_Real dist2 = Max ( di1, di2 );
- if(dist2 < vertexTolers(j) * vertexTolers(j))
- OK = Standard_True;
+ if(di2 < vertexTolers(j) * vertexTolers(j))
+ OK2 = Standard_True;
}
- if(!OK) {
+
+ if(!OK1 || !OK2) {
gp_Pnt pint = 0.5 * ( pi1.XYZ() + pi2.XYZ() );
points2d.Append ( IP );
points3d.Append ( pint );