Salome HOME
Translation and Rotation code clean up
[modules/shaper.git] / src / GeomAPI / GeomAPI_Trsf.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_Trsf.cpp
4 // Created:     13 Jul 2015
5 // Author:      Mikhail PONIKAROV
6
7 #include<GeomAPI_Trsf.h>
8
9 #include <GeomAPI_Ax1.h>
10
11 #include <gp_Ax1.hxx>
12 #include<gp_Trsf.hxx>
13
14 #define MY_TRSF implPtr<gp_Trsf>()
15
16 //=================================================================================================
17 GeomAPI_Trsf::GeomAPI_Trsf()
18 : GeomAPI_Interface(new gp_Trsf())
19 {
20 }
21
22 //=================================================================================================
23 GeomAPI_Trsf::GeomAPI_Trsf(void* theTrsf)
24 : GeomAPI_Interface(theTrsf)
25 {
26 }
27
28 //=================================================================================================
29 void GeomAPI_Trsf::setTranslation(const std::shared_ptr<GeomAPI_Ax1> theAxis,
30                                   const double theDistance)
31 {
32   MY_TRSF->SetTranslation(gp_Vec(theAxis->impl<gp_Ax1>().Direction()) * theDistance);
33 }
34
35 //=================================================================================================
36 void GeomAPI_Trsf::setRotation(const std::shared_ptr<GeomAPI_Ax1> theAxis,
37                                const double theAngle)
38 {
39   MY_TRSF->SetRotation(theAxis->impl<gp_Ax1>(), theAngle / 180.0 * M_PI);
40 }