Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-03 09:15:52

0001 // Created on: 1992-09-28
0002 // Created by: Remi GILET
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _GC_MakeEllipse_HeaderFile
0018 #define _GC_MakeEllipse_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <GC_Root.hxx>
0025 #include <Geom_Ellipse.hxx>
0026 
0027 class gp_Elips;
0028 class gp_Ax2;
0029 class gp_Pnt;
0030 
0031 //! Implements construction algorithms for ellipses in 3D space.
0032 //! The result is a `Geom_Ellipse`.
0033 //! A MakeEllipse object provides a framework for:
0034 //! -   defining the construction of the ellipse,
0035 //! -   implementing the construction algorithm, and
0036 //! -   consulting the results. In particular, the Value
0037 //! function returns the constructed ellipse.
0038 class GC_MakeEllipse : public GC_Root
0039 {
0040 public:
0041   DEFINE_STANDARD_ALLOC
0042 
0043   //! Creates an ellipse from a `gp_Elips`.
0044   //! @param[in] theE source ellipse
0045   Standard_EXPORT GC_MakeEllipse(const gp_Elips& theE);
0046 
0047   //! Constructs an ellipse with major and minor radii MajorRadius and
0048   //! MinorRadius, and located in the plane defined by
0049   //! the "X Axis" and "Y Axis" of the coordinate system A2, where:
0050   //! -   its center is the origin of A2, and
0051   //! -   its major axis is the "X Axis" of A2;
0052   //! @note Construction with `theMajorRadius == theMinorRadius` is allowed.
0053   //! @note Construction fails with `gce_NegativeRadius` if `theMinorRadius < 0.0`.
0054   //! @note Construction fails with `gce_InvertAxis` if
0055   //!       `theMajorRadius < theMinorRadius`.
0056   //! @param[in] theA2 ellipse local coordinate system
0057   //! @param[in] theMajorRadius major radius
0058   //! @param[in] theMinorRadius minor radius
0059   Standard_EXPORT GC_MakeEllipse(const gp_Ax2& theA2,
0060                                  const double  theMajorRadius,
0061                                  const double  theMinorRadius);
0062 
0063   //! Constructs an ellipse centered on the point Center, where
0064   //! -   the plane of the ellipse is defined by Center, S1 and S2,
0065   //! -   its major axis is defined by Center and S1,
0066   //! -   its major radius is the distance between Center and S1, and
0067   //! -   its minor radius is the distance between S2 and the major axis.
0068   //! @param[in] theS1 point defining the major axis
0069   //! @param[in] theS2 point defining the minor radius
0070   //! @param[in] theCenter ellipse center
0071   Standard_EXPORT GC_MakeEllipse(const gp_Pnt& theS1, const gp_Pnt& theS2, const gp_Pnt& theCenter);
0072 
0073   //! Returns the constructed ellipse.
0074   //! Exceptions StdFail_NotDone if no ellipse is constructed.
0075   //! @return resulting ellipse
0076   Standard_EXPORT const occ::handle<Geom_Ellipse>& Value() const;
0077 
0078   //! Conversion operator returning the constructed object.
0079   //! @return resulting object
0080   operator const occ::handle<Geom_Ellipse>&() const { return Value(); }
0081 
0082 private:
0083   occ::handle<Geom_Ellipse> TheEllipse;
0084 };
0085 
0086 #endif // _GC_MakeEllipse_HeaderFile