Commit | Line | Data |
---|---|---|

b311480e | 1 | -- Created on: 1991-03-18 |

2 | -- Created by: Remi GILET | |

3 | -- Copyright (c) 1991-1999 Matra Datavision | |

973c2be1 | 4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |

b311480e | 5 | -- |

973c2be1 | 6 | -- This file is part of Open CASCADE Technology software library. |

b311480e | 7 | -- |

973c2be1 | 8 | -- This library is free software; you can redistribute it and / or modify it |

9 | -- under the terms of the GNU Lesser General Public 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. | |

b311480e | 13 | -- |

973c2be1 | 14 | -- Alternatively, this file may be used under the terms of Open CASCADE |

15 | -- commercial license or contractual agreement. | |

7fd59977 | 16 | |

17 | class Circ2dTanCen | |

18 | ||

19 | from GccAna | |

20 | ||

21 | ---Purpose: This class implements the algorithms used to | |

22 | -- create 2d circles tangent to an entity and | |

23 | -- centered on a point. | |

24 | -- The arguments of all construction methods are : | |

25 | -- - The qualified element for the tangency constrains | |

26 | -- (QualifiedCirc, Line, Point). | |

27 | -- - The center point Pcenter. | |

28 | -- - A real Tolerance. | |

29 | -- Tolerance is only used in the limits cases. | |

30 | -- For example : | |

31 | -- We want to create a circle tangent to an EnclosedCirc C1 | |

32 | -- with a tolerance Tolerance. | |

33 | -- If we did not used Tolerance it is impossible to | |

34 | -- find a solution in the the following case : Pcenter is | |

35 | -- outside C1. | |

36 | -- With Tolerance we will give a solution if the distance | |

37 | -- between C1 and Pcenter is lower than or equal Tolerance. | |

38 | ||

39 | ||

40 | uses Pnt2d from gp, | |

41 | Lin2d from gp, | |

42 | Circ2d from gp, | |

43 | QualifiedCirc from GccEnt, | |

44 | Array1OfReal from TColStd, | |

45 | Array1OfInteger from TColStd, | |

46 | Array1OfCirc2d from TColgp, | |

47 | Array1OfPnt2d from TColgp, | |

48 | Position from GccEnt, | |

49 | Array1OfPosition from GccEnt | |

50 | ||

51 | raises NegativeValue from Standard, | |

52 | OutOfRange from Standard, | |

53 | NotDone from StdFail, | |

54 | BadQualifier from GccEnt | |

55 | ||

56 | is | |

57 | ||

58 | Create( Qualified1 : QualifiedCirc from GccEnt ; | |

59 | Pcenter : Pnt2d from gp ; | |

60 | Tolerance : Real from Standard) returns Circ2dTanCen | |

61 | ---Purpose: This method implements the algorithms used to | |

62 | -- create 2d circles tangent to a circle and | |

63 | -- centered on a point. | |

64 | raises BadQualifier from GccEnt; | |

65 | ||

66 | Create( Linetan : Lin2d from gp ; | |

67 | Pcenter : Pnt2d from gp ) returns Circ2dTanCen; | |

68 | ---Purpose: This method implements the algorithms used to | |

69 | -- create 2d circles tangent to a line and | |

70 | -- centered on a point. | |

71 | ||

72 | Create( Point1 : Pnt2d from gp ; | |

73 | Pcenter : Pnt2d from gp ) returns Circ2dTanCen; | |

74 | ---Purpose: This method implements the algorithms used to | |

75 | -- create 2d circles passing thrue a point and | |

76 | -- centered on a point. | |

77 | -- Tolerance is a tolerance criterion used by the algorithm | |

78 | -- to find a solution when, mathematically, the problem | |

79 | -- posed does not have a solution, but where there is | |

80 | -- numeric uncertainty attached to the arguments. | |

81 | -- In these algorithms Tolerance is only used in very | |

82 | -- specific cases where the center of the solution is very | |

83 | -- close to the circle to which it is tangential, and where the | |

84 | -- solution is therefore a very small circle. | |

85 | -- Exceptions | |

86 | -- GccEnt_BadQualifier if a qualifier is inconsistent with | |

87 | -- the argument it qualifies (for example, enclosing for a line). | |

88 | ||

89 | ||

90 | IsDone(me) returns Boolean from Standard | |

91 | is static; | |

92 | ---Purpose: This method returns True if the construction | |

93 | -- algorithm succeeded. | |

94 | -- Note: IsDone protects against a failure arising from a | |

95 | -- more internal intersection algorithm, which has reached | |

96 | -- its numeric limits. | |

97 | NbSolutions(me) returns Integer from Standard | |

98 | ---Purpose: Returns the number of circles, representing solutions | |

99 | -- computed by this algorithm and raises NotDone | |

100 | -- exception if the algorithm didn't succeed. | |

101 | raises NotDone | |

102 | is static; | |

103 | ||

104 | ThisSolution(me ; | |

105 | Index : Integer from Standard ) returns Circ2d from gp | |

106 | ---Purpose: Returns the circle, representing the solution number Index and raises OutOfRange | |

107 | -- exception if Index is greater than the number of solutions. | |

108 | -- Be carefull: the Index is only a way to get all the | |

109 | -- solutions, but is not associated to theses outside the | |

110 | -- context of the algorithm-object. | |

111 | -- Raises NotDone if the construction algorithm didn't succeed. | |

112 | -- It raises OutOfRange if Index is greater than the | |

113 | -- number of solutions or less than zer | |

114 | raises OutOfRange, NotDone | |

115 | is static; | |

116 | ||

117 | ||

118 | WhichQualifier(me ; | |

119 | Index : Integer from Standard; | |

120 | Qualif1 : out Position from GccEnt ) | |

121 | raises OutOfRange, NotDone | |

122 | is static; | |

123 | ---Purpose: Returns the qualifier Qualif1 of the tangency argument | |

124 | -- for the solution of index Index computed by this algorithm. | |

125 | -- The returned qualifier is: | |

126 | -- - that specified at the start of construction when the | |

127 | -- solutions are defined as enclosed, enclosing or | |

128 | -- It returns the real qualifiers (the qualifiers given to the | |

129 | -- constructor method in case of enclosed, enclosing and outside | |

130 | -- and the qualifiers computedin case of unqualified). | |

131 | ||

132 | Tangency1(me ; | |

133 | Index : Integer from Standard; | |

134 | ParSol : out Real from Standard; | |

135 | ParArg : out Real from Standard; | |

136 | PntSol : out Pnt2d from gp ) | |

137 | ---Purpose: Returns informations about the tangency point between the | |

138 | -- result number Index and the first argument. | |

139 | -- ParSol is the intrinsic parameter of the point PntSol | |

140 | -- on the solution curv. | |

141 | -- ParArg is the intrinsic parameter of the point PntArg | |

142 | -- on the argument curv. | |

143 | raises OutOfRange, NotDone | |

144 | is static; | |

145 | ---Purpose: It raises NotDone if the construction algorithm | |

146 | -- didn't succeed. | |

147 | -- It raises OutOfRange if Index is greater than the | |

148 | -- number of solutions or less than zero. | |

149 | ||

150 | IsTheSame1(me ; | |

151 | Index : Integer from Standard ) returns Boolean from Standard | |

152 | ---Purpose: Returns True if the solution number Index is equal to | |

153 | -- the first argument. | |

154 | raises OutOfRange, NotDone | |

155 | is static; | |

156 | ---Purpose: It raises NotDone if the construction algorithm | |

157 | -- didn't succeed. | |

158 | -- It raises OutOfRange if Index is greater than the | |

159 | -- number of solutions or less than zero. | |

160 | fields | |

161 | ||

162 | WellDone : Boolean from Standard; | |

163 | -- True if the algorithm succeeded. | |

164 | ||

165 | NbrSol : Integer from Standard; | |

166 | -- The number of possible solutions. We have to decide about the | |

167 | -- status of the multiple solutions... | |

168 | ||

169 | cirsol : Array1OfCirc2d from TColgp; | |

170 | ---Purpose : The solutions. | |

171 | ||

172 | qualifier1 : Array1OfPosition from GccEnt; | |

173 | -- The qualifiers of the first argument. | |

174 | ||

175 | TheSame1 : Array1OfInteger from TColStd; | |

176 | -- 1 if the solution and the first argument are the same (2 circles). | |

177 | -- if R1 is the radius of the first argument and Rsol the radius | |

178 | -- of the solution and dist the distance between the two centers, | |

179 | -- we concider the two circles are identical if R1+dist-Rsol is | |

180 | -- less than Tolerance. | |

181 | -- 0 in the other cases. | |

182 | ||

183 | pnttg1sol : Array1OfPnt2d from TColgp; | |

184 | -- The tangency point between the solution and the first argument on | |

185 | -- the solution. | |

186 | ||

187 | par1sol : Array1OfReal from TColStd; | |

188 | -- The parameter of the tangency point between the solution and the | |

189 | -- first argument on the solution. | |

190 | ||

191 | pararg1 : Array1OfReal from TColStd; | |

192 | -- The parameter of the tangency point between the solution and the first | |

193 | -- argument on the first argument. | |

194 | ||

195 | end Circ2dTanCen; | |

196 |