Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/Geom2dGcc_Circ2d3Tan.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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_Circ2d3Tan_HeaderFile
0018 #define _Geom2dGcc_Circ2d3Tan_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 <GccEnt_Position.hxx>
0027 #include <Standard_Integer.hxx>
0028 #include <gp_Pnt2d.hxx>
0029 class Geom2dGcc_QualifiedCurve;
0030 class Geom2d_Point;
0031 class GccAna_Circ2d3Tan;
0032 class gp_Circ2d;
0033 class gp_Pnt2d;
0034 
0035 //! This class implements the algorithms used to
0036 //! create 2d circles tangent to 3 points/lines/circles/
0037 //! curves with one curve or more.
0038 //! The arguments of all construction methods are :
0039 //! - The three qualifiied elements for the
0040 //! tangency constrains (QualifiedCirc, QualifiedLine,
0041 //! Qualifiedcurv, Points).
0042 //! - A parameter for each QualifiedCurv.
0043 //! Describes functions for building a 2D circle:
0044 //! -   tangential to 3 curves, or
0045 //! -   tangential to 2 curves and passing through a point, or
0046 //! -   tangential to a curve and passing through 2 points, or
0047 //! -   passing through 3 points.
0048 //! A Circ2d3Tan object provides a framework for:
0049 //! -   defining the construction of 2D circles(s),
0050 //! -   implementing the construction algorithm, and
0051 //! -   consulting the result(s).
0052 class Geom2dGcc_Circ2d3Tan
0053 {
0054 public:
0055   DEFINE_STANDARD_ALLOC
0056 
0057   //! Constructs one or more 2D circles
0058   //! tangential to three curves Qualified1, Qualified2 and
0059   //! Qualified3, where Param1, Param2 and Param3 are
0060   //! used, respectively, as the initial values of the
0061   //! parameters on Qualified1, Qualified2 and Qualified3
0062   //! of the tangency point between these arguments and
0063   //! the solution sought, if the algorithm chooses an
0064   //! iterative method to find the solution (i.e. if either
0065   //! Qualified1, Qualified2 or Qualified3 is more complex
0066   //! than a line or a circle).
0067   Standard_EXPORT Geom2dGcc_Circ2d3Tan(const Geom2dGcc_QualifiedCurve& Qualified1,
0068                                        const Geom2dGcc_QualifiedCurve& Qualified2,
0069                                        const Geom2dGcc_QualifiedCurve& Qualified3,
0070                                        const double                    Tolerance,
0071                                        const double                    Param1,
0072                                        const double                    Param2,
0073                                        const double                    Param3);
0074 
0075   //! Constructs one or more 2D circles
0076   //! tangential to two curves Qualified1 and Qualified2
0077   //! and passing through the point Point, where Param1
0078   //! and Param2 are used, respectively, as the initial
0079   //! values of the parameters on Qualified1 and
0080   //! Qualified2 of the tangency point between this
0081   //! argument and the solution sought, if the algorithm
0082   //! chooses an iterative method to find the solution (i.e. if
0083   //! either Qualified1 or Qualified2 is more complex than
0084   //! a line or a circle).
0085   Standard_EXPORT Geom2dGcc_Circ2d3Tan(const Geom2dGcc_QualifiedCurve&  Qualified1,
0086                                        const Geom2dGcc_QualifiedCurve&  Qualified2,
0087                                        const occ::handle<Geom2d_Point>& Point,
0088                                        const double                     Tolerance,
0089                                        const double                     Param1,
0090                                        const double                     Param2);
0091 
0092   //! Constructs one or more 2D circles tangential to the curve Qualified1 and passing
0093   //! through two points Point1 and Point2, where Param1
0094   //! is used as the initial value of the parameter on
0095   //! Qualified1 of the tangency point between this
0096   //! argument and the solution sought, if the algorithm
0097   //! chooses an iterative method to find the solution (i.e. if
0098   //! Qualified1 is more complex than a line or a circle)
0099   Standard_EXPORT Geom2dGcc_Circ2d3Tan(const Geom2dGcc_QualifiedCurve&  Qualified1,
0100                                        const occ::handle<Geom2d_Point>& Point1,
0101                                        const occ::handle<Geom2d_Point>& Point2,
0102                                        const double                     Tolerance,
0103                                        const double                     Param1);
0104 
0105   //! Constructs one or more 2D circles passing through three points Point1, Point2 and Point3.
0106   //! Tolerance is a tolerance criterion used by the algorithm
0107   //! to find a solution when, mathematically, the problem
0108   //! posed does not have a solution, but where there is
0109   //! numeric uncertainty attached to the arguments.
0110   //! For example, take:
0111   //! -   two circles C1 and C2, such that C2 is inside C1,
0112   //! and almost tangential to C1; there is in fact no point
0113   //! of intersection between C1 and C2; and
0114   //! -   a circle C3 outside C1.
0115   //! You now want to find a circle which is tangential to C1,
0116   //! C2 and C3: a pure mathematical resolution will not find
0117   //! a solution. This is where the tolerance criterion is used:
0118   //! the algorithm considers that C1 and C2 are tangential if
0119   //! the shortest distance between these two circles is less
0120   //! than or equal to Tolerance. Thus, the algorithm finds a solution.
0121   //! Warning
0122   //! An iterative algorithm is used if Qualified1, Qualified2 or
0123   //! Qualified3 is more complex than a line or a circle. In
0124   //! such cases, the algorithm constructs only one solution.
0125   //! Exceptions
0126   //! GccEnt_BadQualifier if a qualifier is inconsistent with
0127   //! the argument it qualifies (for example, enclosing for a line).
0128   Standard_EXPORT Geom2dGcc_Circ2d3Tan(const occ::handle<Geom2d_Point>& Point1,
0129                                        const occ::handle<Geom2d_Point>& Point2,
0130                                        const occ::handle<Geom2d_Point>& Point3,
0131                                        const double                     Tolerance);
0132 
0133   Standard_EXPORT void Results(const GccAna_Circ2d3Tan& Circ,
0134                                const int                Rank1,
0135                                const int                Rank2,
0136                                const int                Rank3);
0137 
0138   //! Returns true if the construction algorithm does not fail (even if it finds no solution).
0139   //! Note: IsDone protects against a failure arising from a
0140   //! more internal intersection algorithm, which has reached its numeric limits.
0141   Standard_EXPORT bool IsDone() const;
0142 
0143   //! This method returns the number of solutions.
0144   //! NotDone is raised if the algorithm failed.
0145   Standard_EXPORT int NbSolutions() const;
0146 
0147   //! Returns the solution number Index and raises OutOfRange
0148   //! exception if Index is greater than the number of solutions.
0149   //! Be careful: the Index is only a way to get all the
0150   //! solutions, but is not associated to these outside the context
0151   //! of the algorithm-object.
0152   Standard_EXPORT gp_Circ2d ThisSolution(const int Index) const;
0153 
0154   //! It returns the information about the qualifiers of the tangency
0155   //! arguments concerning the solution number Index.
0156   //! It returns the real qualifiers (the qualifiers given to the
0157   //! constructor method in case of enclosed, enclosing and outside
0158   //! and the qualifiers computedin case of unqualified).
0159   Standard_EXPORT void WhichQualifier(const int        Index,
0160                                       GccEnt_Position& Qualif1,
0161                                       GccEnt_Position& Qualif2,
0162                                       GccEnt_Position& Qualif3) const;
0163 
0164   //! Returns information about the tangency point between the
0165   //! result and the first argument.
0166   //! ParSol is the intrinsic parameter of the point PntSol on the solution curv.
0167   //! ParArg is the intrinsic parameter of the point PntSol on the argument curv.
0168   Standard_EXPORT void Tangency1(const int Index,
0169                                  double&   ParSol,
0170                                  double&   ParArg,
0171                                  gp_Pnt2d& PntSol) const;
0172 
0173   //! Returns information about the tangency point between the
0174   //! result and the second argument.
0175   //! ParSol is the intrinsic parameter of the point PntSol on the solution curv.
0176   //! ParArg is the intrinsic parameter of the point PntSol on the argument curv.
0177   Standard_EXPORT void Tangency2(const int Index,
0178                                  double&   ParSol,
0179                                  double&   ParArg,
0180                                  gp_Pnt2d& PntSol) const;
0181 
0182   //! Returns information about the tangency point between the
0183   //! result and the third argument.
0184   //! ParSol is the intrinsic parameter of the point PntSol on the solution curv.
0185   //! ParArg is the intrinsic parameter of the point PntSol on the argument curv.
0186   Standard_EXPORT void Tangency3(const int Index,
0187                                  double&   ParSol,
0188                                  double&   ParArg,
0189                                  gp_Pnt2d& PntSol) const;
0190 
0191   //! Returns True if the solution is equal to the first argument.
0192   Standard_EXPORT bool IsTheSame1(const int Index) const;
0193 
0194   //! Returns True if the solution is equal to the second argument.
0195   Standard_EXPORT bool IsTheSame2(const int Index) const;
0196 
0197   //! Returns True if the solution is equal to the third argument.
0198   //! If Rarg is the radius of the first, second or third
0199   //! argument, Rsol is the radius of the solution and dist
0200   //! is the distance between the two centers, we consider
0201   //! the two circles to be identical if |Rarg - Rsol| and
0202   //! dist are less than or equal to the tolerance criterion
0203   //! given at the time of construction of this algorithm.
0204   //! Exceptions
0205   //! Standard_OutOfRange if Index is less than zero or
0206   //! greater than the number of solutions computed by this algorithm.
0207   //! StdFail_NotDone if the construction fails.
0208   Standard_EXPORT bool IsTheSame3(const int Index) const;
0209 
0210 private:
0211   NCollection_Array1<gp_Circ2d>       cirsol;
0212   double                              NbrSol;
0213   bool                                WellDone;
0214   NCollection_Array1<GccEnt_Position> qualifier1;
0215   NCollection_Array1<GccEnt_Position> qualifier2;
0216   NCollection_Array1<GccEnt_Position> qualifier3;
0217   NCollection_Array1<int>             TheSame1;
0218   NCollection_Array1<int>             TheSame2;
0219   NCollection_Array1<int>             TheSame3;
0220   NCollection_Array1<gp_Pnt2d>        pnttg1sol;
0221   NCollection_Array1<gp_Pnt2d>        pnttg2sol;
0222   NCollection_Array1<gp_Pnt2d>        pnttg3sol;
0223   NCollection_Array1<double>          par1sol;
0224   NCollection_Array1<double>          par2sol;
0225   NCollection_Array1<double>          par3sol;
0226   NCollection_Array1<double>          pararg1;
0227   NCollection_Array1<double>          pararg2;
0228   NCollection_Array1<double>          pararg3;
0229 };
0230 
0231 #endif // _Geom2dGcc_Circ2d3Tan_HeaderFile