| 1 | -- Created on: 1991-04-30 |
| 2 | -- Created by: Isabelle GRIGNON |
| 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 | generic class Int2S from IntImp |
| 18 | (ThePSurface as any; |
| 19 | ThePSurfaceTool as any) |
| 20 | |
| 21 | |
| 22 | ---Purpose: Determination of the intersection between 2 surfaces |
| 23 | -- from an point close to the solution. |
| 24 | |
| 25 | |
| 26 | uses Array1OfReal from TColStd, |
| 27 | ConstIsoparametric from IntImp, |
| 28 | PntOn2S from IntSurf, |
| 29 | Dir from gp, |
| 30 | Dir2d from gp, |
| 31 | FunctionSetRoot from math |
| 32 | |
| 33 | raises NotDone from StdFail, |
| 34 | DomainError from Standard, |
| 35 | ConstructionError from Standard, |
| 36 | UndefinedDerivative from StdFail |
| 37 | |
| 38 | |
| 39 | class TheFunction instantiates ZerParFunc from IntImp |
| 40 | (ThePSurface, ThePSurfaceTool); |
| 41 | |
| 42 | |
| 43 | is |
| 44 | |
| 45 | Create |
| 46 | ---Purpose: Raises Construction Error |
| 47 | |
| 48 | returns Int2S from IntImp; |
| 49 | |
| 50 | Create( Param: Array1OfReal from TColStd; |
| 51 | S1,S2: ThePSurface; |
| 52 | TolTangency: Real) |
| 53 | |
| 54 | ---Purpose: compute the solution point with the close point |
| 55 | |
| 56 | returns Int2S from IntImp; |
| 57 | |
| 58 | |
| 59 | Create( S1,S2: ThePSurface; |
| 60 | TolTangency: Real from Standard) |
| 61 | |
| 62 | ---Purpose: initialize the parameters to compute the solution point |
| 63 | -- it 's possible to write to optimize: |
| 64 | -- IntImp_Int2S inter(S1,S2,Func,TolTangency); |
| 65 | -- math_FunctionSetRoot rsnld(inter.Function()); |
| 66 | -- while ...{ |
| 67 | -- Param(1)=... |
| 68 | -- Param(2)=... |
| 69 | -- param(3)=... |
| 70 | -- inter.Perform(Param,rsnld); |
| 71 | -- } |
| 72 | |
| 73 | returns Int2S from IntImp; |
| 74 | |
| 75 | |
| 76 | Perform(me : in out; Param : Array1OfReal from TColStd; |
| 77 | Rsnld : in out FunctionSetRoot from math) |
| 78 | |
| 79 | ---Purpose: returns the best constant isoparametric to find |
| 80 | -- the next intersection's point +stores the solution |
| 81 | -- point (the solution point is found with the close point |
| 82 | -- to intersect the isoparametric with the other patch; |
| 83 | -- the choice of the isoparametic is calculated) |
| 84 | |
| 85 | returns ConstIsoparametric from IntImp |
| 86 | |
| 87 | is static; |
| 88 | |
| 89 | |
| 90 | Perform(me : in out; |
| 91 | Param : Array1OfReal from TColStd; |
| 92 | Rsnld : in out FunctionSetRoot from math; |
| 93 | ChoixIso : ConstIsoparametric from IntImp) |
| 94 | |
| 95 | ---Purpose: returns the best constant isoparametric to find |
| 96 | -- the next intersection's point +stores the solution |
| 97 | -- point (the solution point is found with the close point |
| 98 | -- to intersect the isoparametric with the other patch; |
| 99 | -- the choice of the isoparametic is given by ChoixIso) |
| 100 | |
| 101 | returns ConstIsoparametric from IntImp |
| 102 | |
| 103 | is static; |
| 104 | |
| 105 | |
| 106 | IsDone(me) |
| 107 | |
| 108 | ---Purpose: Returns TRUE if the creation completed without failure. |
| 109 | |
| 110 | returns Boolean from Standard |
| 111 | ---C++: inline |
| 112 | |
| 113 | is static; |
| 114 | |
| 115 | |
| 116 | IsEmpty(me) |
| 117 | |
| 118 | ---Purpose: Returns TRUE when there is no solution to the problem. |
| 119 | |
| 120 | returns Boolean from Standard |
| 121 | ---C++: inline |
| 122 | |
| 123 | raises NotDone from StdFail |
| 124 | is static; |
| 125 | |
| 126 | |
| 127 | Point(me) |
| 128 | |
| 129 | ---Purpose: Returns the intersection point. |
| 130 | |
| 131 | returns PntOn2S from IntSurf |
| 132 | ---C++: return const& |
| 133 | ---C++: inline |
| 134 | |
| 135 | raises NotDone from StdFail, |
| 136 | DomainError from Standard |
| 137 | -- The exception NotDone is raised if IsDone is false. |
| 138 | -- The exception DomainError is raised if IsEmpty is true. |
| 139 | |
| 140 | is static; |
| 141 | |
| 142 | |
| 143 | IsTangent(me) |
| 144 | |
| 145 | ---Purpose: Returns True if the surfaces are tangent at the |
| 146 | -- intersection point. |
| 147 | |
| 148 | returns Boolean from Standard |
| 149 | ---C++: inline |
| 150 | |
| 151 | raises NotDone from StdFail, |
| 152 | DomainError from Standard |
| 153 | -- The exception NotDone is raised if IsDone is false. |
| 154 | -- The exception DomainError is raised if IsEmpty is true. |
| 155 | |
| 156 | is static; |
| 157 | |
| 158 | |
| 159 | Direction(me) |
| 160 | |
| 161 | ---Purpose: Returns the tangent at the intersection line. |
| 162 | |
| 163 | returns Dir from gp |
| 164 | ---C++: return const& |
| 165 | ---C++: inline |
| 166 | |
| 167 | raises NotDone from StdFail, |
| 168 | DomainError from Standard, |
| 169 | UndefinedDerivative from StdFail |
| 170 | -- The exception NotDone is raised if IsDone is false. |
| 171 | -- The exception DomainError is raised if IsEmpty is true. |
| 172 | -- The exception UndefinedDerivative is raised if IsTangent |
| 173 | -- returns True. |
| 174 | |
| 175 | is static; |
| 176 | |
| 177 | |
| 178 | DirectionOnS1(me) |
| 179 | |
| 180 | ---Purpose: Returns the tangent at the intersection line in the |
| 181 | -- parametric space of the first surface. |
| 182 | |
| 183 | returns Dir2d from gp |
| 184 | ---C++: return const& |
| 185 | ---C++: inline |
| 186 | |
| 187 | raises NotDone from StdFail, |
| 188 | DomainError from Standard, |
| 189 | UndefinedDerivative from StdFail |
| 190 | -- The exception NotDone is raised if IsDone is false. |
| 191 | -- The exception DomainError is raised if IsEmpty is true. |
| 192 | -- The exception UndefinedDerivative is raised if IsTangent |
| 193 | -- returns True. |
| 194 | |
| 195 | is static; |
| 196 | |
| 197 | |
| 198 | DirectionOnS2(me) |
| 199 | |
| 200 | ---Purpose: Returns the tangent at the intersection line in the |
| 201 | -- parametric space of the second surface. |
| 202 | |
| 203 | returns Dir2d from gp |
| 204 | ---C++: return const& |
| 205 | ---C++: inline |
| 206 | |
| 207 | raises NotDone from StdFail, |
| 208 | DomainError from Standard, |
| 209 | UndefinedDerivative from StdFail |
| 210 | -- The exception NotDone is raised if IsDone is false. |
| 211 | -- The exception DomainError is raised if IsEmpty is true. |
| 212 | -- The exception UndefinedDerivative is raised if IsTangent |
| 213 | -- returns True. |
| 214 | |
| 215 | is static; |
| 216 | |
| 217 | |
| 218 | Function(me: in out) |
| 219 | ---Purpose: return the math function which |
| 220 | -- is used to compute the intersection |
| 221 | |
| 222 | returns TheFunction |
| 223 | ---C++: return & |
| 224 | ---C++: inline |
| 225 | |
| 226 | is static; |
| 227 | |
| 228 | ChangePoint(me: in out) |
| 229 | ---Purpose: return the intersection point which is |
| 230 | -- enable for changing. |
| 231 | |
| 232 | returns PntOn2S from IntSurf |
| 233 | ---C++: return & |
| 234 | ---C++: inline |
| 235 | |
| 236 | is static; |
| 237 | |
| 238 | |
| 239 | fields |
| 240 | |
| 241 | done : Boolean from Standard; |
| 242 | empty : Boolean from Standard; |
| 243 | pint : PntOn2S from IntSurf; |
| 244 | tangent : Boolean from Standard; |
| 245 | d3d : Dir from gp; |
| 246 | d2d1 : Dir2d from gp; |
| 247 | d2d2 : Dir2d from gp; |
| 248 | myZerParFunc : TheFunction; |
| 249 | tol : Real from Standard; |
| 250 | |
| 251 | ua0,va0,ua1,va1 : Real from Standard; -- surf1 |
| 252 | ub0,vb0,ub1,vb1 : Real from Standard; -- surf2 |
| 253 | ures1,ures2,vres1,vres2 : Real from Standard; -- U et V Resolution |
| 254 | |
| 255 | end Int2S; |