Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:17:08

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_MakeEllipse2d_HeaderFile
0018 #define _GC_MakeEllipse2d_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <GC_Root.hxx>
0025 #include <Geom2d_Ellipse.hxx>
0026 
0027 class gp_Elips2d;
0028 class gp_Ax2d;
0029 class gp_Ax22d;
0030 class gp_Pnt2d;
0031 
0032 //! This class implements construction algorithms for ellipses in the plane.
0033 //! The result is a `Geom2d_Ellipse`.
0034 //! A `GC_MakeEllipse2d` object provides a framework for:
0035 //! - defining the construction parameters;
0036 //! - running the construction algorithm;
0037 //! - querying the construction status and the resulting ellipse via `Value()`.
0038 //! @note Ellipse parameterization range is [0, 2*PI].
0039 //! @note The X axis of the local coordinate system is the major axis,
0040 //!       and the Y axis is the minor axis.
0041 class GC_MakeEllipse2d : public GC_Root
0042 {
0043 public:
0044   DEFINE_STANDARD_ALLOC
0045 
0046   //! Creates an ellipse from a non-persistent one from package gp.
0047   //! @param[in] theEllipse source ellipse
0048   Standard_EXPORT GC_MakeEllipse2d(const gp_Elips2d& theEllipse);
0049 
0050   //! Creates an ellipse from major axis placement and radii.
0051   //! @param[in] theMajorAxis major axis placement
0052   //! @param[in] theMajorRadius major radius value
0053   //! @param[in] theMinorRadius minor radius value
0054   //! @param[in] theSense orientation flag
0055   //! @note Error status is provided by the underlying `gce_MakeElips2d`
0056   //!       (for example `gce_InvertRadius` or `gce_NegativeRadius`).
0057   Standard_EXPORT GC_MakeEllipse2d(const gp_Ax2d& theMajorAxis,
0058                                    const double   theMajorRadius,
0059                                    const double   theMinorRadius,
0060                                    const bool     theSense = true);
0061 
0062   //! Creates an ellipse from a local coordinate system and radii.
0063   //! @param[in] theAxis local coordinate system
0064   //! @param[in] theMajorRadius major radius value
0065   //! @param[in] theMinorRadius minor radius value
0066   //! @note Error status is provided by the underlying `gce_MakeElips2d`
0067   //!       (for example `gce_InvertRadius` or `gce_NegativeRadius`).
0068   Standard_EXPORT GC_MakeEllipse2d(const gp_Ax22d& theAxis,
0069                                    const double    theMajorRadius,
0070                                    const double    theMinorRadius);
0071 
0072   //! Creates an ellipse from two apex points and center point.
0073   //! @param[in] theS1 first apex point
0074   //! @param[in] theS2 second point defining minor radius
0075   //! @param[in] theCenter center point
0076   //! @note Error status is provided by the underlying `gce_MakeElips2d`.
0077   Standard_EXPORT GC_MakeEllipse2d(const gp_Pnt2d& theS1,
0078                                    const gp_Pnt2d& theS2,
0079                                    const gp_Pnt2d& theCenter);
0080 
0081   //! Returns the constructed ellipse.
0082   //! Exceptions StdFail_NotDone if no ellipse is constructed.
0083   //! @return resulting ellipse
0084   Standard_EXPORT const occ::handle<Geom2d_Ellipse>& Value() const;
0085 
0086   //! Conversion operator returning the constructed object.
0087   //! @return resulting ellipse
0088   operator const occ::handle<Geom2d_Ellipse>&() const { return Value(); }
0089 
0090 private:
0091   occ::handle<Geom2d_Ellipse> TheEllipse;
0092 };
0093 
0094 #endif // _GC_MakeEllipse2d_HeaderFile