Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-12-03 10:54:47

0001 // Created on: 1992-10-20
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 _Geom2dGcc_Circ2d2TanOn_HeaderFile
0018 #define _Geom2dGcc_Circ2d2TanOn_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <gp_Circ2d.hxx>
0025 #include <NCollection_Array1.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <GccEnt_Position.hxx>
0028 #include <gp_Pnt2d.hxx>
0029 class Geom2dGcc_QualifiedCurve;
0030 class Geom2dAdaptor_Curve;
0031 class Geom2d_Point;
0032 class GccAna_Circ2d2TanOn;
0033 class Geom2dGcc_Circ2d2TanOnGeo;
0034 class gp_Circ2d;
0035 class gp_Pnt2d;
0036 
0037 //! This class implements the algorithms used to
0038 //! create 2d circles TANgent to 2 entities and
0039 //! having the center ON a curve.
0040 //! The order of the tangency argument is always
0041 //! QualifiedCirc, QualifiedLin, QualifiedCurv, Pnt2d.
0042 //! the arguments are :
0043 //! - The two tangency arguments.
0044 //! - The center line.
0045 //! - The parameter for each tangency argument which
0046 //! is a curve.
0047 //! - The tolerance.
0048 class Geom2dGcc_Circ2d2TanOn
0049 {
0050 public:
0051   DEFINE_STANDARD_ALLOC
0052 
0053   //! This method implements the algorithms used to
0054   //! create 2d circles TANgent to two curves and
0055   //! having the center ON a 2d curve.
0056   //! Param1 is the initial guess on the first curve QualifiedCurv.
0057   //! Param1 is the initial guess on the second curve QualifiedCurv.
0058   //! ParamOn is the initial guess on the center curve OnCurv.
0059   //! Tolerance is used for the limit cases.
0060   Standard_EXPORT Geom2dGcc_Circ2d2TanOn(const Geom2dGcc_QualifiedCurve& Qualified1,
0061                                          const Geom2dGcc_QualifiedCurve& Qualified2,
0062                                          const Geom2dAdaptor_Curve&      OnCurve,
0063                                          const double                    Tolerance,
0064                                          const double                    Param1,
0065                                          const double                    Param2,
0066                                          const double                    ParamOn);
0067 
0068   //! This method implements the algorithms used to
0069   //! create 2d circles TANgent to one curve and one point and
0070   //! having the center ON a 2d curve.
0071   //! Param1 is the initial guess on the first curve QualifiedCurv.
0072   //! ParamOn is the initial guess on the center curve OnCurv.
0073   //! Tolerance is used for the limit cases.
0074   Standard_EXPORT Geom2dGcc_Circ2d2TanOn(const Geom2dGcc_QualifiedCurve&  Qualified1,
0075                                          const occ::handle<Geom2d_Point>& Point,
0076                                          const Geom2dAdaptor_Curve&       OnCurve,
0077                                          const double                     Tolerance,
0078                                          const double                     Param1,
0079                                          const double                     ParamOn);
0080 
0081   //! This method implements the algorithms used to
0082   //! create 2d circles TANgent to two points and
0083   //! having the center ON a 2d curve.
0084   //! Tolerance is used for the limit cases.
0085   Standard_EXPORT Geom2dGcc_Circ2d2TanOn(const occ::handle<Geom2d_Point>& Point1,
0086                                          const occ::handle<Geom2d_Point>& Point2,
0087                                          const Geom2dAdaptor_Curve&       OnCurve,
0088                                          const double                     Tolerance);
0089 
0090   Standard_EXPORT void Results(const GccAna_Circ2d2TanOn& Circ);
0091 
0092   Standard_EXPORT void Results(const Geom2dGcc_Circ2d2TanOnGeo& Circ);
0093 
0094   //! Returns true if the construction algorithm does not fail
0095   //! (even if it finds no solution).
0096   //! Note: IsDone protects against a failure arising from a
0097   //! more internal intersection algorithm, which has
0098   //! reached its numeric limits.
0099   Standard_EXPORT bool IsDone() const;
0100 
0101   //! This method returns the number of solutions.
0102   //! NotDone is raised if the algorithm failed.
0103   Standard_EXPORT int NbSolutions() const;
0104 
0105   //! Returns the solution number Index and raises OutOfRange
0106   //! exception if Index is greater than the number of solutions.
0107   //! Be careful: the Index is only a way to get all the
0108   //! solutions, but is not associated to these outside the context
0109   //! of the algorithm-object.
0110   //! Exceptions
0111   //! Standard_OutOfRange if Index is less than or equal
0112   //! to zero or greater than the number of solutions
0113   //! computed by this algorithm.
0114   //! StdFail_NotDone if the construction fails.
0115   Standard_EXPORT gp_Circ2d ThisSolution(const int Index) const;
0116 
0117   //! It returns the information about the qualifiers of
0118   //! the tangency
0119   //! arguments concerning the solution number Index.
0120   //! It returns the real qualifiers (the qualifiers given to the
0121   //! constructor method in case of enclosed, enclosing and outside
0122   //! and the qualifiers computedin case of unqualified).
0123   //! Exceptions
0124   //! Standard_OutOfRange if Index is less than zero or
0125   //! greater than the number of solutions computed by this algorithm.
0126   //! StdFail_NotDone if the construction fails.
0127   Standard_EXPORT void WhichQualifier(const int        Index,
0128                                       GccEnt_Position& Qualif1,
0129                                       GccEnt_Position& Qualif2) const;
0130 
0131   //! Returns information about the tangency point between the
0132   //! result and the first argument.
0133   //! ParSol is the intrinsic parameter of the point PntSol on the solution curv.
0134   //! ParArg is the intrinsic parameter of the point PntSol on the argument curv.
0135   Standard_EXPORT void Tangency1(const int Index,
0136                                  double&   ParSol,
0137                                  double&   ParArg,
0138                                  gp_Pnt2d& PntSol) const;
0139 
0140   //! Returns information about the tangency point between the
0141   //! result and the second argument.
0142   //! ParSol is the intrinsic parameter of the point PntSol on the solution curv.
0143   //! ParArg is the intrinsic parameter of the point PntSol on the argument curv.
0144   Standard_EXPORT void Tangency2(const int Index,
0145                                  double&   ParSol,
0146                                  double&   ParArg,
0147                                  gp_Pnt2d& PntSol) const;
0148 
0149   //! Returns the center PntSol of the solution of index Index
0150   //! computed by this algorithm.
0151   //! ParArg is the parameter of the point PntSol on the third argument.
0152   //! Exceptions
0153   //! Standard_OutOfRange if Index is less than zero or
0154   //! greater than the number of solutions computed by this algorithm.
0155   //! StdFail_NotDone if the construction fails.
0156   Standard_EXPORT void CenterOn3(const int Index, double& ParArg, gp_Pnt2d& PntSol) const;
0157 
0158   //! Returns true if the solution of index Index and,
0159   //! respectively, the first or second argument of this
0160   //! algorithm are the same (i.e. there are 2 identical circles).
0161   //! If Rarg is the radius of the first or second argument,
0162   //! Rsol is the radius of the solution and dist is the
0163   //! distance between the two centers, we consider the two
0164   //! circles to be identical if |Rarg - Rsol| and dist
0165   //! are less than or equal to the tolerance criterion given at
0166   //! the time of construction of this algorithm.
0167   //! Exceptions
0168   //! Standard_OutOfRange if Index is less than zero or
0169   //! greater than the number of solutions computed by this algorithm.
0170   //! StdFail_NotDone if the construction fails.
0171   Standard_EXPORT bool IsTheSame1(const int Index) const;
0172 
0173   //! Returns true if the solution of index Index and,
0174   //! respectively, the first or second argument of this
0175   //! algorithm are the same (i.e. there are 2 identical circles).
0176   //! If Rarg is the radius of the first or second argument,
0177   //! Rsol is the radius of the solution and dist is the
0178   //! distance between the two centers, we consider the two
0179   //! circles to be identical if |Rarg - Rsol| and dist
0180   //! are less than or equal to the tolerance criterion given at
0181   //! the time of construction of this algorithm.
0182   //! Exceptions
0183   //! Standard_OutOfRange if Index is less than zero or
0184   //! greater than the number of solutions computed by this algorithm.
0185   //! StdFail_NotDone if the construction fails.
0186   Standard_EXPORT bool IsTheSame2(const int Index) const;
0187 
0188 private:
0189   bool                                WellDone;
0190   NCollection_Array1<gp_Circ2d>       cirsol;
0191   int                                 NbrSol;
0192   NCollection_Array1<GccEnt_Position> qualifier1;
0193   NCollection_Array1<GccEnt_Position> qualifier2;
0194   NCollection_Array1<int>             TheSame1;
0195   NCollection_Array1<int>             TheSame2;
0196   NCollection_Array1<gp_Pnt2d>        pnttg1sol;
0197   NCollection_Array1<gp_Pnt2d>        pnttg2sol;
0198   NCollection_Array1<gp_Pnt2d>        pntcen;
0199   NCollection_Array1<double>          par1sol;
0200   NCollection_Array1<double>          par2sol;
0201   NCollection_Array1<double>          pararg1;
0202   NCollection_Array1<double>          pararg2;
0203   NCollection_Array1<double>          parcen3;
0204   bool                                Invert;
0205 };
0206 
0207 #endif // _Geom2dGcc_Circ2d2TanOn_HeaderFile