1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <GeomAlgoAPI_Translation.h>
22 #include <GeomAPI_Ax1.h>
23 #include <GeomAPI_Shape.h>
25 #include <Precision.hxx>
27 //=================================================================================================
28 GeomAlgoAPI_Translation::GeomAlgoAPI_Translation(std::shared_ptr<GeomAPI_Shape> theSourceShape,
29 std::shared_ptr<GeomAPI_Ax1> theAxis,
33 myError = "Translation builder :: axis is not valid.";
37 GeomTrsfPtr aTrsf(new GeomAPI_Trsf);
38 aTrsf->setTranslation(theAxis, theDistance);
40 build(theSourceShape, aTrsf);
43 //=================================================================================================
44 GeomAlgoAPI_Translation::GeomAlgoAPI_Translation(std::shared_ptr<GeomAPI_Shape> theSourceShape,
49 GeomTrsfPtr aTrsf(new GeomAPI_Trsf);
50 aTrsf->setTranslation(theDx, theDy, theDz);
52 build(theSourceShape, aTrsf);
55 //=================================================================================================
56 GeomAlgoAPI_Translation::GeomAlgoAPI_Translation(std::shared_ptr<GeomAPI_Shape> theSourceShape,
57 std::shared_ptr<GeomAPI_Pnt> theStartPoint,
58 std::shared_ptr<GeomAPI_Pnt> theEndPoint)
61 myError = "Translation builder :: start point is not valid.";
65 myError = "Translation builder :: end point is not valid.";
68 if (theStartPoint->distance(theEndPoint) < Precision::Confusion()) {
69 myError = "Translation builder :: start point and end point coincide.";
73 GeomTrsfPtr aTrsf(new GeomAPI_Trsf);
74 aTrsf->setTranslation(theStartPoint, theEndPoint);
76 build(theSourceShape, aTrsf);