1 // Created on: 1992-09-28
2 // Created by: Remi GILET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _GCE2d_MakeEllipse_HeaderFile
18 #define _GCE2d_MakeEllipse_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <GCE2d_Root.hxx>
25 #include <Geom2d_Ellipse.hxx>
27 class StdFail_NotDone;
34 //! This class implements the following algorithms used to
35 //! create Ellipse from Geom2d.
36 //! * Create an Ellipse from two apex and the center.
37 //! Defines an ellipse in 2D space.
38 //! The parametrization range is [0,2*PI].
39 //! The ellipse is a closed and periodic curve.
40 //! The center of the ellipse is the "Location" point of its
41 //! axis placement "XAxis".
42 //! The "XAxis" of the ellipse defines the origin of the
43 //! parametrization, it is the major axis of the ellipse.
44 //! The YAxis is the minor axis of the ellipse.
45 class GCE2d_MakeEllipse : public GCE2d_Root
53 //! Creates an ellipse from a non persistent one from package gp
54 Standard_EXPORT GCE2d_MakeEllipse(const gp_Elips2d& E);
57 //! MajorAxis is the local coordinate system of the ellipse.
58 //! It is the "XAxis". The minor axis is the YAxis of the
60 //! Sense give the sense of parametrization of the Ellipse.
61 //! It is not forbidden to create an ellipse with MajorRadius =
63 //! The status is "InvertRadius" if MajorRadius < MinorRadius or
64 //! "NegativeRadius" if MinorRadius < 0.
65 Standard_EXPORT GCE2d_MakeEllipse(const gp_Ax2d& MajorAxis, const Standard_Real MajorRadius, const Standard_Real MinorRadius, const Standard_Boolean Sense = Standard_True);
68 //! Axis is the local coordinate system of the ellipse.
69 //! It is not forbidden to create an ellipse with MajorRadius =
71 //! The status is "InvertRadius" if MajorRadius < MinorRadius or
72 //! "NegativeRadius" if MinorRadius < 0.
73 Standard_EXPORT GCE2d_MakeEllipse(const gp_Ax22d& Axis, const Standard_Real MajorRadius, const Standard_Real MinorRadius);
75 //! Make an Ellipse centered on the point Center, where
76 //! - the major axis of the ellipse is defined by Center and S1,
77 //! - its major radius is the distance between Center and S1, and
78 //! - its minor radius is the distance between S2 and the major axis.
79 //! The implicit orientation of the ellipse is:
80 //! - the sense defined by Axis or E,
81 //! - the sense defined by points Center, S1 and S2,
82 //! - the trigonometric sense if Sense is not given or is true, or
83 //! - the opposite sense if Sense is false.
84 Standard_EXPORT GCE2d_MakeEllipse(const gp_Pnt2d& S1, const gp_Pnt2d& S2, const gp_Pnt2d& Center);
86 //! Returns the constructed ellipse.
87 //! Exceptions StdFail_NotDone if no ellipse is constructed.
88 Standard_EXPORT const Handle(Geom2d_Ellipse)& Value() const;
90 operator const Handle(Geom2d_Ellipse)& () const { return Value(); }
93 Handle(Geom2d_Ellipse) TheEllipse;
96 #endif // _GCE2d_MakeEllipse_HeaderFile