b311480e |
1 | -- Created on: 1995-07-18 |
2 | -- Created by: Modelistation |
3 | -- Copyright (c) 1995-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | |
24 | generic class GenExtCC from Extrema |
25 | (Curve1 as any; |
26 | Tool1 as any; -- as ToolCurve(Curve1) |
27 | Curve2 as any; |
28 | Tool2 as any; -- as ToolCurve(Curve2) |
29 | Cache as Transient from Standard; -- CurveCache from Extrema |
30 | ArrayOfPnt as Transient from Standard; -- as returned by Extrema_CurveCache::Points() |
31 | POnC as any; |
32 | Pnt as any; |
33 | Vec as any) |
34 | |
35 | ---Purpose: It calculates all the distance between two curves. |
36 | -- These distances can be maximum or minimum. |
37 | |
38 | raises InfiniteSolutions from StdFail, |
39 | NotDone from StdFail, |
40 | OutOfRange from Standard |
41 | |
42 | private class CCF instantiates FuncExtCC from Extrema (Curve1, Tool1, |
43 | Curve2, Tool2, |
44 | POnC, Pnt, Vec); |
45 | |
46 | is |
47 | |
48 | Create returns GenExtCC; |
49 | ---Purpose: Calculates all the distances as above |
50 | -- between Uinf and Usup for C1 and between Vinf and Vsup |
51 | -- for C2. |
52 | |
53 | Create (C1: Curve1; C2: Curve2; NbU,NbV: Integer; TolU,TolV: Real) returns GenExtCC; |
54 | ---Purpose: It calculates all the distances. |
55 | -- The function F(u,v)=distance(C1(u),C2(v)) has an |
56 | -- extremum when gradient(f)=0. The algorithm searchs |
57 | -- all the zeros. |
58 | -- NbU,NbV are used to locate the close points to |
59 | -- find the zeros. They must be great enough such that |
60 | -- if there is N extrema, there will be N extrema |
61 | -- between the segment and the grid. |
62 | -- TolU and TolV are used to determinethe conditions |
63 | -- to stop the iterations; at the iteration number n: |
64 | -- (Un - Un-1) < TolU and (Vn - Vn-1) < TolV . |
65 | |
66 | Create (C1: Curve1; C2: Curve2; Uinf, Usup, Vinf, Vsup: Real; |
67 | NbU,NbV: Integer; TolU,TolV: Real) returns GenExtCC; |
68 | ---Purpose: Calculates all the distances as above |
69 | -- between Uinf and Usup for C1 and between Vinf and Vsup |
70 | -- for C2. |
71 | |
72 | SetCurveCache (me: in out; theRank: Integer; theCache: Cache); |
73 | ---Purpose: |
74 | |
75 | SetTolerance (me: in out; Tol: Real); |
76 | ---Purpose: |
77 | |
78 | Perform(me: in out) is static; |
79 | ---Purpose: Performs calculations. |
80 | |
81 | |
82 | IsDone (me) returns Boolean |
83 | ---Purpose: Returns True if the distances are found. |
84 | is static; |
85 | |
86 | NbExt (me) returns Integer |
87 | ---Purpose: Returns the number of extremum distances. |
88 | raises NotDone from StdFail, |
89 | -- if IsDone(me)=False. |
90 | InfiniteSolutions from StdFail |
91 | -- if IsParallel(me)= True. |
92 | is static; |
93 | |
94 | SquareDistance (me; N: Integer =1) returns Real |
95 | ---Purpose: Returns the value of the Nth square extremum distance. |
96 | raises NotDone from StdFail, |
97 | -- if IsDone(me)=False. |
98 | InfiniteSolutions from StdFail, |
99 | -- if IsParallel(me)= True and N > 1. |
100 | OutOfRange |
101 | -- if N < 1 or N > NbExt(me) |
102 | is static; |
103 | |
104 | Points (me; N: Integer; P1,P2: out POnC) |
105 | ---Purpose: Returns the points of the Nth extremum distance. |
106 | -- P1 is on the first curve, P2 on the second one. |
107 | raises NotDone from StdFail, |
108 | -- if IsDone(me)=False. |
109 | InfiniteSolutions from StdFail, |
110 | -- if IsParallel(me)= True. |
111 | OutOfRange |
112 | -- if N < 1 or N > NbExt(me) |
113 | is static; |
114 | |
115 | fields |
116 | myF : CCF from Extrema; |
117 | myDone : Boolean; |
118 | myCache: Cache [2]; |
119 | |
120 | end GenExtCC; |