1 // Created on: 1992-08-26
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 _gce_MakeElips_HeaderFile
18 #define _gce_MakeElips_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <gp_Elips.hxx>
25 #include <gce_Root.hxx>
26 #include <Standard_Real.hxx>
27 class StdFail_NotDone;
33 //! This class implements the following algorithms used to
34 //! create an ellipse from gp.
36 //! * Create an ellipse from its center, and two points:
37 //! one on the ciconference giving the major radius, the
38 //! other giving the value of the small radius.
39 class gce_MakeElips : public gce_Root
46 //! The major radius of the ellipse is on the "XAxis" and the
47 //! minor radius is on the "YAxis" of the ellipse. The "XAxis"
48 //! is defined with the "XDirection" of A2 and the "YAxis" is
49 //! defined with the "YDirection" of A2.
51 //! It is not forbidden to create an ellipse with
52 //! MajorRadius = MinorRadius.
53 Standard_EXPORT gce_MakeElips(const gp_Ax2& A2, const Standard_Real MajorRadius, const Standard_Real MinorRadius);
55 //! Make an ellipse with its center and two points.
57 //! The MakeElips class does not prevent the
58 //! construction of an ellipse where the MajorRadius is
59 //! equal to the MinorRadius.
60 //! If an error occurs (that is, when IsDone returns
61 //! false), the Status function returns:
62 //! - gce_InvertRadius if MajorRadius is less than MinorRadius;
63 //! - gce_NegativeRadius if MinorRadius is less than 0.0;
64 //! - gce_NullAxis if the points S1 and Center are coincident; or
65 //! - gce_InvertAxis if:
66 //! - the major radius computed with Center and S1
67 //! is less than the minor radius computed with Center, S1 and S2, or
68 //! - Center, S1 and S2 are collinear.
69 Standard_EXPORT gce_MakeElips(const gp_Pnt& S1, const gp_Pnt& S2, const gp_Pnt& Center);
71 //! Returns the constructed ellipse.
72 //! Exceptions StdFail_NotDone if no ellipse is constructed.
73 Standard_EXPORT const gp_Elips& Value() const;
75 Standard_EXPORT const gp_Elips& Operator() const;
76 Standard_EXPORT operator gp_Elips() const;
102 #endif // _gce_MakeElips_HeaderFile