1 -- File: Extrema_GenExtPC.cdl
2 -- Created: Tue Jul 18 17:38:32 1995
3 -- Author: Modelistation
5 ---Copyright: Matra Datavision 1995
8 generic class GenExtPC from Extrema (Curve as any;
9 Tool as any; --as ToolCurve(Curve)
14 ---Purpose: It calculates all the distances between a point
16 -- These distances can be minimum or maximum.
19 raises NotDone from StdFail,
20 OutOfRange from Standard,
21 TypeMismatch from Standard
23 private class PCF instantiates FuncExtPC from Extrema (Curve, Tool, POnC, Pnt, Vec);
27 Create returns GenExtPC;
30 Create (P: Pnt; C: Curve; NbU: Integer; TolU,TolF: Real)
32 ---Purpose: It calculates all the distances.
33 -- The function F(u)=distance(P,C(u)) has an extremum
34 -- when g(u)=dF/du=0. The algorithm searchs all the
35 -- zeros inside the definition range of the curve.
36 -- NbU is used to locate the close points to
38 -- Tol and TolU are used to decide to stop the
39 -- iterations according to the following condition:
40 -- if n is the number of iterations,
41 -- abs(Un-Un-1) < TolU and abs(F(Un)-F(Un-1)) < Tol.
44 Create (P: Pnt; C: Curve; NbU: Integer; Umin, Usup: Real; TolU,TolF: Real)
46 ---Purpose: It calculates all the distances.
47 -- The function F(u)=distance(P,C(u)) has an extremum
48 -- when g(u)=dF/du=0. The algorithm searchs all the
49 -- zeros inside the definition range of the curve.
50 -- NbU is used to locate the close points to
52 -- Zeros are searched between umin and usup.
53 -- Tol and TolU are used to decide to stop the
54 -- iterations according to the following condition:
55 -- if n is the number of iterations,
56 -- abs(Un-Un-1) < TolU and abs(F(Un)-F(Un-1)) < Tol.
60 Initialize(me: in out; C: Curve; NbU: Integer; TolU, TolF: Real)
61 ---Purpose: sets the fields of the algorithm.
65 Initialize(me: in out; C: Curve; NbU: Integer;
66 Umin, Usup: Real; TolU, TolF: Real)
67 ---Purpose: sets the fields of the algorithm.
70 Initialize(me: in out; C: Curve)
71 ---Purpose: sets the fields of the algorithm.
74 Initialize(me: in out; NbU: Integer; Umin, Usup: Real; TolU, TolF: Real)
75 ---Purpose: sets the fields of the algorithm.
79 Perform(me: in out; P: Pnt)
80 ---Purpose: the algorithm is done with the point P.
81 -- An exception is raised if the fields have not
83 raises TypeMismatch from Standard
87 IsDone (me) returns Boolean
88 ---Purpose: True if the distances are found.
89 raises TypeMismatch from Standard
92 NbExt (me) returns Integer
93 ---Purpose: Returns the number of extremum distances.
94 raises TypeMismatch from Standard,
96 -- if IsDone(me)=False.
99 SquareDistance (me; N: Integer) returns Real
100 ---Purpose: Returns the value of the Nth extremum square distance.
101 raises TypeMismatch from Standard,
102 NotDone from StdFail,
103 -- if IsDone(me)=False.
104 OutOfRange from Standard
105 -- if N < 1 or N > NbPoints(me).
109 IsMin (me; N: Integer) returns Boolean
110 ---Purpose: Returns True if the Nth extremum distance is a
112 raises TypeMismatch from Standard,
113 NotDone from StdFail,
114 -- if IsDone(me)=False.
115 OutOfRange from Standard
116 -- if N < 1 or N > NbPoints(me).
120 Point (me; N: Integer) returns POnC
121 ---Purpose: Returns the point of the Nth extremum distance.
122 raises TypeMismatch from Standard,
123 NotDone from StdFail,
124 -- if IsDone(me)=False.
125 OutOfRange from Standard
126 -- if N < 1 or N > NbPoints(me).