Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:31

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