]> SALOME platform Git repositories - modules/shaper.git/blob - src/GeomAPI/GeomAPI_Trsf.cpp
Salome HOME
Merge branch 'master' into cgt/devCEA
[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_GTrsf.hxx>
17 #include <gp_Trsf.hxx>
18
19 #define MY_TRSF implPtr<gp_Trsf>()
20
21 #include <iostream>
22
23 //=================================================================================================
24 GeomAPI_Trsf::GeomAPI_Trsf()
25 : GeomAPI_Interface(new gp_Trsf())
26 {
27 }
28
29 //=================================================================================================
30 GeomAPI_Trsf::GeomAPI_Trsf(void* theTrsf)
31 : GeomAPI_Interface(theTrsf)
32 {
33 }
34
35 //=================================================================================================
36 void GeomAPI_Trsf::setTranslation(const std::shared_ptr<GeomAPI_Ax1> theAxis,
37                                   const double theDistance)
38 {
39   MY_TRSF->SetTranslation(gp_Vec(theAxis->impl<gp_Ax1>().Direction()) * theDistance);
40 }
41
42 //=================================================================================================
43 void GeomAPI_Trsf::setTranslation(const double theDx, const double theDy, const double theDz)
44 {
45   MY_TRSF->SetTranslation(gp_Vec(theDx, theDy, theDz));
46 }
47
48 //=================================================================================================
49 void GeomAPI_Trsf::setTranslation(const std::shared_ptr<GeomAPI_Pnt> theStartPoint,
50                                   const std::shared_ptr<GeomAPI_Pnt> theEndPoint)
51 {
52   MY_TRSF->SetTranslation(theStartPoint->impl<gp_Pnt>(), theEndPoint->impl<gp_Pnt>());
53 }
54
55 //=================================================================================================
56 void GeomAPI_Trsf::setRotation(const std::shared_ptr<GeomAPI_Ax1> theAxis,
57                                const double theAngle)
58 {
59   MY_TRSF->SetRotation(theAxis->impl<gp_Ax1>(), theAngle / 180.0 * M_PI);
60 }
61
62 //=================================================================================================
63 void GeomAPI_Trsf::setSymmetry(const std::shared_ptr<GeomAPI_Pnt> thePoint)
64 {
65   MY_TRSF->SetMirror(thePoint->impl<gp_Pnt>());
66 }
67
68 //=================================================================================================
69 void GeomAPI_Trsf::setSymmetry(const std::shared_ptr<GeomAPI_Ax1> theAxis)
70 {
71   MY_TRSF->SetMirror(theAxis->impl<gp_Ax1>());
72 }
73
74 //=================================================================================================
75 void GeomAPI_Trsf::setSymmetry(const std::shared_ptr<GeomAPI_Ax2> thePlane)
76 {
77   MY_TRSF->SetMirror(thePlane->impl<gp_Ax2>());
78 }
79
80 //=================================================================================================
81 void GeomAPI_Trsf::setScale(const std::shared_ptr<GeomAPI_Pnt> theCenterPoint,
82                             const double theScaleFactor)
83 {
84   MY_TRSF->SetScale(theCenterPoint->impl<gp_Pnt>(), theScaleFactor);
85 }