-// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: GEOMAlgo_Tools.cxx
// Created: Mon Dec 6 11:35:29 2004
// Author: Peter KURNEV
// <pkv@irinox>
-
+//
#include <GEOMAlgo_Tools.ixx>
#include <gp_Pnt.hxx>
else {
bIsDone=GEOMAlgo_Tools::ProjectPointOnShape(aP1, aE2, aP2, aCtx);
if (!bIsDone) {
- return 1;
+ //return 1;
+ continue; // jfa BUG 20361
}
aD2=aP1.SquareDistance(aP2);
if(aD2<aTol2) {
gp_Pnt& aP2,
IntTools_Context& aCtx)
{
- Standard_Boolean bIsDone=Standard_False;
+ Standard_Boolean bIsDone = Standard_False;
Standard_Real aT2;
TopAbs_ShapeEnum aType;
//
- aType=aS.ShapeType();
- switch(aType) {
- case TopAbs_EDGE: {
- const TopoDS_Edge& aE2=TopoDS::Edge(aS);
- //
- bIsDone=aCtx.ProjectPointOnEdge(aP1, aE2, aT2);
- if (!bIsDone) {
- return bIsDone;
+ aType = aS.ShapeType();
+ switch (aType)
+ {
+ case TopAbs_EDGE:
+ {
+ const TopoDS_Edge& aE2 = TopoDS::Edge(aS);
+ //
+ if (BRep_Tool::Degenerated(aE2)) { // jfa
+ return Standard_True;
+ }
+ else {
+ Standard_Real f, l;
+ Handle(Geom_Curve) aC3D = BRep_Tool::Curve (aE2, f, l);
+ if (aC3D.IsNull()) {
+ return Standard_True;
+ }
+ bIsDone = aCtx.ProjectPointOnEdge(aP1, aE2, aT2);
+ }
+ if (!bIsDone) {
+ return bIsDone;
+ }
+ //
+ GEOMAlgo_Tools::PointOnEdge(aE2, aT2, aP2);
}
- //
- GEOMAlgo_Tools::PointOnEdge(aE2, aT2, aP2);
- }
break;
//
- case TopAbs_FACE: {
- const TopoDS_Face& aF2=TopoDS::Face(aS);
- GeomAPI_ProjectPointOnSurf& aProj=aCtx.ProjPS(aF2);
- //
- aProj.Perform(aP1);
- bIsDone=aProj.IsDone();
- if (!bIsDone) {
- return bIsDone;
+ case TopAbs_FACE:
+ {
+ const TopoDS_Face& aF2 = TopoDS::Face(aS);
+ GeomAPI_ProjectPointOnSurf& aProj = aCtx.ProjPS(aF2);
+ //
+ aProj.Perform(aP1);
+ bIsDone = aProj.IsDone();
+ if (!bIsDone) {
+ return bIsDone;
+ }
+ //
+ aP2 = aProj.NearestPoint();
}
- //
- aP2=aProj.NearestPoint();
- }
break;
//
default:
break; // Err
- }
+ }
return bIsDone;
}
//=======================================================================