42cf5bc1 |
1 | // Created on: 1991-03-18 |
2 | // Created by: Remi GILET |
3 | // Copyright (c) 1991-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 _GccAna_Circ2dTanCen_HeaderFile |
18 | #define _GccAna_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_NegativeValue; |
34 | class Standard_OutOfRange; |
35 | class StdFail_NotDone; |
36 | class GccEnt_BadQualifier; |
37 | class GccEnt_QualifiedCirc; |
38 | class gp_Pnt2d; |
39 | class gp_Lin2d; |
40 | class gp_Circ2d; |
41 | |
42 | |
43 | //! This class implements the algorithms used to |
44 | //! create 2d circles tangent to an entity and |
45 | //! centered on a point. |
46 | //! The arguments of all construction methods are : |
47 | //! - The qualified element for the tangency constrains |
48 | //! (QualifiedCirc, Line, Point). |
49 | //! - The center point Pcenter. |
50 | //! - A real Tolerance. |
51 | //! Tolerance is only used in the limits cases. |
52 | //! For example : |
53 | //! We want to create a circle tangent to an EnclosedCirc C1 |
54 | //! with a tolerance Tolerance. |
55 | //! If we did not used Tolerance it is impossible to |
56 | //! find a solution in the the following case : Pcenter is |
57 | //! outside C1. |
58 | //! With Tolerance we will give a solution if the distance |
59 | //! between C1 and Pcenter is lower than or equal Tolerance. |
60 | class GccAna_Circ2dTanCen |
61 | { |
62 | public: |
63 | |
64 | DEFINE_STANDARD_ALLOC |
65 | |
66 | |
67 | //! This method implements the algorithms used to |
68 | //! create 2d circles tangent to a circle and |
69 | //! centered on a point. |
70 | Standard_EXPORT GccAna_Circ2dTanCen(const GccEnt_QualifiedCirc& Qualified1, const gp_Pnt2d& Pcenter, const Standard_Real Tolerance); |
71 | |
72 | //! This method implements the algorithms used to |
73 | //! create 2d circles tangent to a line and |
74 | //! centered on a point. |
75 | Standard_EXPORT GccAna_Circ2dTanCen(const gp_Lin2d& Linetan, const gp_Pnt2d& Pcenter); |
76 | |
77 | //! This method implements the algorithms used to |
78 | //! create 2d circles passing thrue a point and |
79 | //! centered on a point. |
80 | //! Tolerance is a tolerance criterion used by the algorithm |
81 | //! to find a solution when, mathematically, the problem |
82 | //! posed does not have a solution, but where there is |
83 | //! numeric uncertainty attached to the arguments. |
84 | //! In these algorithms Tolerance is only used in very |
85 | //! specific cases where the center of the solution is very |
86 | //! close to the circle to which it is tangential, and where the |
87 | //! solution is therefore a very small circle. |
88 | //! Exceptions |
89 | //! GccEnt_BadQualifier if a qualifier is inconsistent with |
90 | //! the argument it qualifies (for example, enclosing for a line). |
91 | Standard_EXPORT GccAna_Circ2dTanCen(const gp_Pnt2d& Point1, const gp_Pnt2d& Pcenter); |
92 | |
93 | //! This method returns True if the construction |
94 | //! algorithm succeeded. |
95 | //! Note: IsDone protects against a failure arising from a |
96 | //! more internal intersection algorithm, which has reached |
97 | //! its numeric limits. |
98 | Standard_EXPORT Standard_Boolean IsDone() const; |
99 | |
100 | //! Returns the number of circles, representing solutions |
101 | //! computed by this algorithm and raises NotDone |
102 | //! exception if the algorithm didn't succeed. |
103 | Standard_EXPORT Standard_Integer NbSolutions() const; |
104 | |
105 | //! Returns the circle, representing the solution number Index and raises OutOfRange |
106 | //! exception if Index is greater than the number of solutions. |
107 | //! Be carefull: the Index is only a way to get all the |
108 | //! solutions, but is not associated to theses outside the |
109 | //! context of the algorithm-object. |
110 | //! Raises NotDone if the construction algorithm didn't succeed. |
111 | //! It raises OutOfRange if Index is greater than the |
112 | //! number of solutions or less than zer |
113 | Standard_EXPORT gp_Circ2d ThisSolution (const Standard_Integer Index) const; |
114 | |
115 | //! Returns the qualifier Qualif1 of the tangency argument |
116 | //! for the solution of index Index computed by this algorithm. |
117 | //! The returned qualifier is: |
118 | //! - that specified at the start of construction when the |
119 | //! solutions are defined as enclosed, enclosing or |
120 | //! It returns the real qualifiers (the qualifiers given to the |
121 | //! constructor method in case of enclosed, enclosing and outside |
122 | //! and the qualifiers computedin case of unqualified). |
123 | Standard_EXPORT void WhichQualifier (const Standard_Integer Index, GccEnt_Position& Qualif1) const; |
124 | |
125 | //! Returns informations about the tangency point between the |
126 | //! result number Index and the first argument. |
127 | //! ParSol is the intrinsic parameter of the point PntSol |
128 | //! on the solution curv. |
129 | //! ParArg is the intrinsic parameter of the point PntArg |
130 | //! on the argument curv. |
131 | //! It raises NotDone if the construction algorithm |
132 | //! didn't succeed. |
133 | //! It raises OutOfRange if Index is greater than the |
134 | //! number of solutions or less than zero. |
135 | Standard_EXPORT void Tangency1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; |
136 | |
137 | //! Returns True if the solution number Index is equal to |
138 | //! the first argument. |
139 | //! It raises NotDone if the construction algorithm |
140 | //! didn't succeed. |
141 | //! It raises OutOfRange if Index is greater than the |
142 | //! number of solutions or less than zero. |
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 // _GccAna_Circ2dTanCen_HeaderFile |