X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_XYZ.cpp;h=d13c91977f958306606381776db1a1edce57bb1b;hb=026f5b80ebe2c718246d80f9cb9bea3887406c12;hp=30c246323a26d18feb7e9e8b9117816852c4b5b9;hpb=d55b9b2a4aec1ad934bed2edda57d31ea33e34ae;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_XYZ.cpp b/src/GeomAPI/GeomAPI_XYZ.cpp index 30c246323..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,17 +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::multiplied(const double theArg) +const std::shared_ptr GeomAPI_XYZ::decreased( + const std::shared_ptr& 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->x(), + MY_XYZ->Y() - theArg->y(), MY_XYZ->Z() - theArg->z())); return aResult; } + +const std::shared_ptr GeomAPI_XYZ::multiplied(const double 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 std::shared_ptr& theArg) const +{ + return MY_XYZ->Dot(theArg->impl()); +} + +const std::shared_ptr GeomAPI_XYZ::cross( + const std::shared_ptr& theArg) const +{ + gp_XYZ aResult = MY_XYZ->Crossed(theArg->impl()); + return std::shared_ptr(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z())); +} + +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(); +}