Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-11 08:21:46

0001 // Created on: 1993-01-09
0002 // Created by: CKY / Contract Toubro-Larsen (Kiran)
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 _IGESGeom_ConicArc_HeaderFile
0018 #define _IGESGeom_ConicArc_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <gp_XY.hxx>
0024 #include <IGESData_IGESEntity.hxx>
0025 #include <Standard_Integer.hxx>
0026 class gp_Pnt2d;
0027 class gp_Pnt;
0028 class gp_Dir;
0029 
0030 class IGESGeom_ConicArc;
0031 DEFINE_STANDARD_HANDLE(IGESGeom_ConicArc, IGESData_IGESEntity)
0032 
0033 //! defines IGESConicArc, Type <104> Form <0-3>  in package IGESGeom
0034 //! A conic arc is a bounded connected portion of a parent
0035 //! conic curve which consists of more than one point. The
0036 //! parent conic curve is either an ellipse, a parabola, or
0037 //! a hyperbola. The definition space coordinate system is
0038 //! always chosen so that the conic arc lies in a plane either
0039 //! coincident with or parallel to XT, YT plane. Within such
0040 //! a plane a conic is defined by the six coefficients in the
0041 //! following equation.
0042 //! A*XT^2 + B*XT*YT + C*YT^2 + D*XT + E*YT + F = 0
0043 class IGESGeom_ConicArc : public IGESData_IGESEntity
0044 {
0045 
0046 public:
0047   Standard_EXPORT IGESGeom_ConicArc();
0048 
0049   //! This method is used to set the fields of the class
0050   //! ConicalArc
0051   //! - A, B, C, D, E, F : Coefficients of the equation
0052   //! defining conic arc
0053   //! - ZT               : Parallel ZT displacement of the arc
0054   //! from XT, YT plane.
0055   //! - aStart           : Starting point of the conic arc
0056   //! - anEnd            : End point of the conic arc
0057   Standard_EXPORT void Init(const Standard_Real A,
0058                             const Standard_Real B,
0059                             const Standard_Real C,
0060                             const Standard_Real D,
0061                             const Standard_Real E,
0062                             const Standard_Real F,
0063                             const Standard_Real ZT,
0064                             const gp_XY&        aStart,
0065                             const gp_XY&        anEnd);
0066 
0067   //! sets the Form Number equal to ComputedFormNumber,
0068   //! returns True if changed
0069   Standard_EXPORT Standard_Boolean OwnCorrect();
0070 
0071   //! Computes the Form Number according to the equation
0072   //! 1 for Ellipse, 2 for Hyperbola, 3 for Parabola
0073   Standard_EXPORT Standard_Integer ComputedFormNumber() const;
0074 
0075   Standard_EXPORT void Equation(Standard_Real& A,
0076                                 Standard_Real& B,
0077                                 Standard_Real& C,
0078                                 Standard_Real& D,
0079                                 Standard_Real& E,
0080                                 Standard_Real& F) const;
0081 
0082   //! returns the Z displacement of the arc from XT, YT plane
0083   Standard_EXPORT Standard_Real ZPlane() const;
0084 
0085   //! returns the starting point of the arc
0086   Standard_EXPORT gp_Pnt2d StartPoint() const;
0087 
0088   //! returns the starting point of the arc after applying
0089   //! Transf. Matrix
0090   Standard_EXPORT gp_Pnt TransformedStartPoint() const;
0091 
0092   //! returns the end point of the arc
0093   Standard_EXPORT gp_Pnt2d EndPoint() const;
0094 
0095   //! returns the end point of the arc after applying
0096   //! Transf. Matrix
0097   Standard_EXPORT gp_Pnt TransformedEndPoint() const;
0098 
0099   //! returns True if parent conic curve is an ellipse
0100   Standard_EXPORT Standard_Boolean IsFromEllipse() const;
0101 
0102   //! returns True if parent conic curve is a parabola
0103   Standard_EXPORT Standard_Boolean IsFromParabola() const;
0104 
0105   //! returns True if parent conic curve is a hyperbola
0106   Standard_EXPORT Standard_Boolean IsFromHyperbola() const;
0107 
0108   //! returns True if StartPoint = EndPoint
0109   Standard_EXPORT Standard_Boolean IsClosed() const;
0110 
0111   //! Z-Axis of conic (i.e. [0,0,1])
0112   Standard_EXPORT gp_Dir Axis() const;
0113 
0114   //! Z-Axis after applying Trans. Matrix
0115   Standard_EXPORT gp_Dir TransformedAxis() const;
0116 
0117   //! Returns a Definition computed from equation, easier to use
0118   //! <Center> : the center of the conic (meaningless for
0119   //! a parabola) (defined with Z displacement)
0120   //! <MainAxis> : the Main Axis of the conic (for a Circle,
0121   //! arbitrary the X Axis)
0122   //! <Rmin,Rmax> : Minor and Major Radii of the conic
0123   //! For a Circle, Rmin = Rmax,
0124   //! For a Parabola, Rmin = Rmax = the Focal
0125   //! Warning : the basic definition (by equation) is not very stable,
0126   //! limit cases may be approximative
0127   Standard_EXPORT void Definition(gp_Pnt&        Center,
0128                                   gp_Dir&        MainAxis,
0129                                   Standard_Real& rmin,
0130                                   Standard_Real& rmax) const;
0131 
0132   //! Same as Definition, but the Location is applied on the
0133   //! Center and the MainAxis
0134   Standard_EXPORT void TransformedDefinition(gp_Pnt&        Center,
0135                                              gp_Dir&        MainAxis,
0136                                              Standard_Real& rmin,
0137                                              Standard_Real& rmax) const;
0138 
0139   //! Computes and returns the coordinates of the definition of
0140   //! a comic from its equation. Used by Definition &
0141   //! TransformedDefinition, or may be called directly if needed
0142   Standard_EXPORT void ComputedDefinition(Standard_Real& Xcen,
0143                                           Standard_Real& Ycen,
0144                                           Standard_Real& Xax,
0145                                           Standard_Real& Yax,
0146                                           Standard_Real& Rmin,
0147                                           Standard_Real& Rmax) const;
0148 
0149   DEFINE_STANDARD_RTTIEXT(IGESGeom_ConicArc, IGESData_IGESEntity)
0150 
0151 protected:
0152 private:
0153   Standard_Real theA;
0154   Standard_Real theB;
0155   Standard_Real theC;
0156   Standard_Real theD;
0157   Standard_Real theE;
0158   Standard_Real theF;
0159   Standard_Real theZT;
0160   gp_XY         theStart;
0161   gp_XY         theEnd;
0162 };
0163 
0164 #endif // _IGESGeom_ConicArc_HeaderFile