Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-06 08:46:13

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 //! This class implements construction algorithms for an ellipse in
0032 //! 3D space. The result is a Geom_Ellipse 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 non persistent ellipse E from package gp by its conversion.
0044   Standard_EXPORT GC_MakeEllipse(const gp_Elips& E);
0045 
0046   //! Constructs an ellipse with major and minor radii MajorRadius and
0047   //! MinorRadius, and located in the plane defined by
0048   //! the "X Axis" and "Y Axis" of the coordinate system A2, where:
0049   //! -   its center is the origin of A2, and
0050   //! -   its major axis is the "X Axis" of A2;
0051   //! Warnings :
0052   //! The MakeEllipse class does not prevent the
0053   //! construction of an ellipse where MajorRadius is equal to MinorRadius.
0054   //! If an error occurs (that is, when IsDone returns
0055   //! false), the Status function returns:
0056   //! -   gce_InvertRadius if MajorRadius is less than MinorRadius;
0057   //! -   gce_NegativeRadius if MinorRadius is less than 0.0;
0058   //! -   gce_NullAxis if the points S1 and Center are coincident; or
0059   //! -   gce_InvertAxis if:
0060   //! -   the major radius computed with Center and S1
0061   //! is less than the minor radius computed with Center, S1 and S2, or
0062   //! -   Center, S1 and S2 are collinear.
0063   Standard_EXPORT GC_MakeEllipse(const gp_Ax2&       A2,
0064                                  const Standard_Real MajorRadius,
0065                                  const Standard_Real MinorRadius);
0066 
0067   //! Constructs an ellipse centered on the point Center, where
0068   //! -   the plane of the ellipse is defined by Center, S1 and S2,
0069   //! -   its major axis is defined by Center and S1,
0070   //! -   its major radius is the distance between Center and S1, and
0071   //! -   its minor radius is the distance between S2 and the major axis.
0072   Standard_EXPORT GC_MakeEllipse(const gp_Pnt& S1, const gp_Pnt& S2, const gp_Pnt& Center);
0073 
0074   //! Returns the constructed ellipse.
0075   //! Exceptions StdFail_NotDone if no ellipse is constructed.
0076   Standard_EXPORT const Handle(Geom_Ellipse)& Value() const;
0077 
0078   operator const Handle(Geom_Ellipse) & () const { return Value(); }
0079 
0080 private:
0081   Handle(Geom_Ellipse) TheEllipse;
0082 };
0083 
0084 #endif // _GC_MakeEllipse_HeaderFile