1 // Created on: 1991-03-22 2 // Created by: Philippe DAUTRY 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_Circ2dTanOnRad_HeaderFile 18 #define _GccAna_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> 33 class GccEnt_QualifiedCirc; 34 class gp_Lin2d; 35 class GccEnt_QualifiedLin; 36 class gp_Pnt2d; 37 class gp_Circ2d; 38 39 40 //! This class implements the algorithms used to 41 //! create a 2d circle tangent to a 2d entity, 42 //! centered on a curv and with a given radius. 43 //! The arguments of all construction methods are : 44 //! - The qualified element for the tangency constrains 45 //! (QualifiedCirc, QualifiedLin, Points). 46 //! - The Center element (circle, line). 47 //! - A real Tolerance. 48 //! Tolerance is only used in the limits cases. 49 //! For example : 50 //! We want to create a circle tangent to an OutsideCirc C1 51 //! centered on a line OnLine with a radius Radius and with 52 //! a tolerance Tolerance. 53 //! If we did not use Tolerance it is impossible to 54 //! find a solution in the following case : OnLine is 55 //! outside C1. There is no intersection point between C1 56 //! and OnLine. The distance between the line and the 57 //! circle is greater than Radius. 58 //! With Tolerance we will give a solution if the 59 //! distance between C1 and OnLine is lower than or 60 //! equal Tolerance. 61 class GccAna_Circ2dTanOnRad 62 { 63 public: 64 65 DEFINE_STANDARD_ALLOC 66 67 68 //! This methods implements the algorithms used to create 69 //! 2d Circles tangent to a circle and centered on a 2d Line 70 //! with a given radius. 71 //! Tolerance is used to find solution in every limit cases. 72 //! For example Tolerance is used in the case of EnclosedCirc when 73 //! Radius-R1+dist is greater Tolerance (dist is the distance 74 //! between the line and the location of the circ, R1 is the 75 //! radius of the circ) because there is no solution. 76 //! raises NegativeValue in case of NegativeRadius. 77 Standard_EXPORT GccAna_Circ2dTanOnRad(const GccEnt_QualifiedCirc& Qualified1, const gp_Lin2d& OnLine, const Standard_Real Radius, const Standard_Real Tolerance); 78 79 //! This methods implements the algorithms used to create 80 //! 2d Circles tangent to a 2d Line and centered on a 2d Line 81 //! with a given radius. 82 //! Tolerance is used to find solution in every limit cases. 83 //! raises NegativeValue in case of NegativeRadius. 84 Standard_EXPORT GccAna_Circ2dTanOnRad(const GccEnt_QualifiedLin& Qualified1, const gp_Lin2d& OnLine, const Standard_Real Radius, const Standard_Real Tolerance); 85 86 //! This methods implements the algorithms used to create 87 //! 2d Circles passing through a 2d Point and centered on a 88 //! 2d Line with a given radius. 89 //! Tolerance is used to find solution in every limit cases. 90 Standard_EXPORT GccAna_Circ2dTanOnRad(const gp_Pnt2d& Point1, const gp_Lin2d& OnLine, const Standard_Real Radius, const Standard_Real Tolerance); 91 92 //! This methods implements the algorithms used to create 93 //! 2d Circles tangent to a circle and centered on a 2d Circle 94 //! with a given radius. 95 //! Tolerance is used to find solution in every limit cases. 96 //! raises NegativeValue in case of NegativeRadius. 97 Standard_EXPORT GccAna_Circ2dTanOnRad(const GccEnt_QualifiedCirc& Qualified1, const gp_Circ2d& OnCirc, const Standard_Real Radius, const Standard_Real Tolerance); 98 99 //! This methods implements the algorithms used to create 100 //! 2d Circles tangent to a 2d Line and centered on a 2d Line 101 //! with a given radius. 102 //! Tolerance is used to find solution in every limit cases. 103 //! raises NegativeValue in case of NegativeRadius. 104 Standard_EXPORT GccAna_Circ2dTanOnRad(const GccEnt_QualifiedLin& Qualified1, const gp_Circ2d& OnCirc, const Standard_Real Radius, const Standard_Real Tolerance); 105 106 //! This methods implements the algorithms used to create 107 //! 2d Circles passing through a 2d Point and centered on a 108 //! 2d Line with a given radius. 109 //! Tolerance is used to find solution in every limit cases. 110 //! raises NegativeValue in case of NegativeRadius. 111 Standard_EXPORT GccAna_Circ2dTanOnRad(const gp_Pnt2d& Point1, const gp_Circ2d& OnCirc, const Standard_Real Radius, const Standard_Real Tolerance); 112 113 //! Returns true if the construction algorithm does not fail 114 //! (even if it finds no solution). 115 //! Note: IsDone protects against a failure arising from a 116 //! more internal intersection algorithm, which has 117 //! reached its numeric limits. 118 Standard_EXPORT Standard_Boolean IsDone() const; 119 120 //! This method returns the number of circles, representing solutions. 121 //! Raises NotDone if the construction algorithm didn't succeed. 122 Standard_EXPORT Standard_Integer NbSolutions() const; 123 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 128 //! context of the algorithm-object. 129 //! Raises NotDone if the construction algorithm didn't succeed. 130 //! It raises OutOfRange if Index is greater than the 131 //! number of solutions 132 Standard_EXPORT gp_Circ2d ThisSolution (const Standard_Integer Index) const; 133 134 //! Returns the qualifier Qualif1 of the tangency argument 135 //! for the solution of index Index computed by this algorithm. 136 //! The returned qualifier is: 137 //! - that specified at the start of construction when the 138 //! solutions are defined as enclosed, enclosing or 139 //! outside with respect to the argument, or 140 //! - that computed during construction (i.e. enclosed, 141 //! enclosing or outside) when the solutions are defined 142 //! as unqualified with respect to the argument, or 143 //! - GccEnt_noqualifier if the tangency argument is a point. 144 //! Exceptions 145 //! Standard_OutOfRange if Index is less than zero or 146 //! greater than the number of solutions computed by this algorithm. 147 //! StdFail_NotDone if the construction fails. 148 Standard_EXPORT void WhichQualifier (const Standard_Integer Index, GccEnt_Position& Qualif1) const; 149 150 //! Returns information about the tangency point between the 151 //! result number Index and the first argument. 152 //! ParSol is the intrinsic parameter of the point on the 153 //! solution curv. 154 //! ParArg is the intrinsic parameter of the point on the 155 //! argument curv. 156 //! PntSol is the tangency point on the solution curv. 157 //! PntArg is the tangency point on the argument curv. 158 //! Raises NotDone if the construction algorithm didn't succeed. 159 //! It raises OutOfRange if Index is greater than the 160 //! number of solutions. 161 Standard_EXPORT void Tangency1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; 162 163 //! Returns information about the center (on the curv) 164 //! of the result. 165 //! ParArg is the intrinsic parameter of the point on 166 //! the argument curv. 167 //! PntSol is the center point of the solution curv. 168 //! Raises NotDone if the construction algorithm didn't succeed. 169 //! It raises OutOfRange if Index is greater than the 170 //! number of solutions. 171 Standard_EXPORT void CenterOn3 (const Standard_Integer Index, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; 172 173 //! Returns True if the solution number Index is equal to 174 //! the first argument and False in the other cases. 175 //! Raises NotDone if the construction algorithm didn't succeed. 176 //! It raises OutOfRange if Index is greater than the 177 //! number of solutions. 178 Standard_EXPORT Standard_Boolean IsTheSame1 (const Standard_Integer Index) const; 179 180 181 182 183 protected: 184 185 186 187 188 189 private: 190 191 192 193 Standard_Boolean WellDone; 194 Standard_Integer NbrSol; 195 TColgp_Array1OfCirc2d cirsol; 196 GccEnt_Array1OfPosition qualifier1; 197 TColStd_Array1OfInteger TheSame1; 198 TColgp_Array1OfPnt2d pnttg1sol; 199 TColgp_Array1OfPnt2d pntcen3; 200 TColStd_Array1OfReal par1sol; 201 TColStd_Array1OfReal pararg1; 202 TColStd_Array1OfReal parcen3; 203 204 205 }; 206 207 208 209 210 211 212 213 #endif // _GccAna_Circ2dTanOnRad_HeaderFile 214