Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-05 09:22:06

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_Circ2d2TanRad_HeaderFile
0018 #define _Geom2dGcc_Circ2d2TanRad_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 Geom2d_Point;
0031 class GccAna_Circ2d2TanRad;
0032 class Geom2dGcc_Circ2d2TanRadGeo;
0033 class gp_Circ2d;
0034 class gp_Pnt2d;
0035 
0036 //! This class implements the algorithms used to
0037 //! create 2d circles tangent to one curve and a
0038 //! point/line/circle/curv and with a given radius.
0039 //! For each construction methods arguments are:
0040 //! - Two Qualified elements for tangency constrains.
0041 //! (for example EnclosedCirc if we want the
0042 //! solution inside the argument EnclosedCirc).
0043 //! - Two Reals. One (Radius) for the radius and the
0044 //! other (Tolerance) for the tolerance.
0045 //! Tolerance is only used for the limit cases.
0046 //! For example :
0047 //! We want to create a circle inside a circle C1 and
0048 //! inside a curve Cu2 with a radius Radius and a
0049 //! tolerance Tolerance.
0050 //! If we did not used Tolerance it is impossible to
0051 //! find a solution in the following case : Cu2 is
0052 //! inside C1 and there is no intersection point
0053 //! between the two elements.
0054 //! with Tolerance we will give a solution if the
0055 //! lowest distance between C1 and Cu2 is lower than or
0056 //! equal Tolerance.
0057 class Geom2dGcc_Circ2d2TanRad
0058 {
0059 public:
0060   DEFINE_STANDARD_ALLOC
0061 
0062   Standard_EXPORT Geom2dGcc_Circ2d2TanRad(const Geom2dGcc_QualifiedCurve& Qualified1,
0063                                           const Geom2dGcc_QualifiedCurve& Qualified2,
0064                                           const double                    Radius,
0065                                           const double                    Tolerance);
0066 
0067   Standard_EXPORT Geom2dGcc_Circ2d2TanRad(const Geom2dGcc_QualifiedCurve&  Qualified1,
0068                                           const occ::handle<Geom2d_Point>& Point,
0069                                           const double                     Radius,
0070                                           const double                     Tolerance);
0071 
0072   //! These constructors create one or more 2D circles of radius Radius either
0073   //! -   tangential to the 2 curves Qualified1 and Qualified2, or
0074   //! -   tangential to the curve Qualified1 and passing through the point Point, or
0075   //! -   passing through two points Point1 and Point2.
0076   //! Tolerance is a tolerance criterion used by the algorithm
0077   //! to find a solution when, mathematically, the problem
0078   //! posed does not have a solution, but where there is
0079   //! numeric uncertainty attached to the arguments.
0080   //! For example, take two circles C1 and C2, such that C2
0081   //! is inside C1, and almost tangential to C1. There is, in
0082   //! fact, no point of intersection between C1 and C2. You
0083   //! now want to find a circle of radius R (smaller than the
0084   //! radius of C2), which is tangential to C1 and C2, and
0085   //! inside these two circles: a pure mathematical resolution
0086   //! will not find a solution. This is where the tolerance
0087   //! criterion is used: the algorithm considers that C1 and
0088   //! C2 are tangential if the shortest distance between these
0089   //! two circles is less than or equal to Tolerance. Thus, a
0090   //! solution is found by the algorithm.
0091   //! Exceptions
0092   //! GccEnt_BadQualifier if a qualifier is inconsistent with
0093   //! the argument it qualifies (for example, enclosing for a line).
0094   //! Standard_NegativeValue if Radius is negative.
0095   Standard_EXPORT Geom2dGcc_Circ2d2TanRad(const occ::handle<Geom2d_Point>& Point1,
0096                                           const occ::handle<Geom2d_Point>& Point2,
0097                                           const double                     Radius,
0098                                           const double                     Tolerance);
0099 
0100   Standard_EXPORT void Results(const GccAna_Circ2d2TanRad& Circ);
0101 
0102   Standard_EXPORT void Results(const Geom2dGcc_Circ2d2TanRadGeo& Circ);
0103 
0104   //! This method returns True if the algorithm succeeded.
0105   //! Note: IsDone protects against a failure arising from a
0106   //! more internal intersection algorithm, which has reached its numeric limits.
0107   Standard_EXPORT bool IsDone() const;
0108 
0109   //! This method returns the number of solutions.
0110   //! NotDone is raised if the algorithm failed.
0111   //! Exceptions
0112   //! StdFail_NotDone if the construction fails.
0113   Standard_EXPORT int NbSolutions() const;
0114 
0115   //! Returns the solution number Index and raises OutOfRange
0116   //! exception if Index is greater than the number of solutions.
0117   //! Be careful: the Index is only a way to get all the
0118   //! solutions, but is not associated to these outside the context of the algorithm-object.
0119   //! Warning
0120   //! This indexing simply provides a means of consulting the
0121   //! solutions. The index values are not associated with
0122   //! these solutions outside the context of the algorithm object.
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 gp_Circ2d ThisSolution(const int Index) const;
0128 
0129   //! Returns the qualifiers Qualif1 and Qualif2 of the
0130   //! tangency arguments for the solution of index Index
0131   //! computed by this algorithm.
0132   //! The returned qualifiers are:
0133   //! -   those specified at the start of construction when the
0134   //! solutions are defined as enclosed, enclosing or
0135   //! outside with respect to the arguments, or
0136   //! -   those computed during construction (i.e. enclosed,
0137   //! enclosing or outside) when the solutions are defined
0138   //! as unqualified with respect to the arguments, or
0139   //! -   GccEnt_noqualifier if the tangency argument is a point, or
0140   //! -   GccEnt_unqualified in certain limit cases where it
0141   //! is impossible to qualify the solution as enclosed, enclosing or outside.
0142   //! Exceptions
0143   //! Standard_OutOfRange if Index is less than zero or
0144   //! greater than the number of solutions computed by this algorithm.
0145   //! StdFail_NotDone if the construction fails.
0146   Standard_EXPORT void WhichQualifier(const int        Index,
0147                                       GccEnt_Position& Qualif1,
0148                                       GccEnt_Position& Qualif2) const;
0149 
0150   //! Returns information about the tangency point between the
0151   //! result number Index and the first argument.
0152   //! ParSol is the intrinsic parameter of the point PntSol on the solution curv.
0153   //! ParArg is the intrinsic parameter of the point PntSol on the argument curv.
0154   //! OutOfRange is raised if Index is greater than the number of solutions.
0155   //! notDone is raised if the construction algorithm did not succeed.
0156   Standard_EXPORT void Tangency1(const int Index,
0157                                  double&   ParSol,
0158                                  double&   ParArg,
0159                                  gp_Pnt2d& PntSol) const;
0160 
0161   //! Returns information about the tangency point between the
0162   //! result number Index and the second argument.
0163   //! ParSol is the intrinsic parameter of the point PntSol on the solution curv.
0164   //! ParArg is the intrinsic parameter of the point PntSol on the argument curv.
0165   //! OutOfRange is raised if Index is greater than the number of solutions.
0166   //! notDone is raised if the construction algorithm did not succeed.
0167   Standard_EXPORT void Tangency2(const int Index,
0168                                  double&   ParSol,
0169                                  double&   ParArg,
0170                                  gp_Pnt2d& PntSol) const;
0171 
0172   //! Returns true if the solution of index Index and,
0173   //! respectively, the first or second argument of this
0174   //! algorithm are the same (i.e. there are 2 identical circles).
0175   //! If Rarg is the radius of the first or second argument,
0176   //! Rsol is the radius of the solution and dist is the
0177   //! distance between the two centers, we consider the two
0178   //! circles to be identical if |Rarg - Rsol| and dist
0179   //! are less than or equal to the tolerance criterion given at
0180   //! the time of construction of this algorithm.
0181   //! OutOfRange is raised if Index is greater than the number of solutions.
0182   //! notDone is raised if the construction algorithm did not succeed.
0183   Standard_EXPORT bool IsTheSame1(const int Index) const;
0184 
0185   //! Returns true if the solution of index Index and,
0186   //! respectively, the first or second argument of this
0187   //! algorithm are the same (i.e. there are 2 identical circles).
0188   //! If Rarg is the radius of the first or second argument,
0189   //! Rsol is the radius of the solution and dist is the
0190   //! distance between the two centers, we consider the two
0191   //! circles to be identical if |Rarg - Rsol| and dist
0192   //! are less than or equal to the tolerance criterion given at
0193   //! the time of construction of this algorithm.
0194   //! OutOfRange is raised if Index is greater than the number of solutions.
0195   //! notDone is raised if the construction algorithm did not succeed.
0196   Standard_EXPORT bool IsTheSame2(const int Index) const;
0197 
0198 private:
0199   bool                                WellDone;
0200   NCollection_Array1<gp_Circ2d>       cirsol;
0201   int                                 NbrSol;
0202   NCollection_Array1<GccEnt_Position> qualifier1;
0203   NCollection_Array1<GccEnt_Position> qualifier2;
0204   NCollection_Array1<int>             TheSame1;
0205   NCollection_Array1<int>             TheSame2;
0206   NCollection_Array1<gp_Pnt2d>        pnttg1sol;
0207   NCollection_Array1<gp_Pnt2d>        pnttg2sol;
0208   NCollection_Array1<double>          par1sol;
0209   NCollection_Array1<double>          par2sol;
0210   NCollection_Array1<double>          pararg1;
0211   NCollection_Array1<double>          pararg2;
0212   bool                                Invert;
0213 };
0214 
0215 #endif // _Geom2dGcc_Circ2d2TanRad_HeaderFile