b311480e |
1 | -- Created on: 1995-07-18 |
2 | -- Created by: Modelistation |
3 | -- Copyright (c) 1995-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 | -- |
d5f74e42 |
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 |
973c2be1 |
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 | generic class GenExtCC from Extrema |
18 | (Curve1 as any; |
19 | Tool1 as any; -- as ToolCurve(Curve1) |
20 | Curve2 as any; |
21 | Tool2 as any; -- as ToolCurve(Curve2) |
7fd59977 |
22 | ArrayOfPnt as Transient from Standard; -- as returned by Extrema_CurveCache::Points() |
23 | POnC as any; |
24 | Pnt as any; |
25 | Vec as any) |
26 | |
27 | ---Purpose: It calculates all the distance between two curves. |
28 | -- These distances can be maximum or minimum. |
4bbaf12b |
29 | uses SequenceOfReal from TColStd, |
30 | Vector from math |
31 | |
7fd59977 |
32 | raises InfiniteSolutions from StdFail, |
33 | NotDone from StdFail, |
34 | OutOfRange from Standard |
7fd59977 |
35 | |
36 | is |
37 | |
38 | Create returns GenExtCC; |
39 | ---Purpose: Calculates all the distances as above |
40 | -- between Uinf and Usup for C1 and between Vinf and Vsup |
41 | -- for C2. |
42 | |
4bbaf12b |
43 | Create (C1: Curve1; C2: Curve2) returns GenExtCC; |
7fd59977 |
44 | ---Purpose: It calculates all the distances. |
45 | -- The function F(u,v)=distance(C1(u),C2(v)) has an |
4bbaf12b |
46 | -- extremum when gradient(f)=0. The algorithm uses |
5493d334 |
47 | -- Evtushenko's global optimization solver. |
7fd59977 |
48 | |
4bbaf12b |
49 | Create (C1: Curve1; C2: Curve2; Uinf, Usup, Vinf, Vsup: Real) returns GenExtCC; |
7fd59977 |
50 | ---Purpose: Calculates all the distances as above |
51 | -- between Uinf and Usup for C1 and between Vinf and Vsup |
52 | -- for C2. |
53 | |
5493d334 |
54 | SetParams (me: in out; C1: Curve1; C2: Curve2; Uinf, Usup, Vinf, Vsup: Real) |
4bbaf12b |
55 | ---Purpose: Set params in case of empty constructor is usage. |
56 | is static; |
7fd59977 |
57 | |
5493d334 |
58 | SetTolerance (me: in out; Tol: Real); |
59 | ---Purpose: |
60 | |
61 | Perform (me: in out) is static; |
7fd59977 |
62 | ---Purpose: Performs calculations. |
63 | |
64 | |
65 | IsDone (me) returns Boolean |
66 | ---Purpose: Returns True if the distances are found. |
67 | is static; |
68 | |
69 | NbExt (me) returns Integer |
70 | ---Purpose: Returns the number of extremum distances. |
71 | raises NotDone from StdFail, |
72 | -- if IsDone(me)=False. |
73 | InfiniteSolutions from StdFail |
74 | -- if IsParallel(me)= True. |
75 | is static; |
76 | |
77 | SquareDistance (me; N: Integer =1) returns Real |
78 | ---Purpose: Returns the value of the Nth square extremum distance. |
79 | raises NotDone from StdFail, |
80 | -- if IsDone(me)=False. |
81 | InfiniteSolutions from StdFail, |
82 | -- if IsParallel(me)= True and N > 1. |
83 | OutOfRange |
84 | -- if N < 1 or N > NbExt(me) |
85 | is static; |
86 | |
87 | Points (me; N: Integer; P1,P2: out POnC) |
88 | ---Purpose: Returns the points of the Nth extremum distance. |
89 | -- P1 is on the first curve, P2 on the second one. |
90 | raises NotDone from StdFail, |
91 | -- if IsDone(me)=False. |
92 | InfiniteSolutions from StdFail, |
93 | -- if IsParallel(me)= True. |
94 | OutOfRange |
95 | -- if N < 1 or N > NbExt(me) |
96 | is static; |
97 | |
98 | fields |
5493d334 |
99 | myCurveMinTol : Real from Standard; |
100 | myLowBorder : Vector from math; |
101 | myUppBorder : Vector from math; |
5493d334 |
102 | myPoints1 : SequenceOfReal from TColStd; |
103 | myPoints2 : SequenceOfReal from TColStd; |
104 | myC : Address from Standard [2]; |
105 | myDone : Boolean; |
7fd59977 |
106 | |
107 | end GenExtCC; |