X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FGeomAPI%2FGeomAPI_Pnt2d.cpp;h=78e7b2521cea18deb3647a3d20c615bc2b1cd898;hb=704b13912d9014fca20c36fe91a389b9d12353e8;hp=e1cdf3d283e53b2627bee83afb0681b542f28b1a;hpb=258a626d26271b93bae55eb0803de020e2b6f315;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Pnt2d.cpp b/src/GeomAPI/GeomAPI_Pnt2d.cpp index e1cdf3d28..78e7b2521 100644 --- a/src/GeomAPI/GeomAPI_Pnt2d.cpp +++ b/src/GeomAPI/GeomAPI_Pnt2d.cpp @@ -1,6 +1,22 @@ -// File: GeomAPI_Pnt2d.cpp -// Created: 29 May 2014 -// Author: Artem ZHIDKOV +// 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 @@ -10,15 +26,19 @@ #include -#define MY_PNT2D static_cast(myImpl) +#include + +#define MY_PNT2D implPtr() GeomAPI_Pnt2d::GeomAPI_Pnt2d(const double theX, const double theY) - : GeomAPI_Interface(new gp_Pnt2d(theX, theY)) -{} + : GeomAPI_Interface(new gp_Pnt2d(theX, theY)) +{ +} -GeomAPI_Pnt2d::GeomAPI_Pnt2d(const boost::shared_ptr& theCoords) - : GeomAPI_Interface(new gp_Pnt2d(theCoords->x(), theCoords->y())) -{} +GeomAPI_Pnt2d::GeomAPI_Pnt2d(const std::shared_ptr& theCoords) + : GeomAPI_Interface(new gp_Pnt2d(theCoords->x(), theCoords->y())) +{ +} double GeomAPI_Pnt2d::x() const { @@ -40,22 +60,27 @@ void GeomAPI_Pnt2d::setY(const double theY) return MY_PNT2D->SetY(theY); } -boost::shared_ptr GeomAPI_Pnt2d::to3D(const boost::shared_ptr& theOrigin, - const boost::shared_ptr& theDirX, - const boost::shared_ptr& theDirY) +std::shared_ptr GeomAPI_Pnt2d::to3D(const std::shared_ptr& theOrigin, + const std::shared_ptr& theDirX, + const std::shared_ptr& theDirY) { - boost::shared_ptr aSum = theOrigin->xyz()->added( - theDirX->xyz()->multiplied(x()))->added(theDirY->xyz()->multiplied(y())); + std::shared_ptr aSum = theOrigin->xyz()->added(theDirX->xyz()->multiplied(x())) + ->added(theDirY->xyz()->multiplied(y())); - return boost::shared_ptr(new GeomAPI_Pnt(aSum)); + return std::shared_ptr(new GeomAPI_Pnt(aSum)); } -const boost::shared_ptr GeomAPI_Pnt2d::xy() +const std::shared_ptr GeomAPI_Pnt2d::xy() { - return boost::shared_ptr(new GeomAPI_XY(MY_PNT2D->X(), MY_PNT2D->Y())); + return std::shared_ptr(new GeomAPI_XY(MY_PNT2D->X(), MY_PNT2D->Y())); } -double GeomAPI_Pnt2d::distance(const boost::shared_ptr& theOther) const +double GeomAPI_Pnt2d::distance(const std::shared_ptr& theOther) const { return MY_PNT2D->Distance(theOther->impl()); } + +bool GeomAPI_Pnt2d::isEqual(const std::shared_ptr& theOther) const +{ + return distance(theOther) < Precision::Confusion(); +}