Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-16 08:29:09

0001 // Created on: 1991-03-18
0002 // Created by: Remi GILET
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 _GccAna_Circ2dTanCen_HeaderFile
0018 #define _GccAna_Circ2dTanCen_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 #include <TColgp_Array1OfCirc2d.hxx>
0025 #include <GccEnt_Array1OfPosition.hxx>
0026 #include <TColStd_Array1OfInteger.hxx>
0027 #include <TColgp_Array1OfPnt2d.hxx>
0028 #include <TColStd_Array1OfReal.hxx>
0029 #include <GccEnt_Position.hxx>
0030 class GccEnt_QualifiedCirc;
0031 class gp_Pnt2d;
0032 class gp_Lin2d;
0033 class gp_Circ2d;
0034 
0035 //! This class implements the algorithms used to
0036 //! create 2d circles tangent to an entity and
0037 //! centered on a point.
0038 //! The arguments of all construction methods are :
0039 //! - The qualified element for the tangency constrains
0040 //! (QualifiedCirc, Line, Point).
0041 //! - The center point Pcenter.
0042 //! - A real Tolerance.
0043 //! Tolerance is only used in the limits cases.
0044 //! For example :
0045 //! We want to create a circle tangent to an EnclosedCirc C1
0046 //! with a tolerance Tolerance.
0047 //! If we did not used Tolerance it is impossible to
0048 //! find a solution in the following case : Pcenter is
0049 //! outside C1.
0050 //! With Tolerance we will give a solution if the distance
0051 //! between C1 and Pcenter is lower than or equal Tolerance.
0052 class GccAna_Circ2dTanCen
0053 {
0054 public:
0055   DEFINE_STANDARD_ALLOC
0056 
0057   //! This method implements the algorithms used to
0058   //! create 2d circles tangent to a circle and
0059   //! centered on a point.
0060   Standard_EXPORT GccAna_Circ2dTanCen(const GccEnt_QualifiedCirc& Qualified1,
0061                                       const gp_Pnt2d&             Pcenter,
0062                                       const Standard_Real         Tolerance);
0063 
0064   //! This method implements the algorithms used to
0065   //! create 2d circles tangent to a line and
0066   //! centered on a point.
0067   Standard_EXPORT GccAna_Circ2dTanCen(const gp_Lin2d& Linetan, const gp_Pnt2d& Pcenter);
0068 
0069   //! This method implements the algorithms used to
0070   //! create 2d circles passing through a point and
0071   //! centered on a point.
0072   //! Tolerance is a tolerance criterion used by the algorithm
0073   //! to find a solution when, mathematically, the problem
0074   //! posed does not have a solution, but where there is
0075   //! numeric uncertainty attached to the arguments.
0076   //! In these algorithms Tolerance is only used in very
0077   //! specific cases where the center of the solution is very
0078   //! close to the circle to which it is tangential, and where the
0079   //! solution is therefore a very small circle.
0080   //! Exceptions
0081   //! GccEnt_BadQualifier if a qualifier is inconsistent with
0082   //! the argument it qualifies (for example, enclosing for a line).
0083   Standard_EXPORT GccAna_Circ2dTanCen(const gp_Pnt2d& Point1, const gp_Pnt2d& Pcenter);
0084 
0085   //! This method returns True if the construction
0086   //! algorithm succeeded.
0087   //! Note: IsDone protects against a failure arising from a
0088   //! more internal intersection algorithm, which has reached
0089   //! its numeric limits.
0090   Standard_EXPORT Standard_Boolean IsDone() const;
0091 
0092   //! Returns the number of circles, representing solutions
0093   //! computed by this algorithm and raises NotDone
0094   //! exception if the algorithm didn't succeed.
0095   Standard_EXPORT Standard_Integer NbSolutions() const;
0096 
0097   //! Returns the circle, representing the solution number Index and raises OutOfRange
0098   //! exception if Index is greater than the number of solutions.
0099   //! Be careful: the Index is only a way to get all the
0100   //! solutions, but is not associated to these outside the
0101   //! context of the algorithm-object.
0102   //! Raises NotDone if the construction algorithm didn't succeed.
0103   //! It raises OutOfRange if Index is greater than the
0104   //! number of solutions or less than zer
0105   Standard_EXPORT gp_Circ2d ThisSolution(const Standard_Integer Index) const;
0106 
0107   //! Returns the qualifier Qualif1 of the tangency argument
0108   //! for the solution of index Index computed by this algorithm.
0109   //! The returned qualifier is:
0110   //! -   that specified at the start of construction when the
0111   //! solutions are defined as enclosed, enclosing or
0112   //! It returns the real qualifiers (the qualifiers given to the
0113   //! constructor method in case of enclosed, enclosing and outside
0114   //! and the qualifiers computedin case of unqualified).
0115   Standard_EXPORT void WhichQualifier(const Standard_Integer Index, GccEnt_Position& Qualif1) const;
0116 
0117   //! Returns information about the tangency point between the
0118   //! result number Index and the first argument.
0119   //! ParSol is the intrinsic parameter of the point PntSol
0120   //! on the solution curv.
0121   //! ParArg is the intrinsic parameter of the point PntArg
0122   //! on the argument curv.
0123   //! It raises NotDone if the construction algorithm
0124   //! didn't succeed.
0125   //! It raises OutOfRange if Index is greater than the
0126   //! number of solutions or less than zero.
0127   Standard_EXPORT void Tangency1(const Standard_Integer Index,
0128                                  Standard_Real&         ParSol,
0129                                  Standard_Real&         ParArg,
0130                                  gp_Pnt2d&              PntSol) const;
0131 
0132   //! Returns True if the solution number Index is equal to
0133   //! the first argument.
0134   //! It raises NotDone if the construction algorithm
0135   //! didn't succeed.
0136   //! It raises OutOfRange if Index is greater than the
0137   //! number of solutions or less than zero.
0138   Standard_EXPORT Standard_Boolean IsTheSame1(const Standard_Integer Index) const;
0139 
0140 protected:
0141 private:
0142   Standard_Boolean        WellDone;
0143   Standard_Integer        NbrSol;
0144   TColgp_Array1OfCirc2d   cirsol;
0145   GccEnt_Array1OfPosition qualifier1;
0146   TColStd_Array1OfInteger TheSame1;
0147   TColgp_Array1OfPnt2d    pnttg1sol;
0148   TColStd_Array1OfReal    par1sol;
0149   TColStd_Array1OfReal    pararg1;
0150 };
0151 
0152 #endif // _GccAna_Circ2dTanCen_HeaderFile