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