Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:27:49

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_Lin2dTanObl_HeaderFile
0018 #define _Geom2dGcc_Lin2dTanObl_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 Geom2dGcc_QualifiedCurve;
0029 class gp_Lin2d;
0030 class gp_Pnt2d;
0031 class Geom2dGcc_Lin2dTanOblIter;
0032 class Geom2dAdaptor_Curve;
0033 
0034 //! This class implements the algorithms used to
0035 //! create 2d line tangent to a curve QualifiedCurv and
0036 //! doing an angle Angle with a line TheLin.
0037 //! The angle must be in Radian.
0038 //! Describes functions for building a 2D line making a given
0039 //! angle with a line and tangential to a curve.
0040 //! A Lin2dTanObl object provides a framework for:
0041 //! -   defining the construction of 2D line(s),
0042 //! -   implementing the construction algorithm, and
0043 //! -   consulting the result(s).
0044 class Geom2dGcc_Lin2dTanObl
0045 {
0046 public:
0047   DEFINE_STANDARD_ALLOC
0048 
0049   //! This class implements the algorithm used to
0050   //! create 2d line tangent to a curve and doing an
0051   //! angle Angle with the line TheLin.
0052   //! Angle must be in Radian.
0053   //! Tolang is the angular tolerance.
0054   Standard_EXPORT Geom2dGcc_Lin2dTanObl(const Geom2dGcc_QualifiedCurve& Qualified1,
0055                                         const gp_Lin2d&                 TheLin,
0056                                         const double                    TolAng,
0057                                         const double                    Angle);
0058 
0059   //! This class implements the algorithm used to
0060   //! create 2d line tangent to a curve and doing an
0061   //! angle Angle with the line TheLin.
0062   //! Angle must be in Radian.
0063   //! Param2 is the initial guess on the curve QualifiedCurv.
0064   //! Tolang is the angular tolerance.
0065   //! Warning
0066   //! An iterative algorithm is used if Qualified1 is more
0067   //! complex than a line or a circle. In such cases, the
0068   //! algorithm constructs only one solution.
0069   //! Exceptions
0070   //! GccEnt_BadQualifier if a qualifier is inconsistent with
0071   //! the argument it qualifies (for example, enclosed for a circle).
0072   Standard_EXPORT Geom2dGcc_Lin2dTanObl(const Geom2dGcc_QualifiedCurve& Qualified1,
0073                                         const gp_Lin2d&                 TheLin,
0074                                         const double                    TolAng,
0075                                         const double                    Param1,
0076                                         const double                    Angle);
0077 
0078   //! Returns true if the construction algorithm does not fail
0079   //! (even if it finds no solution).
0080   //! Note: IsDone protects against a failure arising from a
0081   //! more internal intersection algorithm, which has reached its numeric limits.
0082   Standard_EXPORT bool IsDone() const;
0083 
0084   //! Returns the number of lines, representing solutions computed by this algorithm.
0085   //! Exceptions
0086   //! StdFail_NotDone if the construction fails.
0087   Standard_EXPORT int NbSolutions() const;
0088 
0089   //! Returns a line, representing the solution of index Index
0090   //! computed by this algorithm.
0091   //! Exceptions
0092   //! Standard_OutOfRange if Index is less than zero or
0093   //! greater than the number of solutions computed by this algorithm.
0094   //! StdFail_NotDone if the construction fails.
0095   Standard_EXPORT gp_Lin2d ThisSolution(const int Index) const;
0096 
0097   //! Returns the qualifier Qualif1 of the tangency argument
0098   //! for the solution of index Index computed by this algorithm.
0099   //! The returned qualifier is:
0100   //! -   that specified at the start of construction when the
0101   //! solutions are defined as enclosing or outside with
0102   //! respect to the argument, or
0103   //! -   that computed during construction (i.e. enclosing or
0104   //! outside) when the solutions are defined as unqualified
0105   //! with respect to the argument, or
0106   //! -   GccEnt_noqualifier if the tangency argument is a point.
0107   //! Exceptions
0108   //! Standard_OutOfRange if Index is less than zero or
0109   //! greater than the number of solutions computed by this algorithm.
0110   //! StdFail_NotDone if the construction fails.
0111   Standard_EXPORT void WhichQualifier(const int Index, GccEnt_Position& Qualif1) const;
0112 
0113   //! Returns information about the tangency point between the
0114   //! result and the first argument.
0115   //! ParSol is the intrinsic parameter of the point PntSol on
0116   //! the solution curv.
0117   //! ParArg is the intrinsic parameter of the point PntSol on
0118   //! the argument curv.
0119   Standard_EXPORT void Tangency1(const int Index,
0120                                  double&   ParSol,
0121                                  double&   ParArg,
0122                                  gp_Pnt2d& PntSol) const;
0123 
0124   //! Returns the point of intersection PntSol between the
0125   //! solution of index Index and the second argument (the line) of this algorithm.
0126   //! ParSol is the parameter of the point PntSol on the
0127   //! solution. ParArg is the parameter of the point PntSol on the second argument (the line).
0128   //! Exceptions
0129   //! StdFail_NotDone if the construction fails.
0130   //! Geom2dGcc_IsParallel if the solution and the second
0131   //! argument (the line) are parallel.
0132   //! Standard_OutOfRange if Index is less than zero or
0133   //! greater than the number of solutions computed by this algorithm.
0134   Standard_EXPORT void Intersection2(const int Index,
0135                                      double&   ParSol,
0136                                      double&   ParArg,
0137                                      gp_Pnt2d& PntSol) const;
0138 
0139   //! Returns true if the line and the solution are parallel. This
0140   //! is the case when the angle given at the time of
0141   //! construction is equal to 0 or Pi.
0142   //! Exceptions StdFail_NotDone if the construction fails.
0143   Standard_EXPORT bool IsParallel2() const;
0144 
0145 private:
0146   Standard_EXPORT bool Add(const int                        theIndex,
0147                            const Geom2dGcc_Lin2dTanOblIter& theLin,
0148                            const double                     theTol,
0149                            const Geom2dAdaptor_Curve&       theC1);
0150 
0151   bool                                WellDone;
0152   bool                                Paral2;
0153   int                                 NbrSol;
0154   NCollection_Array1<gp_Lin2d>        linsol;
0155   NCollection_Array1<GccEnt_Position> qualifier1;
0156   NCollection_Array1<gp_Pnt2d>        pnttg1sol;
0157   NCollection_Array1<gp_Pnt2d>        pntint2sol;
0158   NCollection_Array1<double>          par1sol;
0159   NCollection_Array1<double>          par2sol;
0160   NCollection_Array1<double>          pararg1;
0161   NCollection_Array1<double>          pararg2;
0162 };
0163 
0164 #endif // _Geom2dGcc_Lin2dTanObl_HeaderFile