1 -- Created on: 1995-07-18
2 -- Created by: Modelistation
3 -- Copyright (c) 1995-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 generic class GenExtCC from Extrema
19 Tool1 as any; -- as ToolCurve(Curve1)
21 Tool2 as any; -- as ToolCurve(Curve2)
22 ArrayOfPnt as Transient from Standard; -- as returned by Extrema_CurveCache::Points()
27 ---Purpose: It calculates all the distance between two curves.
28 -- These distances can be maximum or minimum.
29 uses SequenceOfReal from TColStd,
32 raises InfiniteSolutions from StdFail,
34 OutOfRange from Standard
38 Create returns GenExtCC;
39 ---Purpose: Calculates all the distances as above
40 -- between Uinf and Usup for C1 and between Vinf and Vsup
43 Create (C1: Curve1; C2: Curve2) returns GenExtCC;
44 ---Purpose: It calculates all the distances.
45 -- The function F(u,v)=distance(C1(u),C2(v)) has an
46 -- extremum when gradient(f)=0. The algorithm uses
47 -- Evtushenko's global optimization solver.
49 Create (C1: Curve1; C2: Curve2; Uinf, Usup, Vinf, Vsup: Real) returns GenExtCC;
50 ---Purpose: Calculates all the distances as above
51 -- between Uinf and Usup for C1 and between Vinf and Vsup
54 SetParams (me: in out; C1: Curve1; C2: Curve2; Uinf, Usup, Vinf, Vsup: Real)
55 ---Purpose: Set params in case of empty constructor is usage.
58 SetTolerance (me: in out; Tol: Real);
61 Perform (me: in out) is static;
62 ---Purpose: Performs calculations.
65 IsDone (me) returns Boolean
66 ---Purpose: Returns True if the distances are found.
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.
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.
84 -- if N < 1 or N > NbExt(me)
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.
95 -- if N < 1 or N > NbExt(me)
99 myCurveMinTol : Real from Standard;
100 myLowBorder : Vector from math;
101 myUppBorder : Vector from math;
102 myPoints1 : SequenceOfReal from TColStd;
103 myPoints2 : SequenceOfReal from TColStd;
104 myC : Address from Standard [2];