Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:20:13

0001 // Created on: 1992-08-26
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 _gce_MakeElips2d_HeaderFile
0018 #define _gce_MakeElips2d_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <gp_Elips2d.hxx>
0025 #include <gce_Root.hxx>
0026 class gp_Ax2d;
0027 class gp_Ax22d;
0028 class gp_Pnt2d;
0029 
0030 //! This class implements construction algorithms for `gp_Elips2d`.
0031 //! Supported constructions include:
0032 //! - ellipse from major axis (or local 2D coordinate system) and radii;
0033 //! - ellipse from center and two points.
0034 class gce_MakeElips2d : public gce_Root
0035 {
0036 public:
0037   DEFINE_STANDARD_ALLOC
0038 
0039   //! Creates an ellipse with the major axis, the major and the
0040   //! minor radius. The location of the MajorAxis is the center
0041   //! of the ellipse.
0042   //! The sense of parametrization is given by Sense.
0043   //! It is possible to create an ellipse with MajorRadius = MinorRadius.
0044   //! @note Construction fails with `gce_InvertRadius` if
0045   //!       `MajorRadius < MinorRadius`.
0046   //! @note Construction fails with `gce_NegativeRadius` if
0047   //!       `MajorRadius < 0.0`.
0048   //! @param[in] MajorAxis major axis placement
0049   //! @param[in] MajorRadius major radius value
0050   //! @param[in] MinorRadius minor radius value
0051   //! @param[in] Sense orientation flag
0052   Standard_EXPORT gce_MakeElips2d(const gp_Ax2d& MajorAxis,
0053                                   const double   MajorRadius,
0054                                   const double   MinorRadius,
0055                                   const bool     Sense = true);
0056 
0057   //! Axis defines the Xaxis and Yaxis of the ellipse which defines
0058   //! the origin and the sense of parametrization.
0059   //! Creates an ellipse with the AxisPlacement the major and the
0060   //! minor radius. The location of Axis is the center
0061   //! of the ellipse.
0062   //! It is possible to create an ellipse with MajorRadius = MinorRadius.
0063   //! @note Construction fails with `gce_InvertRadius` if
0064   //!       `MajorRadius < MinorRadius`.
0065   //! @note Construction fails with `gce_NegativeRadius` if
0066   //!       `MajorRadius < 0.0`.
0067   //! @param[in] A local coordinate system
0068   //! @param[in] MajorRadius major radius value
0069   //! @param[in] MinorRadius minor radius value
0070   Standard_EXPORT gce_MakeElips2d(const gp_Ax22d& A,
0071                                   const double    MajorRadius,
0072                                   const double    MinorRadius);
0073 
0074   //! Creates an ellipse from center and two points.
0075   //! @note `S1` defines major radius direction and value.
0076   //! @note Minor radius is computed as distance from `S2` to major axis.
0077   //! @note Construction fails with `gce_NullAxis` when computed minor radius
0078   //!       is null.
0079   //! @note Construction fails with `gce_InvertAxis` when computed minor radius
0080   //!       exceeds major radius.
0081   //! @param[in] S1 first point
0082   //! @param[in] S2 second point
0083   //! @param[in] Center center point
0084   Standard_EXPORT gce_MakeElips2d(const gp_Pnt2d& S1, const gp_Pnt2d& S2, const gp_Pnt2d& Center);
0085 
0086   //! Returns the constructed ellipse.
0087   //! Exceptions StdFail_NotDone if no ellipse is constructed.
0088   //! @return resulting ellipse
0089   Standard_EXPORT const gp_Elips2d& Value() const;
0090 
0091   //! Alias for Value() returning a copy.
0092   //! @return resulting object
0093   gp_Elips2d Operator() const { return Value(); }
0094 
0095   //! Conversion operator returning the constructed object.
0096   //! @return resulting object
0097   operator gp_Elips2d() const { return Operator(); }
0098 
0099 private:
0100   gp_Elips2d TheElips2d;
0101 };
0102 
0103 #endif // _gce_MakeElips2d_HeaderFile