Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:34

0001 // Created on: 1992-10-20
0002 // Created by: Remi GILET
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Geom2dGcc_Circ2dTanOnRad_HeaderFile
0018 #define _Geom2dGcc_Circ2dTanOnRad_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Integer.hxx>
0025 #include <TColgp_Array1OfCirc2d.hxx>
0026 #include <GccEnt_Array1OfPosition.hxx>
0027 #include <TColStd_Array1OfInteger.hxx>
0028 #include <TColgp_Array1OfPnt2d.hxx>
0029 #include <TColStd_Array1OfReal.hxx>
0030 #include <GccEnt_Position.hxx>
0031 class Geom2dGcc_QualifiedCurve;
0032 class Geom2dAdaptor_Curve;
0033 class Geom2d_Point;
0034 class GccAna_Circ2dTanOnRad;
0035 class Geom2dGcc_Circ2dTanOnRadGeo;
0036 class gp_Circ2d;
0037 class gp_Pnt2d;
0038 
0039 
0040 //! This class implements the algorithms used to
0041 //! create a 2d circle tangent to a 2d entity,
0042 //! centered on a 2d entity and with a given radius.
0043 //! More than one argument must be a curve.
0044 //! The arguments of all construction methods are :
0045 //! - The qualified element for the tangency constrains
0046 //! (QualifiedCirc, QualifiedLin, QualifiedCurvPoints).
0047 //! - The Center element (circle, line, curve).
0048 //! - A real Tolerance.
0049 //! Tolerance is only used in the limits cases.
0050 //! For example :
0051 //! We want to create a circle tangent to an OutsideCurv Cu1
0052 //! centered on a line OnLine with a radius Radius and with
0053 //! a tolerance Tolerance.
0054 //! If we did not used Tolerance it is impossible to
0055 //! find a solution in the following case : OnLine is
0056 //! outside Cu1. There is no intersection point between Cu1
0057 //! and OnLine. The distance between the line and the
0058 //! circle is greater than Radius.
0059 //! With Tolerance we will give a solution if the
0060 //! distance between Cu1 and OnLine is lower than or
0061 //! equal Tolerance.
0062 class Geom2dGcc_Circ2dTanOnRad 
0063 {
0064 public:
0065 
0066   DEFINE_STANDARD_ALLOC
0067 
0068   
0069   //! Constructs one or more 2D circles of radius Radius,
0070   //! centered on the 2D curve OnCurv and:
0071   //! -   tangential to the curve Qualified1
0072   Standard_EXPORT Geom2dGcc_Circ2dTanOnRad(const Geom2dGcc_QualifiedCurve& Qualified1, const Geom2dAdaptor_Curve& OnCurv, const Standard_Real Radius, const Standard_Real Tolerance);
0073   
0074   //! Constructs one or more 2D circles of radius Radius,
0075   //! centered on the 2D curve OnCurv and:
0076   //! passing through the point Point1.
0077   //! OnCurv is an adapted curve, i.e. an object which is an
0078   //! interface between:
0079   //! -   the services provided by a 2D curve from the package Geom2d,
0080   //! -   and those required on the curve by the construction algorithm.
0081   //! Similarly, the qualified curve Qualified1 is created from
0082   //! an adapted curve.
0083   //! Adapted curves are created in the following way:
0084   //! Handle(Geom2d_Curve) myCurveOn = ... ;
0085   //! Geom2dAdaptor_Curve OnCurv ( myCurveOn ) ;
0086   //! The algorithm is then constructed with this object:
0087   //! Handle(Geom2d_Curve) myCurve1 = ...
0088   //! ;
0089   //! Geom2dAdaptor_Curve Adapted1 ( myCurve1 ) ;
0090   //! Geom2dGcc_QualifiedCurve
0091   //! Qualified1 = Geom2dGcc::Outside(Adapted1);
0092   //! Standard_Real Radius = ... , Tolerance = ... ;
0093   //! Geom2dGcc_Circ2dTanOnRad
0094   //! myAlgo ( Qualified1 , OnCurv , Radius , Tolerance ) ;
0095   //! if ( myAlgo.IsDone() )
0096   //! { Standard_Integer Nbr = myAlgo.NbSolutions() ;
0097   //! gp_Circ2d Circ ;
0098   //! for ( Standard_Integer i = 1 ;
0099   //! i <= nbr ; i++ )
0100   //! { Circ = myAlgo.ThisSolution (i) ;
0101   //! ...
0102   //! }
0103   //! }
0104   Standard_EXPORT Geom2dGcc_Circ2dTanOnRad(const Handle(Geom2d_Point)& Point1, const Geom2dAdaptor_Curve& OnCurv, const Standard_Real Radius, const Standard_Real Tolerance);
0105   
0106   Standard_EXPORT void Results (const GccAna_Circ2dTanOnRad& Circ);
0107   
0108   Standard_EXPORT void Results (const Geom2dGcc_Circ2dTanOnRadGeo& Circ);
0109   
0110   //! Returns true if the construction algorithm does not fail
0111   //! (even if it finds no solution).
0112   //! Note: IsDone protects against a failure arising from a
0113   //! more internal intersection algorithm which has reached
0114   //! its numeric limits.
0115   Standard_EXPORT Standard_Boolean IsDone() const;
0116   
0117   //! Returns the number of circles, representing solutions
0118   //! computed by this algorithm.
0119   //! Exceptions: StdFail_NotDone if the construction fails.
0120   Standard_EXPORT Standard_Integer NbSolutions() const;
0121   
0122   //! Returns the solution number Index and raises OutOfRange
0123   //! exception if Index is greater than the number of solutions.
0124   //! Be careful: the Index is only a way to get all the
0125   //! solutions, but is not associated to these outside the context
0126   //! of the algorithm-object.
0127   //! Exceptions
0128   //! Standard_OutOfRange if Index is less than zero or
0129   //! greater than the number of solutions computed by this algorithm.
0130   //! StdFail_NotDone if the construction fails.
0131   Standard_EXPORT gp_Circ2d ThisSolution (const Standard_Integer Index) const;
0132   
0133   //! Returns the qualifier Qualif1 of the tangency argument
0134   //! for the solution of index Index computed by this algorithm.
0135   //! The returned qualifier is:
0136   //! -   that specified at the start of construction when the
0137   //! solutions are defined as enclosed, enclosing or
0138   //! outside with respect to the arguments, or
0139   //! -   that computed during construction (i.e. enclosed,
0140   //! enclosing or outside) when the solutions are defined
0141   //! as unqualified with respect to the arguments, or
0142   //! -   GccEnt_noqualifier if the tangency argument is a point.
0143   //! Exceptions
0144   //! Standard_OutOfRange if Index is less than zero or
0145   //! greater than the number of solutions computed by this algorithm.
0146   //! StdFail_NotDone if the construction fails.
0147   Standard_EXPORT void WhichQualifier (const Standard_Integer Index, GccEnt_Position& Qualif1) const;
0148   
0149   //! Returns information about the tangency point between the
0150   //! result number Index and the first argument.
0151   //! ParSol is the intrinsic parameter of the point on the solution curv.
0152   //! ParArg is the intrinsic parameter of the point on the argument curv.
0153   //! PntSol is the tangency point on the solution curv.
0154   //! PntArg is the tangency point on the argument curv.
0155   //! Exceptions
0156   //! Standard_OutOfRange if Index is less than zero or
0157   //! greater than the number of solutions computed by this algorithm.
0158   //! StdFail_NotDone if the construction fails.
0159   Standard_EXPORT void Tangency1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const;
0160   
0161   //! Returns the center PntSol on the second argument (i.e.
0162   //! line or circle) of the solution of index Index computed by
0163   //! this algorithm.
0164   //! ParArg is the intrinsic parameter of the point on the argument curv.
0165   //! PntSol is the center point of the solution curv.
0166   //! PntArg is the projection of PntSol on the argument curv.
0167   //! Exceptions:
0168   //! Standard_OutOfRange if Index is less than zero or
0169   //! greater than the number of solutions computed by this algorithm.
0170   //! StdFail_NotDone if the construction fails.
0171   Standard_EXPORT void CenterOn3 (const Standard_Integer Index, Standard_Real& ParArg, gp_Pnt2d& PntSol) const;
0172   
0173   //! Returns true if the solution of index Index and the first
0174   //! argument of this algorithm are the same (i.e. there are 2
0175   //! identical circles).
0176   //! If Rarg is the radius of the first argument, Rsol is the
0177   //! radius of the solution and dist is the distance between
0178   //! the two centers, we consider the two circles to be
0179   //! identical if |Rarg - Rsol| and dist are less than
0180   //! or equal to the tolerance criterion given at the time of
0181   //! construction of this algorithm.
0182   //! OutOfRange is raised if Index is greater than the number of solutions.
0183   //! notDone is raised if the construction algorithm did not succeed.
0184   Standard_EXPORT Standard_Boolean IsTheSame1 (const Standard_Integer Index) const;
0185 
0186 
0187 
0188 
0189 protected:
0190 
0191 
0192 
0193 
0194 
0195 private:
0196 
0197 
0198 
0199   Standard_Boolean WellDone;
0200   Standard_Integer NbrSol;
0201   TColgp_Array1OfCirc2d cirsol;
0202   GccEnt_Array1OfPosition qualifier1;
0203   TColStd_Array1OfInteger TheSame1;
0204   TColgp_Array1OfPnt2d pnttg1sol;
0205   TColStd_Array1OfReal par1sol;
0206   TColStd_Array1OfReal pararg1;
0207   TColgp_Array1OfPnt2d pntcen3;
0208   TColStd_Array1OfReal parcen3;
0209 
0210 
0211 };
0212 
0213 
0214 
0215 
0216 
0217 
0218 
0219 #endif // _Geom2dGcc_Circ2dTanOnRad_HeaderFile