1 -- File: Extrema_GenExtCC.cdl
2 -- Created: Tue Jul 18 17:41:35 1995
3 -- Author: Modelistation
5 ---Copyright: Matra Datavision 1995
9 generic class GenExtCC from Extrema
11 Tool1 as any; -- as ToolCurve(Curve1)
13 Tool2 as any; -- as ToolCurve(Curve2)
14 Cache as Transient from Standard; -- CurveCache from Extrema
15 ArrayOfPnt as Transient from Standard; -- as returned by Extrema_CurveCache::Points()
20 ---Purpose: It calculates all the distance between two curves.
21 -- These distances can be maximum or minimum.
23 raises InfiniteSolutions from StdFail,
25 OutOfRange from Standard
27 private class CCF instantiates FuncExtCC from Extrema (Curve1, Tool1,
33 Create returns GenExtCC;
34 ---Purpose: Calculates all the distances as above
35 -- between Uinf and Usup for C1 and between Vinf and Vsup
38 Create (C1: Curve1; C2: Curve2; NbU,NbV: Integer; TolU,TolV: Real) returns GenExtCC;
39 ---Purpose: It calculates all the distances.
40 -- The function F(u,v)=distance(C1(u),C2(v)) has an
41 -- extremum when gradient(f)=0. The algorithm searchs
43 -- NbU,NbV are used to locate the close points to
44 -- find the zeros. They must be great enough such that
45 -- if there is N extrema, there will be N extrema
46 -- between the segment and the grid.
47 -- TolU and TolV are used to determinethe conditions
48 -- to stop the iterations; at the iteration number n:
49 -- (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
51 Create (C1: Curve1; C2: Curve2; Uinf, Usup, Vinf, Vsup: Real;
52 NbU,NbV: Integer; TolU,TolV: Real) returns GenExtCC;
53 ---Purpose: Calculates all the distances as above
54 -- between Uinf and Usup for C1 and between Vinf and Vsup
57 SetCurveCache (me: in out; theRank: Integer; theCache: Cache);
60 SetTolerance (me: in out; Tol: Real);
63 Perform(me: in out) is static;
64 ---Purpose: Performs calculations.
67 IsDone (me) returns Boolean
68 ---Purpose: Returns True if the distances are found.
71 NbExt (me) returns Integer
72 ---Purpose: Returns the number of extremum distances.
73 raises NotDone from StdFail,
74 -- if IsDone(me)=False.
75 InfiniteSolutions from StdFail
76 -- if IsParallel(me)= True.
79 SquareDistance (me; N: Integer =1) returns Real
80 ---Purpose: Returns the value of the Nth square extremum distance.
81 raises NotDone from StdFail,
82 -- if IsDone(me)=False.
83 InfiniteSolutions from StdFail,
84 -- if IsParallel(me)= True and N > 1.
86 -- if N < 1 or N > NbExt(me)
89 Points (me; N: Integer; P1,P2: out POnC)
90 ---Purpose: Returns the points of the Nth extremum distance.
91 -- P1 is on the first curve, P2 on the second one.
92 raises NotDone from StdFail,
93 -- if IsDone(me)=False.
94 InfiniteSolutions from StdFail,
95 -- if IsParallel(me)= True.
97 -- if N < 1 or N > NbExt(me)
101 myF : CCF from Extrema;