X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_XYZ.cpp;h=d13c91977f958306606381776db1a1edce57bb1b;hb=026f5b80ebe2c718246d80f9cb9bea3887406c12;hp=f413005fd0aebc80ab6744fef5787a82920b4a85;hpb=81dad1acf409fa5e71090501bc1aa7e0b7d80cde;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_XYZ.cpp b/src/GeomAPI/GeomAPI_XYZ.cpp index f413005fd..d13c91977 100644 --- a/src/GeomAPI/GeomAPI_XYZ.cpp +++ b/src/GeomAPI/GeomAPI_XYZ.cpp @@ -1,16 +1,32 @@ -// File: GeomAPI_XYZ.cpp -// Created: 23 Apr 2014 -// Author: Mikhail PONIKAROV +// Copyright (C) 2014-2019 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 -#define MY_XYZ static_cast(myImpl) +#define MY_XYZ implPtr() GeomAPI_XYZ::GeomAPI_XYZ(const double theX, const double theY, const double theZ) - : GeomAPI_Interface(new gp_XYZ(theX, theY, theZ)) -{} + : GeomAPI_Interface(new gp_XYZ(theX, theY, theZ)) +{ +} double GeomAPI_XYZ::x() const { @@ -42,43 +58,48 @@ void GeomAPI_XYZ::setZ(const double theZ) return MY_XYZ->SetZ(theZ); } -const boost::shared_ptr GeomAPI_XYZ::added( - const boost::shared_ptr& theArg) +const std::shared_ptr GeomAPI_XYZ::added( + const std::shared_ptr& theArg) { - boost::shared_ptr aResult(new GeomAPI_XYZ(MY_XYZ->X() + theArg->x(), - MY_XYZ->Y() + theArg->y(), MY_XYZ->Z() + theArg->z())); + std::shared_ptr aResult(new GeomAPI_XYZ(MY_XYZ->X() + theArg->x(), + MY_XYZ->Y() + theArg->y(), MY_XYZ->Z() + theArg->z())); return aResult; } -const boost::shared_ptr GeomAPI_XYZ::decreased( - const boost::shared_ptr& theArg) +const std::shared_ptr GeomAPI_XYZ::decreased( + const std::shared_ptr& theArg) { - boost::shared_ptr aResult(new GeomAPI_XYZ(MY_XYZ->X() - theArg->x(), - MY_XYZ->Y() - theArg->y(), MY_XYZ->Z() - theArg->z())); + std::shared_ptr aResult(new GeomAPI_XYZ(MY_XYZ->X() - theArg->x(), + MY_XYZ->Y() - theArg->y(), MY_XYZ->Z() - theArg->z())); return aResult; } -const boost::shared_ptr GeomAPI_XYZ::multiplied(const double theArg) +const std::shared_ptr GeomAPI_XYZ::multiplied(const double theArg) { - boost::shared_ptr aResult(new GeomAPI_XYZ(MY_XYZ->X() * theArg, - MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg)); + std::shared_ptr aResult(new GeomAPI_XYZ(MY_XYZ->X() * theArg, + MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg)); return aResult; } -double GeomAPI_XYZ::dot(const boost::shared_ptr& theArg) const +double GeomAPI_XYZ::dot(const std::shared_ptr& theArg) const { return MY_XYZ->Dot(theArg->impl()); } -const boost::shared_ptr GeomAPI_XYZ::cross(const boost::shared_ptr& theArg) const +const std::shared_ptr GeomAPI_XYZ::cross( + const std::shared_ptr& theArg) const { gp_XYZ aResult = MY_XYZ->Crossed(theArg->impl()); - return boost::shared_ptr(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z())); + return std::shared_ptr(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z())); } -double GeomAPI_XYZ::distance(const boost::shared_ptr& theOther) const +double GeomAPI_XYZ::distance(const std::shared_ptr& theOther) const { gp_XYZ aResult(theOther->x() - x(), theOther->y() - y(), theOther->z() - z()); return aResult.Modulus(); } +double GeomAPI_XYZ::squareModulus() const +{ + return MY_XYZ->SquareModulus(); +}