0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / Geom2dGcc / Geom2dGcc_Circ2dTanCen.hxx
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
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Geom2dGcc_Circ2dTanCen_HeaderFile
18 #define _Geom2dGcc_Circ2dTanCen_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 #include <TColgp_Array1OfCirc2d.hxx>
27 #include <GccEnt_Array1OfPosition.hxx>
28 #include <TColStd_Array1OfInteger.hxx>
29 #include <TColgp_Array1OfPnt2d.hxx>
30 #include <TColStd_Array1OfReal.hxx>
31 #include <Standard_Real.hxx>
32 #include <GccEnt_Position.hxx>
33 class Standard_OutOfRange;
34 class GccEnt_BadQualifier;
35 class StdFail_NotDone;
36 class Geom2dGcc_QualifiedCurve;
37 class Geom2d_Point;
38 class gp_Circ2d;
39 class gp_Pnt2d;
40
41
42 //! This class implements the algorithms used to
43 //! create 2d circles tangent to a curve and
44 //! centered on a point.
45 //! The arguments of all construction methods are :
46 //! - The qualified element for the tangency constrains
47 //! (QualifiedCurv).
48 //! -The center point Pcenter.
49 //! - A real Tolerance.
50 //! Tolerance is only used in the limits cases.
51 //! For example :
52 //! We want to create a circle tangent to an EnclosedCurv C1
53 //! with a tolerance Tolerance.
54 //! If we did not used Tolerance it is impossible to
55 //! find a solution in the the following case : Pcenter is
56 //! outside C1.
57 //! With Tolerance we will give a solution if the distance
58 //! between C1 and Pcenter is lower than or equal Tolerance/2.
59 class Geom2dGcc_Circ2dTanCen 
60 {
61 public:
62
63   DEFINE_STANDARD_ALLOC
64
65   
66   //! Constructs one or more 2D circles tangential to the
67   //! curve Qualified1 and centered on the point Pcenter.
68   //! Tolerance is a tolerance criterion used by the algorithm
69   //! to find a solution when, mathematically, the problem
70   //! posed does not have a solution, but where there is
71   //! numeric uncertainty attached to the arguments.
72   //! Tolerance is only used in these algorithms in very
73   //! specific cases where the center of the solution is very
74   //! close to the circle to which it is tangential, and where the
75   //! solution is thus a very small circle.
76   //! Exceptions
77   //! GccEnt_BadQualifier if a qualifier is inconsistent with
78   //! the argument it qualifies (for example, enclosing for a line).
79   Standard_EXPORT Geom2dGcc_Circ2dTanCen(const Geom2dGcc_QualifiedCurve& Qualified1, const Handle(Geom2d_Point)& Pcenter, const Standard_Real Tolerance);
80   
81   //! Returns true if the construction algorithm does not fail
82   //! (even if it finds no solution).
83   //! Note: IsDone protects against a failure arising from a
84   //! more internal intersection algorithm, which has reached
85   //! its numeric limits.
86   Standard_EXPORT Standard_Boolean IsDone() const;
87   
88   //! Returns the number of circles, representing solutions
89   //! computed by this algorithm.
90   //! Exceptions
91   //! StdFail_NotDone if the construction fails.
92   Standard_EXPORT Standard_Integer NbSolutions() const;
93   
94   //! Returns a circle, representing the solution of index
95   //! Index computed by this algorithm.
96   //! Warning
97   //! This indexing simply provides a means of consulting the
98   //! solutions. The index values are not associated with
99   //! these solutions outside the context of the algorithm object.
100   //! Exceptions
101   //! Standard_OutOfRange if Index is less than zero or
102   //! greater than the number of solutions computed by this algorithm.
103   //! StdFail_NotDone if the construction fails
104   Standard_EXPORT gp_Circ2d ThisSolution (const Standard_Integer Index) const;
105   
106   //! Returns the qualifier Qualif1 of the tangency argument
107   //! for the solution of index Index computed by this algorithm.
108   //! The returned qualifier is:
109   //! -   that specified at the start of construction when the
110   //! solutions are defined as enclosed, enclosing or
111   //! outside with respect to the argument, or
112   //! -   that computed during construction (i.e. enclosed,
113   //! enclosing or outside) when the solutions are defined
114   //! as unqualified with respect to the argument.
115   //! Exceptions
116   //! Standard_OutOfRange if Index is less than zero or
117   //! greater than the number of solutions computed by this algorithm.
118   //! StdFail_NotDone if the construction fails.
119   Standard_EXPORT void WhichQualifier (const Standard_Integer Index, GccEnt_Position& Qualif1) const;
120   
121   //! Returns informations about the tangency point between the
122   //! result number Index and the first argument.
123   //! ParSol is the intrinsic parameter of the point PntSol on the solution curv.
124   //! ParArg is the intrinsic parameter of the point PntSol on the argument curv.
125   //! Exceptions
126   //! Standard_OutOfRange if Index is less than zero or
127   //! greater than the number of solutions computed by this algorithm.
128   //! StdFail_NotDone if the construction fails.
129   Standard_EXPORT void Tangency1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const;
130   
131   //! Returns true if the solution of index Index and the first
132   //! argument of this algorithm are the same (i.e. there are 2
133   //! identical circles).
134   //! If Rarg is the radius of the first argument, Rsol is the
135   //! radius of the solution and dist is the distance between
136   //! the two centers, we consider the two circles to be
137   //! identical if |Rarg - Rsol| and dist are less than
138   //! or equal to the tolerance criterion given at the time of
139   //! construction of this algorithm.
140   //! NotDone is raised if the construction algorithm didn't succeed.
141   //! OutOfRange is raised if Index is greater than the
142   //! number of solutions.
143   Standard_EXPORT Standard_Boolean IsTheSame1 (const Standard_Integer Index) const;
144
145
146
147
148 protected:
149
150
151
152
153
154 private:
155
156
157
158   Standard_Boolean WellDone;
159   Standard_Integer NbrSol;
160   TColgp_Array1OfCirc2d cirsol;
161   GccEnt_Array1OfPosition qualifier1;
162   TColStd_Array1OfInteger TheSame1;
163   TColgp_Array1OfPnt2d pnttg1sol;
164   TColStd_Array1OfReal par1sol;
165   TColStd_Array1OfReal pararg1;
166
167
168 };
169
170
171
172
173
174
175
176 #endif // _Geom2dGcc_Circ2dTanCen_HeaderFile