]> SALOME platform Git repositories - modules/shaper.git/blob - src/GeomAPI/GeomAPI_Ellipse.cpp
Salome HOME
Task 2.1. Creation of ellipses and arcs of ellipse.
[modules/shaper.git] / src / GeomAPI / GeomAPI_Ellipse.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_Ellipse.cpp
4 // Created:     25 April 2017
5 // Author:      Vitaly Smetannikov
6
7 #include "GeomAPI_Ellipse.h"
8 #include "GeomAPI_Ax2.h"
9 #include "GeomAPI_Pnt.h"
10
11 #include <gp_Elips.hxx>
12
13 #define MY_ELIPS implPtr<gp_Elips>()
14
15 GeomAPI_Ellipse::GeomAPI_Ellipse(const std::shared_ptr<GeomAPI_Ax2>& theAx2,
16                                  double theMajorRadius, double theMinorRadius)
17 : GeomAPI_Interface(new gp_Elips(theAx2->impl<gp_Ax2>(), theMajorRadius, theMinorRadius))
18 {
19 }
20
21 std::shared_ptr<GeomAPI_Pnt> GeomAPI_Ellipse::center() const
22 {
23   const gp_Pnt& aCenter = MY_ELIPS->Location();
24   return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z()));
25 }
26
27 GeomPointPtr GeomAPI_Ellipse::firstFocus() const
28 {
29   const gp_Pnt& aFirst = MY_ELIPS->Focus1();
30   return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aFirst.X(), aFirst.Y(), aFirst.Z()));
31 }
32
33 GeomPointPtr GeomAPI_Ellipse::secondFocus() const
34 {
35   const gp_Pnt& aSecond = MY_ELIPS->Focus2();
36   return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aSecond.X(), aSecond.Y(), aSecond.Z()));
37 }
38
39 double GeomAPI_Ellipse::minorRadius() const
40 {
41   return MY_ELIPS->MinorRadius();
42 }
43
44 double GeomAPI_Ellipse::majorRadius() const
45 {
46   return MY_ELIPS->MajorRadius();
47 }