Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1993-03-10
0002 // Created by: JCV
0003 // Copyright (c) 1993-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 _Geom_Ellipse_HeaderFile
0018 #define _Geom_Ellipse_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Geom_Conic.hxx>
0024 #include <Standard_Integer.hxx>
0025 class gp_Elips;
0026 class gp_Ax2;
0027 class gp_Ax1;
0028 class gp_Pnt;
0029 class gp_Vec;
0030 class gp_Trsf;
0031 class Geom_Geometry;
0032 
0033 
0034 class Geom_Ellipse;
0035 DEFINE_STANDARD_HANDLE(Geom_Ellipse, Geom_Conic)
0036 
0037 //! Describes an ellipse in 3D space.
0038 //! An ellipse is defined by its major and minor radii and,
0039 //! as with any conic curve, is positioned in space with a
0040 //! right-handed coordinate system (gp_Ax2 object) where:
0041 //! - the origin is the center of the ellipse,
0042 //! - the "X Direction" defines the major axis, and
0043 //! - the "Y Direction" defines the minor axis.
0044 //! The origin, "X Direction" and "Y Direction" of this
0045 //! coordinate system define the plane of the ellipse. The
0046 //! coordinate system is the local coordinate system of the ellipse.
0047 //! The "main Direction" of this coordinate system is the
0048 //! vector normal to the plane of the ellipse. The axis, of
0049 //! which the origin and unit vector are respectively the
0050 //! origin and "main Direction" of the local coordinate
0051 //! system, is termed the "Axis" or "main Axis" of the ellipse.
0052 //! The "main Direction" of the local coordinate system
0053 //! gives an explicit orientation to the ellipse (definition of
0054 //! the trigonometric sense), determining the direction in
0055 //! which the parameter increases along the ellipse.
0056 //! The Geom_Ellipse ellipse is parameterized by an angle:
0057 //! P(U) = O + MajorRad*Cos(U)*XDir + MinorRad*Sin(U)*YDir
0058 //! where:
0059 //! - P is the point of parameter U,
0060 //! - O, XDir and YDir are respectively the origin, "X
0061 //! Direction" and "Y Direction" of its local coordinate system,
0062 //! - MajorRad and MinorRad are the major and minor radii of the ellipse.
0063 //! The "X Axis" of the local coordinate system therefore
0064 //! defines the origin of the parameter of the ellipse.
0065 //! An ellipse is a closed and periodic curve. The period
0066 //! is 2.*Pi and the parameter range is [ 0, 2.*Pi [.
0067 class Geom_Ellipse : public Geom_Conic
0068 {
0069 
0070 public:
0071 
0072   
0073   //! Constructs an ellipse by conversion of the gp_Elips ellipse E.
0074   Standard_EXPORT Geom_Ellipse(const gp_Elips& E);
0075   
0076   //! Constructs an ellipse
0077   //! defined by its major and minor radii, MajorRadius
0078   //! and MinorRadius, where A2 locates the ellipse
0079   //! and defines its orientation in 3D space such that:
0080   //! - the center of the ellipse is the origin of A2,
0081   //! - the "X Direction" of A2 defines the major axis
0082   //! of the ellipse, i.e. the major radius
0083   //! MajorRadius is measured along this axis,
0084   //! - the "Y Direction" of A2 defines the minor axis
0085   //! of the ellipse, i.e. the minor radius
0086   //! MinorRadius is measured along this axis,
0087   //! - A2 is the local coordinate system of the ellipse.
0088   //! Exceptions
0089   //! Standard_ConstructionError if:
0090   //! - MajorRadius is less than MinorRadius, or
0091   //! - MinorRadius is less than 0.
0092   //! Warning The Geom package does not prevent the
0093   //! construction of an ellipse where MajorRadius and
0094   //! MinorRadius are equal.
0095   Standard_EXPORT Geom_Ellipse(const gp_Ax2& A2, const Standard_Real MajorRadius, const Standard_Real MinorRadius);
0096   
0097   //! Converts the gp_Elips ellipse E into this ellipse.
0098   Standard_EXPORT void SetElips (const gp_Elips& E);
0099   
0100   //! Assigns a value to the major radius of this ellipse.
0101   //! ConstructionError raised if MajorRadius < MinorRadius.
0102   Standard_EXPORT void SetMajorRadius (const Standard_Real MajorRadius);
0103   
0104   //! Assigns a value to the minor radius of this ellipse.
0105   //! ConstructionError raised if MajorRadius < MinorRadius or if MinorRadius < 0.
0106   Standard_EXPORT void SetMinorRadius (const Standard_Real MinorRadius);
0107   
0108 
0109   //! returns the non transient ellipse from gp with the same
0110   Standard_EXPORT gp_Elips Elips() const;
0111   
0112   //! Computes the parameter on the reversed ellipse for
0113   //! the point of parameter U on this ellipse.
0114   //! For an ellipse, the returned value is: 2.*Pi - U.
0115   Standard_EXPORT Standard_Real ReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
0116   
0117 
0118   //! This directrix is the line normal to the XAxis of the ellipse
0119   //! in the local plane (Z = 0) at a distance d = MajorRadius / e
0120   //! from the center of the ellipse, where e is the eccentricity of
0121   //! the ellipse.
0122   //! This line is parallel to the "YAxis". The intersection point
0123   //! between directrix1 and the "XAxis" is the "Location" point
0124   //! of the directrix1. This point is on the positive side of
0125   //! the "XAxis".
0126   //! Raised if Eccentricity = 0.0. (The ellipse degenerates
0127   //! into a circle)
0128   Standard_EXPORT gp_Ax1 Directrix1() const;
0129   
0130 
0131   //! This line is obtained by the symmetrical transformation
0132   //! of "Directrix1" with respect to the "YAxis" of the ellipse.
0133   //!
0134   //! Raised if Eccentricity = 0.0. (The ellipse degenerates into a
0135   //! circle).
0136   Standard_EXPORT gp_Ax1 Directrix2() const;
0137   
0138 
0139   //! Returns the eccentricity of the ellipse  between 0.0 and 1.0
0140   //! If f is the distance between the center of the ellipse and
0141   //! the Focus1 then the eccentricity e = f / MajorRadius.
0142   //! Returns 0 if MajorRadius = 0
0143   Standard_EXPORT Standard_Real Eccentricity() const Standard_OVERRIDE;
0144   
0145 
0146   //! Computes the focal distance. It is the distance between the
0147   //! the two focus of the ellipse.
0148   Standard_EXPORT Standard_Real Focal() const;
0149   
0150 
0151   //! Returns the first focus of the ellipse. This focus is on the
0152   //! positive side of the "XAxis" of the ellipse.
0153   Standard_EXPORT gp_Pnt Focus1() const;
0154   
0155 
0156   //! Returns the second focus of the ellipse. This focus is on
0157   //! the negative side of the "XAxis" of the ellipse.
0158   Standard_EXPORT gp_Pnt Focus2() const;
0159   
0160   //! Returns the major  radius of this ellipse.
0161   Standard_EXPORT Standard_Real MajorRadius() const;
0162   
0163   //! Returns the minor radius of this ellipse.
0164   Standard_EXPORT Standard_Real MinorRadius() const;
0165   
0166 
0167   //! Returns p = (1 - e * e) * MajorRadius where e is the eccentricity
0168   //! of the ellipse.
0169   //! Returns 0 if MajorRadius = 0
0170   Standard_EXPORT Standard_Real Parameter() const;
0171   
0172   //! Returns the value of the first parameter of this
0173   //! ellipse. This is respectively:
0174   //! - 0.0, which gives the start point of this ellipse, or
0175   //! The start point and end point of an ellipse are coincident.
0176   Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
0177   
0178   //! Returns the value of the  last parameter of this
0179   //! ellipse. This is respectively:
0180   //! - 2.*Pi, which gives the end point of this ellipse.
0181   //! The start point and end point of an ellipse are coincident.
0182   Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
0183   
0184   //! return True.
0185   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
0186   
0187   //! return True.
0188   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
0189   
0190   //! Returns in P the point of parameter U.
0191   //! P = C + MajorRadius * Cos (U) * XDir + MinorRadius * Sin (U) * YDir
0192   //! where C is the center of the ellipse , XDir the direction of
0193   //! the "XAxis" and "YDir" the "YAxis" of the ellipse.
0194   Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE;
0195   
0196   Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1) const Standard_OVERRIDE;
0197   
0198 
0199   //! Returns the point P of parameter U. The vectors V1 and V2
0200   //! are the first and second derivatives at this point.
0201   Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const Standard_OVERRIDE;
0202   
0203 
0204   //! Returns the point P of parameter U, the first second and
0205   //! third derivatives V1 V2 and V3.
0206   Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const Standard_OVERRIDE;
0207   
0208   //! For the point of parameter U of this ellipse, computes
0209   //! the vector corresponding to the Nth derivative.
0210   //! Exceptions Standard_RangeError if N is less than 1.
0211   Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
0212   
0213   //! Applies the transformation T to this ellipse.
0214   Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
0215   
0216   //! Creates a new object which is a copy of this ellipse.
0217   Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
0218 
0219   //! Dumps the content of me into the stream
0220   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0221 
0222 
0223 
0224 
0225   DEFINE_STANDARD_RTTIEXT(Geom_Ellipse,Geom_Conic)
0226 
0227 protected:
0228 
0229 
0230 
0231 
0232 private:
0233 
0234 
0235   Standard_Real majorRadius;
0236   Standard_Real minorRadius;
0237 
0238 
0239 };
0240 
0241 
0242 
0243 
0244 
0245 
0246 
0247 #endif // _Geom_Ellipse_HeaderFile