X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_EdgeBuilder.cpp;h=d6ba70d19919110cfe07087731d15cd75995457f;hb=b461398b1e2fa134eb33cf1ad8bc516e6ee40620;hp=a1ada3eca4646509a46838e02f1e0a977646a247;hpb=b10121c96c858fda6a7861d0a6764304bb7bc140;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp index a1ada3eca..d6ba70d19 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp @@ -1,8 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: GeomAlgoAPI_EdgeBuilder.cpp -// Created: 23 Apr 2014 -// Author: Mikhail PONIKAROV +// Copyright (C) 2014-2017 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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 +// #include #include @@ -17,6 +31,7 @@ #include #include +#include #include #include @@ -184,7 +199,7 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircleArc( /// OCCT creates an edge on a circle with empty radius, but visualization /// is not able to process it - if (theCenter->isEqual(theStartPoint)) + if (theCenter->isEqual(theStartPoint) || theCenter->isEqual(theEndPoint)) return aRes; double aRadius = theCenter->distance(theStartPoint); @@ -208,3 +223,23 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircleArc( } return aRes; } + +std::shared_ptr GeomAlgoAPI_EdgeBuilder::ellipse( + const std::shared_ptr& theCenter, + const std::shared_ptr& theNormal, + const std::shared_ptr& theMajorAxis, + const double theMajorRadius, + const double theMinorRadius) +{ + const gp_Pnt& aCenter = theCenter->impl(); + const gp_Dir& aNormal = theNormal->impl(); + const gp_Dir& aMajorAxis = theMajorAxis->impl(); + + gp_Elips anEllipse(gp_Ax2(aCenter, aNormal, aMajorAxis), theMajorRadius, theMinorRadius); + + BRepBuilderAPI_MakeEdge anEdgeBuilder(anEllipse); + std::shared_ptr aRes(new GeomAPI_Edge); + TopoDS_Edge anEdge = anEdgeBuilder.Edge(); + aRes->setImpl(new TopoDS_Shape(anEdge)); + return aRes; +}