Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:57:48

0001 // Created on: 1991-04-03
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_Lin2d2Tan_HeaderFile
0018 #define _GccAna_Lin2d2Tan_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 #include <gp_Lin2d.hxx>
0025 #include <NCollection_Array1.hxx>
0026 #include <GccEnt_Position.hxx>
0027 #include <gp_Pnt2d.hxx>
0028 class gp_Pnt2d;
0029 class GccEnt_QualifiedCirc;
0030 class gp_Lin2d;
0031 
0032 //! This class implements the algorithms used to
0033 //! create 2d lines tangent to 2 other elements which
0034 //! can be circles or points.
0035 //! Describes functions for building a 2D line:
0036 //! -   tangential to 2 circles, or
0037 //! -   tangential to a circle and passing through a point, or
0038 //! -   passing through 2 points.
0039 //! A Lin2d2Tan object provides a framework for:
0040 //! -   defining the construction of 2D line(s),
0041 //! -   implementing the construction algorithm, and
0042 //! consulting the result(s).
0043 //! Some constructors may check the type of the qualified argument
0044 //! and raise BadQualifier Error in case of incorrect couple (qualifier,
0045 //! curv).
0046 //! For example: "EnclosedCirc".
0047 class GccAna_Lin2d2Tan
0048 {
0049 public:
0050   DEFINE_STANDARD_ALLOC
0051 
0052   //! This methods implements the algorithms used to
0053   //! create 2d lines passing through 2 points.
0054   //! Tolerance is used because we can't create a line
0055   //! when the distance between the two points is too small.
0056   Standard_EXPORT GccAna_Lin2d2Tan(const gp_Pnt2d& ThePoint1,
0057                                    const gp_Pnt2d& ThePoint2,
0058                                    const double    Tolerance);
0059 
0060   //! This methods implements the algorithms used to
0061   //! create 2d lines tangent to one circle and passing
0062   //! through a point.
0063   //! Exception BadQualifier is raised in the case of
0064   //! EnclosedCirc
0065   //! Tolerance is used because there is no solution
0066   //! when the point is inside the solution according to
0067   //! the tolerance.
0068   Standard_EXPORT GccAna_Lin2d2Tan(const GccEnt_QualifiedCirc& Qualified1,
0069                                    const gp_Pnt2d&             ThePoint,
0070                                    const double                Tolerance);
0071 
0072   //! This methods implements the algorithms used to
0073   //! create 2d lines tangent to 2 circles.
0074   //! Exception BadQualifier is raised in the case of
0075   //! EnclosedCirc
0076   Standard_EXPORT GccAna_Lin2d2Tan(const GccEnt_QualifiedCirc& Qualified1,
0077                                    const GccEnt_QualifiedCirc& Qualified2,
0078                                    const double                Tolerance);
0079 
0080   //! This method returns true when there is a solution
0081   //! and false in the other cases.
0082   Standard_EXPORT bool IsDone() const;
0083 
0084   //! This method returns the number of solutions.
0085   //! Raises NotDone if the construction algorithm didn't succeed.
0086   Standard_EXPORT int NbSolutions() const;
0087 
0088   //! Returns the solution number Index and raises OutOfRange
0089   //! exception if Index is greater than the number of solutions.
0090   //! Be careful: the Index is only a way to get all the
0091   //! solutions, but is not associated to these outside the
0092   //! context of the algorithm-object. Raises OutOfRange is raised if Index is greater than
0093   //! the number of solutions.
0094   //! It raises NotDone if the algorithm failed.
0095   Standard_EXPORT gp_Lin2d ThisSolution(const int Index) const;
0096 
0097   //! Returns the qualifiers Qualif1 and Qualif2 of the
0098   //! tangency arguments for the solution of index Index
0099   //! computed by this algorithm.
0100   //! The returned qualifiers are:
0101   //! -   those specified at the start of construction when the
0102   //! solutions are defined as enclosing or outside with
0103   //! respect to the arguments, or
0104   //! -   those computed during construction (i.e. enclosing or
0105   //! outside) when the solutions are defined as unqualified
0106   //! with respect to the arguments, or
0107   //! -   GccEnt_noqualifier if the tangency argument is a point.
0108   //! Exceptions
0109   //! Standard_OutOfRange if Index is less than zero or
0110   //! greater than the number of solutions computed by this algorithm.
0111   //! StdFail_NotDone if the construction fails.
0112   Standard_EXPORT void WhichQualifier(const int        Index,
0113                                       GccEnt_Position& Qualif1,
0114                                       GccEnt_Position& Qualif2) const;
0115 
0116   //! Returns information about the tangency point between the
0117   //! result number Index and the first argument.
0118   //! ParSol is the intrinsic parameter of the point PntSol on
0119   //! the solution curv.
0120   //! ParArg is the intrinsic parameter of the point PntSol on
0121   //! the argument curv. Raises OutOfRange is raised if Index is greater than
0122   //! the number of solutions.
0123   //! It raises NotDone if the algorithm failed.
0124   Standard_EXPORT void Tangency1(const int Index,
0125                                  double&   ParSol,
0126                                  double&   ParArg,
0127                                  gp_Pnt2d& PntSol) const;
0128 
0129   //! Returns information about the tangency point between the
0130   //! result number Index and the second argument.
0131   //! ParSol is the intrinsic parameter of the point ParSol on
0132   //! the solution curv.
0133   //! ParArg is the intrinsic parameter of the point PntSol on
0134   //! the argument curv. Raises OutOfRange is raised if Index is greater than
0135   //! the number of solutions.
0136   //! It raises NotDone if the algorithm failed.
0137   Standard_EXPORT void Tangency2(const int Index,
0138                                  double&   ParSol,
0139                                  double&   ParArg,
0140                                  gp_Pnt2d& PntSol) const;
0141 
0142 private:
0143   bool                                WellDone;
0144   int                                 NbrSol;
0145   NCollection_Array1<gp_Lin2d>        linsol;
0146   NCollection_Array1<GccEnt_Position> qualifier1;
0147   NCollection_Array1<GccEnt_Position> qualifier2;
0148   NCollection_Array1<gp_Pnt2d>        pnttg1sol;
0149   NCollection_Array1<gp_Pnt2d>        pnttg2sol;
0150   NCollection_Array1<double>          par1sol;
0151   NCollection_Array1<double>          par2sol;
0152   NCollection_Array1<double>          pararg1;
0153   NCollection_Array1<double>          pararg2;
0154 };
0155 
0156 #endif // _GccAna_Lin2d2Tan_HeaderFile