1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAPI_Ax1.cpp
4 // Created: 12 May 2015
5 // Author: Dmitry Bobylev
7 #include <GeomAPI_Ax1.h>
11 #define MY_AX1 implPtr<gp_Ax1>()
13 //=================================================================================================
14 GeomAPI_Ax1::GeomAPI_Ax1()
15 : GeomAPI_Interface(new gp_Ax1())
19 //=================================================================================================
20 GeomAPI_Ax1::GeomAPI_Ax1(std::shared_ptr<GeomAPI_Pnt> theOrigin,
21 std::shared_ptr<GeomAPI_Dir> theDir)
22 : GeomAPI_Interface(new gp_Ax1(theOrigin->impl<gp_Pnt>(),
23 theDir->impl<gp_Dir>()))
27 //=================================================================================================
28 void GeomAPI_Ax1::setOrigin(const std::shared_ptr<GeomAPI_Pnt>& theOrigin)
30 MY_AX1->SetLocation(theOrigin->impl<gp_Pnt>());
33 //=================================================================================================
34 std::shared_ptr<GeomAPI_Pnt> GeomAPI_Ax1::origin() const
36 gp_Pnt aPnt = MY_AX1->Location();
37 return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPnt.X(),aPnt.Y(),aPnt.Z()));
40 //=================================================================================================
41 void GeomAPI_Ax1::setDir(const std::shared_ptr<GeomAPI_Dir>& theDir)
43 MY_AX1->SetDirection(theDir->impl<gp_Dir>());
46 //=================================================================================================
47 std::shared_ptr<GeomAPI_Dir> GeomAPI_Ax1::dir() const
49 gp_Dir aDir = MY_AX1->Direction();
50 return std::shared_ptr<GeomAPI_Dir>(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
53 //=================================================================================================
54 void GeomAPI_Ax1::reverse()
59 //=================================================================================================
60 std::shared_ptr<GeomAPI_Ax1> GeomAPI_Ax1::reversed()
62 gp_Ax1 anAxis = MY_AX1->Reversed();
63 std::shared_ptr<GeomAPI_Pnt> aPnt(
64 new GeomAPI_Pnt(anAxis.Location().X(), anAxis.Location().Y(), anAxis.Location().Z()));
65 std::shared_ptr<GeomAPI_Dir> aDir(
66 new GeomAPI_Dir(anAxis.Direction().X(), anAxis.Direction().Y(), anAxis.Direction().Z()));
67 return std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(aPnt, aDir));