From 16d728a98dd1dea0ff8c19f8c0b0703e8c4ea131 Mon Sep 17 00:00:00 2001 From: nicolas le goff Date: Sun, 8 Dec 2024 21:34:11 +0100 Subject: [PATCH] Revert "Fix issue#86" This reverts commit 4477641303177460f0bb6cb80c6983c46f5de59b. We keep the modification to the removal of "import sys in "test_issue_35.py, which is unrelated. Use of GeomAPI_ProjectPointOnSurf in OCCGeomRepresentation::projectPointOn proved to be controversial --- src/Core/Geom/OCCGeomRepresentation.cpp | 51 ++++++++----------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/src/Core/Geom/OCCGeomRepresentation.cpp b/src/Core/Geom/OCCGeomRepresentation.cpp index f51fd36..8c80de6 100644 --- a/src/Core/Geom/OCCGeomRepresentation.cpp +++ b/src/Core/Geom/OCCGeomRepresentation.cpp @@ -1782,6 +1782,7 @@ void OCCGeomRepresentation::project(const Utils::Math::Point& P1, Utils::Math::P /*----------------------------------------------------------------------------*/ void OCCGeomRepresentation::projectPointOn( Utils::Math::Point& P) { + if(!m_shape.IsNull() && m_shape.ShapeType()==TopAbs_VERTEX) { gp_Pnt pnt = BRep_Tool::Pnt(TopoDS::Vertex(m_shape)); @@ -1790,42 +1791,20 @@ void OCCGeomRepresentation::projectPointOn( Utils::Math::Point& P) else { gp_Pnt pnt(P.getX(),P.getY(),P.getZ()); - - // issue#86 : dans le cas des surfaces, si la surface est toute petite, - // il faut projeter avec GeomAPI_ProjectPointOnSurf au lieu de - // BRepExtrema_DistShapeShape pour éviter les imprécisions numériques. - bool is_done = false; - if (m_shape.ShapeType()==TopAbs_FACE && computeSurfaceArea() 0) { - gp_Pnt pnt2 = projector.NearestPoint(); // Point projeté le plus proche - P.setXYZ(pnt2.X(), pnt2.Y(), pnt2.Z()); - is_done = true; - } - } - - if (!is_done) { - TopoDS_Vertex V = BRepBuilderAPI_MakeVertex(pnt); - BRepExtrema_DistShapeShape extrema(V, m_shape); - bool isDone = extrema.IsDone(); - if(!isDone) { - isDone = extrema.Perform(); - } - - if(!isDone){ - std::cerr<<"OCCGeomRepresentation::projectPointOn("< "<