Back to home page

EIC code displayed by LXR

 
 

    


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

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