1 // Created on: 1991-03-22
2 // Created by: Remy GILET
3 // Copyright (c) 1991-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 _GccAna_Circ2d2TanOn_HeaderFile
18 #define _GccAna_Circ2d2TanOn_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_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 StdFail_NotDone;
35 class GccEnt_BadQualifier;
36 class GccEnt_QualifiedCirc;
38 class GccEnt_QualifiedLin;
43 //! Describes functions for building a 2D circle
44 //! - tangential to 2 curves, or
45 //! - tangential to a curve and passing through a point, or
46 //! - passing through 2 points,
47 //! and with its center on a curve. For these analytic
48 //! algorithms, curves are circles or lines.
49 //! A Circ2d2TanOn object provides a framework for:
50 //! - defining the construction of 2D circles(s),
51 //! - implementing the construction algorithm, and
52 //! - consulting the result(s).
53 class GccAna_Circ2d2TanOn
60 //! This method implements the algorithms used to
61 //! create 2d circles TANgent to two 2d circles and
62 //! having the center ON a 2d line.
63 Standard_EXPORT GccAna_Circ2d2TanOn(const GccEnt_QualifiedCirc& Qualified1, const GccEnt_QualifiedCirc& Qualified2, const gp_Lin2d& OnLine, const Standard_Real Tolerance);
65 //! This method implements the algorithms used to
66 //! create 2d circles TANgent to a 2d circle and a 2d line
67 //! having the center ON a 2d line.
68 Standard_EXPORT GccAna_Circ2d2TanOn(const GccEnt_QualifiedCirc& Qualified1, const GccEnt_QualifiedLin& Qualified2, const gp_Lin2d& OnLine, const Standard_Real Tolerance);
70 //! This method implements the algorithms used to
71 //! create 2d circles TANgent to two 2d lines
72 //! having the center ON a 2d line.
73 Standard_EXPORT GccAna_Circ2d2TanOn(const GccEnt_QualifiedLin& Qualified1, const GccEnt_QualifiedLin& Qualified2, const gp_Lin2d& OnLine, const Standard_Real Tolerance);
75 //! This method implements the algorithms used to
76 //! create 2d circles TANgent to a 2d circle and a point
77 //! having the center ON a 2d line.
78 Standard_EXPORT GccAna_Circ2d2TanOn(const GccEnt_QualifiedCirc& Qualified1, const gp_Pnt2d& Point2, const gp_Lin2d& OnLine, const Standard_Real Tolerance);
80 //! This method implements the algorithms used to
81 //! create 2d circles TANgent to a 2d line and a point
82 //! having the center ON a 2d line.
83 Standard_EXPORT GccAna_Circ2d2TanOn(const GccEnt_QualifiedLin& Qualified1, const gp_Pnt2d& Point2, const gp_Lin2d& OnLine, const Standard_Real Tolerance);
85 //! This method implements the algorithms used to
86 //! create 2d circles TANgent to two points
87 //! having the center ON a 2d line.
88 Standard_EXPORT GccAna_Circ2d2TanOn(const gp_Pnt2d& Point1, const gp_Pnt2d& Point2, const gp_Lin2d& OnLine, const Standard_Real Tolerance);
90 //! This method implements the algorithms used to
91 //! create 2d circles TANgent to two 2d circles and
92 //! having the center ON a 2d circle.
93 Standard_EXPORT GccAna_Circ2d2TanOn(const GccEnt_QualifiedCirc& Qualified1, const GccEnt_QualifiedCirc& Qualified2, const gp_Circ2d& OnCirc, const Standard_Real Tolerance);
95 //! This method implements the algorithms used to
96 //! create 2d circles TANgent to a circle and a line
97 //! having the center ON a 2d circle.
98 Standard_EXPORT GccAna_Circ2d2TanOn(const GccEnt_QualifiedCirc& Qualified1, const GccEnt_QualifiedLin& Qualified2, const gp_Circ2d& OnCirc, const Standard_Real Tolerance);
100 //! This method implements the algorithms used to
101 //! create 2d circles TANgent to a circle and a point
102 //! having the center ON a 2d circle.
103 Standard_EXPORT GccAna_Circ2d2TanOn(const GccEnt_QualifiedCirc& Qualified1, const gp_Pnt2d& Point2, const gp_Circ2d& OnCirc, const Standard_Real Tolerance);
105 //! This method implements the algorithms used to
106 //! create 2d circles TANgent to two 2d lines
107 //! having the center ON a 2d circle.
108 Standard_EXPORT GccAna_Circ2d2TanOn(const GccEnt_QualifiedLin& Qualified1, const GccEnt_QualifiedLin& Qualified2, const gp_Circ2d& OnCirc, const Standard_Real Tolerance);
110 //! This method implements the algorithms used to
111 //! create 2d circles TANgent to a line and a point
112 //! having the center ON a 2d circle.
113 Standard_EXPORT GccAna_Circ2d2TanOn(const GccEnt_QualifiedLin& Qualified1, const gp_Pnt2d& Point2, const gp_Circ2d& OnCirc, const Standard_Real Tolerance);
115 //! This method implements the algorithms used to create
116 //! 2d circles TANgent to two points having the center ON
118 Standard_EXPORT GccAna_Circ2d2TanOn(const gp_Pnt2d& Point1, const gp_Pnt2d& Point2, const gp_Circ2d& OnCirc, const Standard_Real Tolerance);
121 //! Returns true if the construction algorithm does not fail
122 //! (even if it finds no solution).
123 //! Note: IsDone protects against a failure arising from a
124 //! more internal intersection algorithm, which has reached its numeric limits.
125 Standard_EXPORT Standard_Boolean IsDone() const;
128 //! Returns the number of circles, representing solutions
129 //! computed by this algorithm.
131 //! StdFail_NotDone if the construction fails.
132 Standard_EXPORT Standard_Integer NbSolutions() const;
134 //! Returns the solution number Index and raises OutOfRange
135 //! exception if Index is greater than the number of solutions.
136 //! Be careful: the Index is only a way to get all the
137 //! solutions, but is not associated to those outside the context
138 //! of the algorithm-object.
140 //! Standard_OutOfRange if Index is less than zero or
141 //! greater than the number of solutions computed by this algorithm.
142 //! StdFail_NotDone if the construction fails.
143 Standard_EXPORT gp_Circ2d ThisSolution (const Standard_Integer Index) const;
145 //! Returns the qualifiers Qualif1 and Qualif2 of the
146 //! tangency arguments for the solution of index Index
147 //! computed by this algorithm.
148 //! The returned qualifiers are:
149 //! - those specified at the start of construction when the
150 //! solutions are defined as enclosed, enclosing or
151 //! outside with respect to the arguments, or
152 //! - those computed during construction (i.e. enclosed,
153 //! enclosing or outside) when the solutions are defined
154 //! as unqualified with respect to the arguments, or
155 //! - GccEnt_noqualifier if the tangency argument is a point.
157 //! Standard_OutOfRange if Index is less than zero or
158 //! greater than the number of solutions computed by this algorithm.
159 //! StdFail_NotDone if the construction fails.
160 Standard_EXPORT void WhichQualifier (const Standard_Integer Index, GccEnt_Position& Qualif1, GccEnt_Position& Qualif2) const;
162 //! Returns the informations about the tangency point between the
163 //! result number Index and the first argument.
164 //! ParSol is the intrinsic parameter of the point PntSol on
166 //! ParArg is the intrinsic parameter of the point PntSol on
167 //! the first argument. Raises OutOfRange if Index is greater than the number
168 //! of solutions and NotDone if IsDone returns false.
169 Standard_EXPORT void Tangency1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const;
171 //! Returns the informations about the tangency point between the
172 //! result number Index and the second argument.
173 //! ParSol is the intrinsic parameter of the point PntSol on
175 //! ParArg is the intrinsic parameter of the point PntSol on
176 //! the second argument. Raises OutOfRange if Index is greater than the number
177 //! of solutions and NotDone if IsDone returns false.
178 Standard_EXPORT void Tangency2 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const;
180 //! Returns the informations about the center (on the curv) of
181 //! the result number Index and the third argument.
182 //! ParArg is the intrinsic parameter of the point PntArg on
183 //! the third argument.
185 //! Standard_OutOfRange if Index is less than zero or
186 //! greater than the number of solutions computed by this algorithm.
187 //! StdFail_NotDone if the construction fails.
188 Standard_EXPORT void CenterOn3 (const Standard_Integer Index, Standard_Real& ParArg, gp_Pnt2d& PntArg) const;
190 //! True if the solution and the first argument are the same
192 //! If R1 is the radius of the first argument and Rsol the radius
193 //! of the solution and dist the distance between the two centers,
194 //! we concider the two circles are identical if R1+dist-Rsol is
195 //! less than Tolerance.
196 //! False in the other cases.
197 //! Raises OutOfRange if Index is greater than the number
198 //! of solutions and NotDone if IsDone returns false.
199 Standard_EXPORT Standard_Boolean IsTheSame1 (const Standard_Integer Index) const;
201 //! True if the solution and the second argument are the same
203 //! If R2 is the radius of the second argument and Rsol the radius
204 //! of the solution and dist the distance between the two centers,
205 //! we concider the two circles are identical if R2+dist-Rsol is
206 //! less than Tolerance.
207 //! False in the other cases.
208 //! Raises OutOfRange if Index is greater than the number
209 //! of solutions and NotDone if IsDone returns false.
210 Standard_EXPORT Standard_Boolean IsTheSame2 (const Standard_Integer Index) const;
225 Standard_Boolean WellDone;
226 Standard_Integer NbrSol;
227 TColgp_Array1OfCirc2d cirsol;
228 GccEnt_Array1OfPosition qualifier1;
229 GccEnt_Array1OfPosition qualifier2;
230 TColStd_Array1OfInteger TheSame1;
231 TColStd_Array1OfInteger TheSame2;
232 TColgp_Array1OfPnt2d pnttg1sol;
233 TColgp_Array1OfPnt2d pnttg2sol;
234 TColgp_Array1OfPnt2d pntcen;
235 TColStd_Array1OfReal par1sol;
236 TColStd_Array1OfReal par2sol;
237 TColStd_Array1OfReal pararg1;
238 TColStd_Array1OfReal pararg2;
239 TColStd_Array1OfReal parcen3;
250 #endif // _GccAna_Circ2d2TanOn_HeaderFile