Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:17:22

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_Lin2dTanPer_HeaderFile
0018 #define _GccAna_Lin2dTanPer_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 gp_Lin2d;
0030 class gp_Circ2d;
0031 class GccEnt_QualifiedCirc;
0032 
0033 //! This class implements the algorithms used to
0034 //! create 2d lines tangent to a circle or a point and
0035 //! perpendicular to a line or a circle.
0036 //! Describes functions for building a 2D line perpendicular
0037 //! to a line and:
0038 //! -   tangential to a circle, or
0039 //! -   passing through a point.
0040 //! A Lin2dTanPer 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 GccAna_Lin2dTanPer
0045 {
0046 public:
0047   DEFINE_STANDARD_ALLOC
0048 
0049   //! This method implements the algorithms used to
0050   //! create 2d lines passing through a point and
0051   //! perpendicular to a line.
0052   Standard_EXPORT GccAna_Lin2dTanPer(const gp_Pnt2d& ThePnt, const gp_Lin2d& TheLin);
0053 
0054   //! This method implements the algorithms used to
0055   //! create 2d lines passing through a point and
0056   //! perpendicular to a circle.
0057   Standard_EXPORT GccAna_Lin2dTanPer(const gp_Pnt2d& ThePnt, const gp_Circ2d& TheCircle);
0058 
0059   //! This method implements the algorithms used to
0060   //! create 2d lines tangent to a circle and
0061   //! perpendicular to a line.
0062   Standard_EXPORT GccAna_Lin2dTanPer(const GccEnt_QualifiedCirc& Qualified1,
0063                                      const gp_Lin2d&             TheLin);
0064 
0065   //! This method implements the algorithms used to
0066   //! create 2d lines tangent to a circle and
0067   //! perpendicular to a circle.
0068   Standard_EXPORT GccAna_Lin2dTanPer(const GccEnt_QualifiedCirc& Qualified1,
0069                                      const gp_Circ2d&            TheCircle);
0070 
0071   //! Returns True if the algorithm succeeded.
0072   Standard_EXPORT bool IsDone() const;
0073 
0074   //! Returns the number of solutions.
0075   //! Raises NotDone if the construction algorithm didn't succeed.
0076   Standard_EXPORT int NbSolutions() const;
0077 
0078   //! Returns the qualifier Qualif1 of the tangency argument
0079   //! for the solution of index Index computed by this algorithm.
0080   //! The returned qualifier is:
0081   //! -   that specified at the start of construction when the
0082   //! solutions are defined as enclosing or outside with
0083   //! respect to the argument, or
0084   //! -   that computed during construction (i.e. enclosing or
0085   //! outside) when the solutions are defined as unqualified
0086   //! with respect to the argument, or
0087   //! -   GccEnt_noqualifier if the tangency argument is a point.
0088   //! Exceptions
0089   //! Standard_OutOfRange if Index is less than zero or
0090   //! greater than the number of solutions computed by this algorithm.
0091   //! StdFail_NotDone if the construction fails.
0092   Standard_EXPORT void WhichQualifier(const int Index, GccEnt_Position& Qualif1) const;
0093 
0094   //! Returns the solution number Index and raises OutOfRange
0095   //! exception if Index is greater than the number of solutions.
0096   //! Be careful: the Index is only a way to get all the
0097   //! solutions, but is not associated to those outside the
0098   //! context of the algorithm-object.
0099   //! Raises NotDone if the construction algorithm
0100   //! didn't succeed.
0101   //! It raises OutOfRange if Index is greater than the
0102   //! number of solutions.
0103   Standard_EXPORT gp_Lin2d ThisSolution(const int Index) const;
0104 
0105   //! Returns information about the tangency point between the
0106   //! result number Index and the first argument.
0107   //! ParSol is the intrinsic parameter of the point on the
0108   //! solution curv.
0109   //! ParArg is the intrinsic parameter of the point on the
0110   //! argument curv.
0111   //! If the first argument is a point ParArg is equal zero.
0112   //! raises NotDone if the construction algorithm didn't succeed.
0113   //! It raises OutOfRange if Index is greater than the
0114   //! number of solutions.
0115   Standard_EXPORT void Tangency1(const int Index,
0116                                  double&   ParSol,
0117                                  double&   ParArg,
0118                                  gp_Pnt2d& Pnt) const;
0119 
0120   //! Returns information about the intersection between the
0121   //! solution number Index and the second argument.
0122   //! It returns the first intersection in a case of
0123   //! Lin2dTanPer which is perpendicular to a circle .
0124   //! ParSol is the intrinsic parameter of the point on the
0125   //! solution curv.
0126   //! ParArg is the intrinsic parameter of the point on the
0127   //! argument curv. Raises NotDone if the construction algorithm
0128   //! didn't succeed.
0129   //! It raises OutOfRange if Index is greater than the
0130   //! number of solutions.
0131   Standard_EXPORT void Intersection2(const int Index,
0132                                      double&   ParSol,
0133                                      double&   ParArg,
0134                                      gp_Pnt2d& PntSol) const;
0135 
0136 private:
0137   bool                                WellDone;
0138   int                                 NbrSol;
0139   NCollection_Array1<gp_Lin2d>        linsol;
0140   NCollection_Array1<GccEnt_Position> qualifier1;
0141   NCollection_Array1<gp_Pnt2d>        pnttg1sol;
0142   NCollection_Array1<gp_Pnt2d>        pntint2sol;
0143   NCollection_Array1<double>          par1sol;
0144   NCollection_Array1<double>          par2sol;
0145   NCollection_Array1<double>          pararg1;
0146   NCollection_Array1<double>          pararg2;
0147 };
0148 
0149 #endif // _GccAna_Lin2dTanPer_HeaderFile