-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2020 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// 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
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "GeomAlgoAPI_PointBuilder.h"
GeomAPI_ProjectPointOnCurve aProjection(aPnt, aCurve);
- if (aProjection.NbPoints() == 0) {
- return aVertex;
+ if (aProjection.NbPoints() != 0) {
+ gp_Pnt aNearestPoint = aProjection.NearestPoint();
+ aVertex.reset(new GeomAPI_Vertex(aNearestPoint.X(), aNearestPoint.Y(), aNearestPoint.Z()));
}
- gp_Pnt aNearestPoint = aProjection.NearestPoint();
-
- aVertex.reset(new GeomAPI_Vertex(aNearestPoint.X(), aNearestPoint.Y(), aNearestPoint.Z()));
-
return aVertex;
}
{
std::shared_ptr<GeomAPI_Vertex> aVertex;
- if(!theVertex.get() || !theFace.get() || !theFace->isPlanar()) {
- return aVertex;
- }
-
- std::shared_ptr<GeomAPI_Pnt> aProjPnt = theVertex->point();
- std::shared_ptr<GeomAPI_Pln> aProjPln = theFace->getPlane();
+ if (theVertex.get() && theFace.get() && theFace->isPlanar()) {
+ std::shared_ptr<GeomAPI_Pnt> aProjPnt = theVertex->point();
+ std::shared_ptr<GeomAPI_Pln> aProjPln = theFace->getPlane();
- std::shared_ptr<GeomAPI_Pnt> aPnt = aProjPln->project(aProjPnt);
+ std::shared_ptr<GeomAPI_Pnt> aPnt = aProjPln->project(aProjPnt);
- if(!aPnt.get()) {
- return aVertex;
+ if (aPnt.get())
+ aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
}
- aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
-
return aVertex;
}
{
std::shared_ptr<GeomAPI_Vertex> aVertex;
- if(!theEdge1.get() || !theEdge2.get() || !theEdge1->isLine() || !theEdge2->isLine()) {
- return aVertex;
- }
-
- std::shared_ptr<GeomAPI_Lin> aLin1 = theEdge1->line();
- std::shared_ptr<GeomAPI_Lin> aLin2 = theEdge2->line();
-
- std::shared_ptr<GeomAPI_Pnt> aPnt = aLin1->intersect(aLin2);
-
- if(!aPnt.get()) {
- return aVertex;
- }
-
- aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
-
- return aVertex;
-}
-
-//==================================================================================================
-std::shared_ptr<GeomAPI_Vertex> GeomAlgoAPI_PointBuilder::vertexByIntersection(
- const std::shared_ptr<GeomAPI_Edge> theEdge,
- const std::shared_ptr<GeomAPI_Face> theFace)
-{
- std::shared_ptr<GeomAPI_Vertex> aVertex;
-
- if(!theEdge.get() || !theFace.get() || !theEdge->isLine() || !theFace->isPlanar()) {
- return aVertex;
- }
-
- std::shared_ptr<GeomAPI_Lin> aLin = theEdge->line();
- std::shared_ptr<GeomAPI_Pln> aPln = theFace->getPlane();
+ if (theEdge1.get() && theEdge2.get() && theEdge1->isLine() && theEdge2->isLine()) {
+ std::shared_ptr<GeomAPI_Lin> aLin1 = theEdge1->line();
+ std::shared_ptr<GeomAPI_Lin> aLin2 = theEdge2->line();
- std::shared_ptr<GeomAPI_Pnt> aPnt = aPln->intersect(aLin);
+ std::shared_ptr<GeomAPI_Pnt> aPnt = aLin1->intersect(aLin2);
- if(!aPnt.get()) {
- return aVertex;
+ if (aPnt.get())
+ aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
}
- aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
-
return aVertex;
}