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_Lin2d2Tan_HeaderFile 18 #define _Geom2dGcc_Lin2d2Tan_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_Array1OfLin2d.hxx> 27 #include <GccEnt_Array1OfPosition.hxx> 28 #include <TColgp_Array1OfPnt2d.hxx> 29 #include <TColStd_Array1OfReal.hxx> 30 #include <Standard_Real.hxx> 31 #include <GccEnt_Position.hxx> 32 class StdFail_NotDone; 33 class GccEnt_BadQualifier; 34 class Standard_OutOfRange; 35 class Geom2dGcc_QualifiedCurve; 36 class gp_Pnt2d; 37 class gp_Lin2d; 38 class Geom2dGcc_Lin2d2TanIter; 39 class Geom2dAdaptor_Curve; 40 41 42 //! This class implements the algorithms used to 43 //! create 2d lines tangent to 2 other elements which 44 //! can be circles, curves or points. 45 //! More than one argument must be a curve. 46 //! Describes functions for building a 2D line: 47 //! - tangential to 2 curves, or 48 //! - tangential to a curve and passing through a point. 49 //! A Lin2d2Tan object provides a framework for: 50 //! - defining the construction of 2D line(s), 51 //! - implementing the construction algorithm, and 52 //! - consulting the result(s). 53 //! 54 //! Note: Some constructors may check the type of the qualified argument 55 //! and raise BadQualifier Error in case of incorrect couple (qualifier, curv). 56 class Geom2dGcc_Lin2d2Tan 57 { 58 public: 59 60 DEFINE_STANDARD_ALLOC 61 62 63 //! This class implements the algorithms used to create 2d 64 //! line tangent to two curves. 65 //! Tolang is used to determine the tolerance for the tangency points. 66 Standard_EXPORT Geom2dGcc_Lin2d2Tan(const Geom2dGcc_QualifiedCurve& Qualified1, const Geom2dGcc_QualifiedCurve& Qualified2, const Standard_Real Tolang); 67 68 //! This class implements the algorithms used to create 2d 69 //! lines passing thrue a point and tangent to a curve. 70 //! Tolang is used to determine the tolerance for the tangency points. 71 Standard_EXPORT Geom2dGcc_Lin2d2Tan(const Geom2dGcc_QualifiedCurve& Qualified1, const gp_Pnt2d& ThePoint, const Standard_Real Tolang); 72 73 //! This class implements the algorithms used to create 2d 74 //! line tangent to two curves. 75 //! Tolang is used to determine the tolerance for the tangency points. 76 //! Param1 is used for the initial guess on the first curve. 77 //! Param2 is used for the initial guess on the second curve. 78 Standard_EXPORT Geom2dGcc_Lin2d2Tan(const Geom2dGcc_QualifiedCurve& Qualified1, const Geom2dGcc_QualifiedCurve& Qualified2, const Standard_Real Tolang, const Standard_Real Param1, const Standard_Real Param2); 79 80 //! This class implements the algorithms used to create 2d 81 //! lines passing thrue a point and tangent to a curve. 82 //! Tolang is used to determine the tolerance for the tangency points. 83 //! Param2 is used for the initial guess on the curve. 84 Standard_EXPORT Geom2dGcc_Lin2d2Tan(const Geom2dGcc_QualifiedCurve& Qualified1, const gp_Pnt2d& ThePoint, const Standard_Real Tolang, const Standard_Real Param1); 85 86 //! Returns true if the construction algorithm does not fail 87 //! (even if it finds no solution). 88 //! Note: IsDone protects against a failure arising from a 89 //! more internal intersection algorithm, which has 90 //! reached its numeric limits. 91 Standard_EXPORT Standard_Boolean IsDone() const; 92 93 //! Returns the number of lines, representing solutions computed by this algorithm. 94 //! Exceptions StdFail_NotDone if the construction fails.R 95 Standard_EXPORT Standard_Integer NbSolutions() const; 96 97 //! Returns a line, representing the solution of index Index computed by this algorithm. 98 //! Warning 99 //! This indexing simply provides a means of consulting the 100 //! solutions. The index values are not associated with 101 //! these solutions outside the context of the algorithm object. 102 //! Exceptions 103 //! Standard_OutOfRange if Index is less than zero or 104 //! greater than the number of solutions computed by this algorithm. 105 //! StdFail_NotDone if the construction fails. 106 Standard_EXPORT gp_Lin2d ThisSolution (const Standard_Integer Index) const; 107 108 //! Returns the qualifiers Qualif1 and Qualif2 of the 109 //! tangency arguments for the solution of index Index 110 //! computed by this algorithm. 111 //! The returned qualifiers are: 112 //! - those specified at the start of construction when the 113 //! solutions are defined as enclosing or outside with 114 //! respect to the arguments, or 115 //! - those computed during construction (i.e. enclosing or 116 //! outside) when the solutions are defined as unqualified 117 //! with respect to the arguments, or 118 //! - GccEnt_noqualifier if the tangency argument is a point. 119 //! Exceptions 120 //! Standard_OutOfRange if Index is less than zero or 121 //! greater than the number of solutions computed by this algorithm. 122 //! StdFail_NotDone if the construction fails. 123 Standard_EXPORT void WhichQualifier (const Standard_Integer Index, GccEnt_Position& Qualif1, GccEnt_Position& Qualif2) const; 124 125 //! Returns informations about the tangency point between the 126 //! result and the first argument. 127 //! ParSol is the intrinsic parameter of the point PntSol on 128 //! the solution curv. 129 //! ParArg is the intrinsic parameter of the point PntSol on the argument curv. 130 //! Exceptions 131 //! Standard_OutOfRange if Index is less than zero or 132 //! greater than the number of solutions computed by this algorithm. 133 //! StdFail_NotDone if the construction fails. 134 Standard_EXPORT void Tangency1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; 135 136 //! Returns informations about the tangency point between the 137 //! result and the first argument. 138 //! ParSol is the intrinsic parameter of the point PntSol on the solution curv. 139 //! ParArg is the intrinsic parameter of the point PntSol on the argument curv. 140 //! Exceptions 141 //! Standard_OutOfRange if Index is less than zero or 142 //! greater than the number of solutions computed by this algorithm. 143 //! StdFail_NotDone if the construction fails. 144 Standard_EXPORT void Tangency2 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; 145 146 147 148 149 protected: 150 151 152 153 154 155 private: 156 157 158 Standard_EXPORT Standard_Boolean Add (const Standard_Integer theIndex, const Geom2dGcc_Lin2d2TanIter& theLin, const Standard_Real theTol, const Geom2dAdaptor_Curve& theC1, const Geom2dAdaptor_Curve& theC2); 159 160 161 Standard_Boolean WellDone; 162 Standard_Integer NbrSol; 163 TColgp_Array1OfLin2d linsol; 164 GccEnt_Array1OfPosition qualifier1; 165 GccEnt_Array1OfPosition qualifier2; 166 TColgp_Array1OfPnt2d pnttg1sol; 167 TColgp_Array1OfPnt2d pnttg2sol; 168 TColStd_Array1OfReal par1sol; 169 TColStd_Array1OfReal par2sol; 170 TColStd_Array1OfReal pararg1; 171 TColStd_Array1OfReal pararg2; 172 173 174 }; 175 176 177 178 179 180 181 182 #endif // _Geom2dGcc_Lin2d2Tan_HeaderFile 183