Salome HOME
Add a new method for translation feature : translation by DX, DY, DZ vector.
[modules/shaper.git] / src / GeomAPI / GeomAPI_Trsf.cpp
1 // Copyright (C) 2014-2016 CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_Trsf.cpp
4 // Created:     13 Jul 2015
5 // Author:      Mikhail PONIKAROV
6 //
7 // Modified by Clarisse Genrault (CEA) : 17 Nov 2016
8
9 #include<GeomAPI_Trsf.h>
10
11 #include <GeomAPI_Ax1.h>
12
13 #include <gp_Ax1.hxx>
14 #include<gp_Trsf.hxx>
15
16 #define MY_TRSF implPtr<gp_Trsf>()
17
18 //=================================================================================================
19 GeomAPI_Trsf::GeomAPI_Trsf()
20 : GeomAPI_Interface(new gp_Trsf())
21 {
22 }
23
24 //=================================================================================================
25 GeomAPI_Trsf::GeomAPI_Trsf(void* theTrsf)
26 : GeomAPI_Interface(theTrsf)
27 {
28 }
29
30 //=================================================================================================
31 void GeomAPI_Trsf::setTranslation(const std::shared_ptr<GeomAPI_Ax1> theAxis,
32                                   const double theDistance)
33 {
34   MY_TRSF->SetTranslation(gp_Vec(theAxis->impl<gp_Ax1>().Direction()) * theDistance);
35 }
36
37 //=================================================================================================
38 void GeomAPI_Trsf::setTranslation(const double theDx, const double theDy, const double theDz)
39 {
40   MY_TRSF->SetTranslation(gp_Vec(theDx, theDy, theDz));
41 }
42
43 //=================================================================================================
44 void GeomAPI_Trsf::setRotation(const std::shared_ptr<GeomAPI_Ax1> theAxis,
45                                const double theAngle)
46 {
47   MY_TRSF->SetRotation(theAxis->impl<gp_Ax1>(), theAngle / 180.0 * M_PI);
48 }