Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:17:04

0001 // Created on: 1991-09-03
0002 // Created by: Laurent PAINNOT
0003 // Copyright (c) 1991-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 _math_TrigonometricFunctionRoots_HeaderFile
0018 #define _math_TrigonometricFunctionRoots_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <NCollection_Array1.hxx>
0025 #include <Standard_Boolean.hxx>
0026 #include <Standard_OStream.hxx>
0027 
0028 //! This class implements the solutions of the equation
0029 //! a*std::cos(x)*std::cos(x) + 2*b*std::cos(x)*Sin(x) + c*std::cos(x) + d*Sin(x) + e
0030 //! The degree of this equation can be 4, 3 or 2.
0031 class math_TrigonometricFunctionRoots
0032 {
0033 public:
0034   DEFINE_STANDARD_ALLOC
0035 
0036   //! Given coefficients a, b, c, d , e, this constructor
0037   //! performs the resolution of the equation above.
0038   //! The solutions must be contained in [InfBound, SupBound].
0039   //! InfBound and SupBound can be set by default to 0 and 2*PI.
0040   Standard_EXPORT math_TrigonometricFunctionRoots(const double A,
0041                                                   const double B,
0042                                                   const double C,
0043                                                   const double D,
0044                                                   const double E,
0045                                                   const double InfBound,
0046                                                   const double SupBound);
0047 
0048   //! Given the two coefficients d and e, it performs
0049   //! the resolution of d*sin(x) + e = 0.
0050   //! The solutions must be contained in [InfBound, SupBound].
0051   //! InfBound and SupBound can be set by default to 0 and 2*PI.
0052   Standard_EXPORT math_TrigonometricFunctionRoots(const double D,
0053                                                   const double E,
0054                                                   const double InfBound,
0055                                                   const double SupBound);
0056 
0057   //! Given the three coefficients c, d and e, it performs
0058   //! the resolution of c*std::cos(x) + d*sin(x) + e = 0.
0059   //! The solutions must be contained in [InfBound, SupBound].
0060   //! InfBound and SupBound can be set by default to 0 and 2*PI.
0061   Standard_EXPORT math_TrigonometricFunctionRoots(const double C,
0062                                                   const double D,
0063                                                   const double E,
0064                                                   const double InfBound,
0065                                                   const double SupBound);
0066 
0067   //! Returns true if the computations are successful, otherwise returns false.
0068   bool IsDone() const;
0069 
0070   //! Returns true if there is an infinity of roots, otherwise returns false.
0071   bool InfiniteRoots() const;
0072 
0073   //! Returns the solution of range Index.
0074   //! An exception is raised if NotDone.
0075   //! An exception is raised if Index>NbSolutions.
0076   //! An exception is raised if there is an infinity of solutions.
0077   double Value(const int Index) const;
0078 
0079   //! Returns the number of solutions found.
0080   //! An exception is raised if NotDone.
0081   //! An exception is raised if there is an infinity of solutions.
0082   int NbSolutions() const;
0083 
0084   //! Prints information on the current state of the object.
0085   Standard_EXPORT void Dump(Standard_OStream& o) const;
0086 
0087 protected:
0088   //! is used by the constructors above.
0089   Standard_EXPORT void Perform(const double A,
0090                                const double B,
0091                                const double C,
0092                                const double D,
0093                                const double E,
0094                                const double InfBound,
0095                                const double SupBound);
0096 
0097 private:
0098   int                        NbSol;
0099   NCollection_Array1<double> Sol;
0100   bool                       InfiniteStatus;
0101   bool                       Done;
0102 };
0103 
0104 #include <math_TrigonometricFunctionRoots.lxx>
0105 
0106 #endif // _math_TrigonometricFunctionRoots_HeaderFile