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_Circ2dTanOnRad_HeaderFile
18 #define _Geom2dGcc_Circ2dTanOnRad_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 Geom2dGcc_QualifiedCurve;
34 class Geom2dAdaptor_Curve;
36 class GccAna_Circ2dTanOnRad;
37 class Geom2dGcc_Circ2dTanOnRadGeo;
42 //! This class implements the algorithms used to
43 //! create a 2d circle tangent to a 2d entity,
44 //! centered on a 2d entity and with a given radius.
45 //! More than one argument must be a curve.
46 //! The arguments of all construction methods are :
47 //! - The qualified element for the tangency constrains
48 //! (QualifiedCirc, QualifiedLin, QualifiedCurvPoints).
49 //! - The Center element (circle, line, curve).
50 //! - A real Tolerance.
51 //! Tolerance is only used in the limits cases.
53 //! We want to create a circle tangent to an OutsideCurv Cu1
54 //! centered on a line OnLine with a radius Radius and with
55 //! a tolerance Tolerance.
56 //! If we did not used Tolerance it is impossible to
57 //! find a solution in the following case : OnLine is
58 //! outside Cu1. There is no intersection point between Cu1
59 //! and OnLine. The distance between the line and the
60 //! circle is greater than Radius.
61 //! With Tolerance we will give a solution if the
62 //! distance between Cu1 and OnLine is lower than or
64 class Geom2dGcc_Circ2dTanOnRad
71 //! Constructs one or more 2D circles of radius Radius,
72 //! centered on the 2D curve OnCurv and:
73 //! - tangential to the curve Qualified1
74 Standard_EXPORT Geom2dGcc_Circ2dTanOnRad(const Geom2dGcc_QualifiedCurve& Qualified1, const Geom2dAdaptor_Curve& OnCurv, const Standard_Real Radius, const Standard_Real Tolerance);
76 //! Constructs one or more 2D circles of radius Radius,
77 //! centered on the 2D curve OnCurv and:
78 //! passing through the point Point1.
79 //! OnCurv is an adapted curve, i.e. an object which is an
80 //! interface between:
81 //! - the services provided by a 2D curve from the package Geom2d,
82 //! - and those required on the curve by the construction algorithm.
83 //! Similarly, the qualified curve Qualified1 is created from
85 //! Adapted curves are created in the following way:
86 //! Handle(Geom2d_Curve) myCurveOn = ... ;
87 //! Geom2dAdaptor_Curve OnCurv ( myCurveOn ) ;
88 //! The algorithm is then constructed with this object:
89 //! Handle(Geom2d_Curve) myCurve1 = ...
91 //! Geom2dAdaptor_Curve Adapted1 ( myCurve1 ) ;
92 //! Geom2dGcc_QualifiedCurve
93 //! Qualified1 = Geom2dGcc::Outside(Adapted1);
94 //! Standard_Real Radius = ... , Tolerance = ... ;
95 //! Geom2dGcc_Circ2dTanOnRad
96 //! myAlgo ( Qualified1 , OnCurv , Radius , Tolerance ) ;
97 //! if ( myAlgo.IsDone() )
98 //! { Standard_Integer Nbr = myAlgo.NbSolutions() ;
100 //! for ( Standard_Integer i = 1 ;
102 //! { Circ = myAlgo.ThisSolution (i) ;
106 Standard_EXPORT Geom2dGcc_Circ2dTanOnRad(const Handle(Geom2d_Point)& Point1, const Geom2dAdaptor_Curve& OnCurv, const Standard_Real Radius, const Standard_Real Tolerance);
108 Standard_EXPORT void Results (const GccAna_Circ2dTanOnRad& Circ);
110 Standard_EXPORT void Results (const Geom2dGcc_Circ2dTanOnRadGeo& Circ);
112 //! Returns true if the construction algorithm does not fail
113 //! (even if it finds no solution).
114 //! Note: IsDone protects against a failure arising from a
115 //! more internal intersection algorithm which has reached
116 //! its numeric limits.
117 Standard_EXPORT Standard_Boolean IsDone() const;
119 //! Returns the number of circles, representing solutions
120 //! computed by this algorithm.
121 //! Exceptions: StdFail_NotDone if the construction fails.
122 Standard_EXPORT Standard_Integer NbSolutions() const;
124 //! Returns the solution number Index and raises OutOfRange
125 //! exception if Index is greater than the number of solutions.
126 //! Be careful: the Index is only a way to get all the
127 //! solutions, but is not associated to these outside the context
128 //! of the algorithm-object.
130 //! Standard_OutOfRange if Index is less than zero or
131 //! greater than the number of solutions computed by this algorithm.
132 //! StdFail_NotDone if the construction fails.
133 Standard_EXPORT gp_Circ2d ThisSolution (const Standard_Integer Index) const;
135 //! Returns the qualifier Qualif1 of the tangency argument
136 //! for the solution of index Index computed by this algorithm.
137 //! The returned qualifier is:
138 //! - that specified at the start of construction when the
139 //! solutions are defined as enclosed, enclosing or
140 //! outside with respect to the arguments, or
141 //! - that computed during construction (i.e. enclosed,
142 //! enclosing or outside) when the solutions are defined
143 //! as unqualified with respect to the arguments, or
144 //! - GccEnt_noqualifier if the tangency argument is a point.
146 //! Standard_OutOfRange if Index is less than zero or
147 //! greater than the number of solutions computed by this algorithm.
148 //! StdFail_NotDone if the construction fails.
149 Standard_EXPORT void WhichQualifier (const Standard_Integer Index, GccEnt_Position& Qualif1) const;
151 //! Returns information about the tangency point between the
152 //! result number Index and the first argument.
153 //! ParSol is the intrinsic parameter of the point on the solution curv.
154 //! ParArg is the intrinsic parameter of the point on the argument curv.
155 //! PntSol is the tangency point on the solution curv.
156 //! PntArg is the tangency point on the argument curv.
158 //! Standard_OutOfRange if Index is less than zero or
159 //! greater than the number of solutions computed by this algorithm.
160 //! StdFail_NotDone if the construction fails.
161 Standard_EXPORT void Tangency1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const;
163 //! Returns the center PntSol on the second argument (i.e.
164 //! line or circle) of the solution of index Index computed by
166 //! ParArg is the intrinsic parameter of the point on the argument curv.
167 //! PntSol is the center point of the solution curv.
168 //! PntArg is the projection of PntSol on the argument curv.
170 //! Standard_OutOfRange if Index is less than zero or
171 //! greater than the number of solutions computed by this algorithm.
172 //! StdFail_NotDone if the construction fails.
173 Standard_EXPORT void CenterOn3 (const Standard_Integer Index, Standard_Real& ParArg, gp_Pnt2d& PntSol) const;
175 //! Returns true if the solution of index Index and the first
176 //! argument of this algorithm are the same (i.e. there are 2
177 //! identical circles).
178 //! If Rarg is the radius of the first argument, Rsol is the
179 //! radius of the solution and dist is the distance between
180 //! the two centers, we consider the two circles to be
181 //! identical if |Rarg - Rsol| and dist are less than
182 //! or equal to the tolerance criterion given at the time of
183 //! construction of this algorithm.
184 //! OutOfRange is raised if Index is greater than the number of solutions.
185 //! notDone is raised if the construction algorithm did not succeed.
186 Standard_EXPORT Standard_Boolean IsTheSame1 (const Standard_Integer Index) const;
201 Standard_Boolean WellDone;
202 Standard_Integer NbrSol;
203 TColgp_Array1OfCirc2d cirsol;
204 GccEnt_Array1OfPosition qualifier1;
205 TColStd_Array1OfInteger TheSame1;
206 TColgp_Array1OfPnt2d pnttg1sol;
207 TColStd_Array1OfReal par1sol;
208 TColStd_Array1OfReal pararg1;
209 TColgp_Array1OfPnt2d pntcen3;
210 TColStd_Array1OfReal parcen3;
221 #endif // _Geom2dGcc_Circ2dTanOnRad_HeaderFile