1 // Created on: 1992-10-20
2 // Created by: Remi GILET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Geom2dGcc_Lin2dTanObl_HeaderFile
18 #define _Geom2dGcc_Lin2dTanObl_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 #include <TColgp_Array1OfLin2d.hxx>
27 #include <GccEnt_Array1OfPosition.hxx>
28 #include <TColgp_Array1OfPnt2d.hxx>
29 #include <TColStd_Array1OfReal.hxx>
30 #include <Standard_Real.hxx>
31 #include <GccEnt_Position.hxx>
32 class GccEnt_BadQualifier;
33 class StdFail_NotDone;
34 class Geom2dGcc_IsParallel;
35 class Standard_OutOfRange;
36 class Geom2dGcc_QualifiedCurve;
39 class Geom2dGcc_Lin2dTanOblIter;
40 class Geom2dAdaptor_Curve;
43 //! This class implements the algorithms used to
44 //! create 2d line tangent to a curve QualifiedCurv and
45 //! doing an angle Angle with a line TheLin.
46 //! The angle must be in Radian.
47 //! Describes functions for building a 2D line making a given
48 //! angle with a line and tangential to a curve.
49 //! A Lin2dTanObl object provides a framework for:
50 //! - defining the construction of 2D line(s),
51 //! - implementing the construction algorithm, and
52 //! - consulting the result(s).
53 class Geom2dGcc_Lin2dTanObl
60 //! This class implements the algorithm used to
61 //! create 2d line tangent to a curve and doing an
62 //! angle Angle with the line TheLin.
63 //! Angle must be in Radian.
64 //! Tolang is the angular tolerance.
65 Standard_EXPORT Geom2dGcc_Lin2dTanObl(const Geom2dGcc_QualifiedCurve& Qualified1, const gp_Lin2d& TheLin, const Standard_Real TolAng, const Standard_Real Angle);
67 //! This class implements the algorithm used to
68 //! create 2d line tangent to a curve and doing an
69 //! angle Angle with the line TheLin.
70 //! Angle must be in Radian.
71 //! Param2 is the initial guess on the curve QualifiedCurv.
72 //! Tolang is the angular tolerance.
74 //! An iterative algorithm is used if Qualified1 is more
75 //! complex than a line or a circle. In such cases, the
76 //! algorithm constructs only one solution.
78 //! GccEnt_BadQualifier if a qualifier is inconsistent with
79 //! the argument it qualifies (for example, enclosed for a circle).
80 Standard_EXPORT Geom2dGcc_Lin2dTanObl(const Geom2dGcc_QualifiedCurve& Qualified1, const gp_Lin2d& TheLin, const Standard_Real TolAng, const Standard_Real Param1, const Standard_Real Angle);
82 //! Returns true if the construction algorithm does not fail
83 //! (even if it finds no solution).
84 //! Note: IsDone protects against a failure arising from a
85 //! more internal intersection algorithm, which has reached its numeric limits.
86 Standard_EXPORT Standard_Boolean IsDone() const;
88 //! Returns the number of lines, representing solutions computed by this algorithm.
90 //! StdFail_NotDone if the construction fails.
91 Standard_EXPORT Standard_Integer NbSolutions() const;
93 //! Returns a line, representing the solution of index Index
94 //! computed by this algorithm.
96 //! Standard_OutOfRange if Index is less than zero or
97 //! greater than the number of solutions computed by this algorithm.
98 //! StdFail_NotDone if the construction fails.
99 Standard_EXPORT gp_Lin2d ThisSolution (const Standard_Integer Index) const;
101 //! Returns the qualifier Qualif1 of the tangency argument
102 //! for the solution of index Index computed by this algorithm.
103 //! The returned qualifier is:
104 //! - that specified at the start of construction when the
105 //! solutions are defined as enclosing or outside with
106 //! respect to the argument, or
107 //! - that computed during construction (i.e. enclosing or
108 //! outside) when the solutions are defined as unqualified
109 //! with respect to the argument, or
110 //! - GccEnt_noqualifier if the tangency argument is a point.
112 //! Standard_OutOfRange if Index is less than zero or
113 //! greater than the number of solutions computed by this algorithm.
114 //! StdFail_NotDone if the construction fails.
115 Standard_EXPORT void WhichQualifier (const Standard_Integer Index, GccEnt_Position& Qualif1) const;
117 //! Returns informations about the tangency point between the
118 //! result and the first argument.
119 //! ParSol is the intrinsic parameter of the point PntSol on
120 //! the solution curv.
121 //! ParArg is the intrinsic parameter of the point PntSol on
122 //! the argument curv.
123 Standard_EXPORT void Tangency1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const;
125 //! Returns the point of intersection PntSol between the
126 //! solution of index Index and the second argument (the line) of this algorithm.
127 //! ParSol is the parameter of the point PntSol on the
128 //! solution. ParArg is the parameter of the point PntSol on the second argument (the line).
130 //! StdFail_NotDone if the construction fails.
131 //! Geom2dGcc_IsParallel if the solution and the second
132 //! argument (the line) are parallel.
133 //! Standard_OutOfRange if Index is less than zero or
134 //! greater than the number of solutions computed by this algorithm.
135 Standard_EXPORT void Intersection2 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const;
137 //! Returns true if the line and the solution are parallel. This
138 //! is the case when the angle given at the time of
139 //! construction is equal to 0 or Pi.
140 //! Exceptions StdFail_NotDone if the construction fails.
141 Standard_EXPORT Standard_Boolean IsParallel2() const;
155 Standard_EXPORT Standard_Boolean Add (const Standard_Integer theIndex, const Geom2dGcc_Lin2dTanOblIter& theLin, const Standard_Real theTol, const Geom2dAdaptor_Curve& theC1);
158 Standard_Boolean WellDone;
159 Standard_Boolean Paral2;
160 Standard_Integer NbrSol;
161 TColgp_Array1OfLin2d linsol;
162 GccEnt_Array1OfPosition qualifier1;
163 TColgp_Array1OfPnt2d pnttg1sol;
164 TColgp_Array1OfPnt2d pntint2sol;
165 TColStd_Array1OfReal par1sol;
166 TColStd_Array1OfReal par2sol;
167 TColStd_Array1OfReal pararg1;
168 TColStd_Array1OfReal pararg2;
179 #endif // _Geom2dGcc_Lin2dTanObl_HeaderFile