Salome HOME
Adding the "Symmetry" feature.
[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 #include <GeomAPI_Ax2.h>
13
14 #include <gp_Ax1.hxx>
15 #include <gp_Ax2.hxx>
16 #include <gp_Trsf.hxx>
17
18 #define MY_TRSF implPtr<gp_Trsf>()
19
20 //=================================================================================================
21 GeomAPI_Trsf::GeomAPI_Trsf()
22 : GeomAPI_Interface(new gp_Trsf())
23 {
24 }
25
26 //=================================================================================================
27 GeomAPI_Trsf::GeomAPI_Trsf(void* theTrsf)
28 : GeomAPI_Interface(theTrsf)
29 {
30 }
31
32 //=================================================================================================
33 void GeomAPI_Trsf::setTranslation(const std::shared_ptr<GeomAPI_Ax1> theAxis,
34                                   const double theDistance)
35 {
36   MY_TRSF->SetTranslation(gp_Vec(theAxis->impl<gp_Ax1>().Direction()) * theDistance);
37 }
38
39 //=================================================================================================
40 void GeomAPI_Trsf::setTranslation(const double theDx, const double theDy, const double theDz)
41 {
42   MY_TRSF->SetTranslation(gp_Vec(theDx, theDy, theDz));
43 }
44
45 //=================================================================================================
46 void GeomAPI_Trsf::setTranslation(const std::shared_ptr<GeomAPI_Pnt> theStartPoint,
47                                   const std::shared_ptr<GeomAPI_Pnt> theEndPoint)
48 {
49   MY_TRSF->SetTranslation(theStartPoint->impl<gp_Pnt>(), theEndPoint->impl<gp_Pnt>());
50 }
51
52 //=================================================================================================
53 void GeomAPI_Trsf::setRotation(const std::shared_ptr<GeomAPI_Ax1> theAxis,
54                                const double theAngle)
55 {
56   MY_TRSF->SetRotation(theAxis->impl<gp_Ax1>(), theAngle / 180.0 * M_PI);
57 }
58
59 //=================================================================================================
60 void GeomAPI_Trsf::setSymmetry(const std::shared_ptr<GeomAPI_Pnt> thePoint)
61 {
62   MY_TRSF->SetMirror(thePoint->impl<gp_Pnt>());
63 }
64
65 //=================================================================================================
66 void GeomAPI_Trsf::setSymmetry(const std::shared_ptr<GeomAPI_Ax1> theAxis)
67 {
68   MY_TRSF->SetMirror(theAxis->impl<gp_Ax1>());
69 }
70
71 //=================================================================================================
72 void GeomAPI_Trsf::setSymmetry(const std::shared_ptr<GeomAPI_Ax2> thePlane)
73 {
74   MY_TRSF->SetMirror(thePlane->impl<gp_Ax2>());
75 }