Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:34

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