7fd59977 |
1 | -- File: Extrema_GLocateExtPC.cdl |
2 | -- Created: Tue Dec 14 16:24:56 1993 |
3 | -- Author: Christophe MARION |
4 | -- <cma@zerox> |
5 | ---Copyright: Matra Datavision 1993 |
6 | |
7 | |
8 | generic class GLocateExtPC from Extrema( |
9 | TheCurve as any; |
10 | TheCurveTool as any; |
11 | TheExtPElC as any; |
12 | ThePoint as any; |
13 | TheVector as any; |
14 | ThePOnC as any; |
15 | TheSequenceOfPOnC as any) |
16 | |
17 | ---Purpose: It calculates the distance between a point and a |
18 | -- curve with a close point. |
19 | -- This distance can be a minimum or a maximum. |
20 | |
21 | uses CurveType from GeomAbs |
22 | |
23 | |
24 | raises DomainError from Standard, |
25 | NotDone from StdFail |
26 | |
27 | class ELPC instantiates GExtPC from Extrema |
28 | (TheCurve, |
29 | TheCurveTool, |
30 | TheExtPElC, |
31 | ThePoint, |
32 | TheVector, |
33 | ThePOnC, |
34 | TheSequenceOfPOnC); |
35 | |
36 | |
37 | class LocEPC instantiates GenLocateExtPC from Extrema |
38 | (TheCurve, |
39 | TheCurveTool, |
40 | ThePOnC, |
41 | ThePoint, |
42 | TheVector); |
43 | |
44 | |
45 | is |
46 | |
47 | Create returns GLocateExtPC; |
48 | |
49 | Create (P: ThePoint; C: TheCurve; U0: Real; TolF: Real) |
50 | returns GLocateExtPC |
51 | ---Purpose: Calculates the distance with a close point. |
52 | -- The close point is defined by the parameter value |
53 | -- U0. |
54 | -- The function F(u)=distance(P,C(u)) has an extremum |
55 | -- when g(u)=dF/du=0. The algorithm searchs a zero |
56 | -- near the close point. |
57 | -- TolF is used to decide to stop the iterations. |
58 | -- At the nth iteration, the criteria is: |
59 | -- abs(Un - Un-1) < TolF. |
60 | raises DomainError; |
61 | -- if U0 is outside the definition range of the curve. |
62 | |
63 | |
64 | Create (P: ThePoint; C: TheCurve; U0: Real; Umin, Usup: Real; TolF: Real) |
65 | returns GLocateExtPC |
66 | ---Purpose: Calculates the distance with a close point. |
67 | -- The close point is defined by the parameter value |
68 | -- U0. |
69 | -- The function F(u)=distance(P,C(u)) has an extremum |
70 | -- when g(u)=dF/du=0. The algorithm searchs a zero |
71 | -- near the close point. |
72 | -- Zeros are searched between Umin et Usup. |
73 | -- TolF is used to decide to stop the iterations. |
74 | -- At the nth iteration, the criteria is: |
75 | -- abs(Un - Un-1) < TolF. |
76 | raises DomainError; |
77 | -- if U0 is outside the definition range of the curve. |
78 | |
79 | Initialize(me: in out; C: TheCurve; Umin, Usup: Real; TolF: Real) |
80 | ---Purpose: sets the fields of the algorithm. |
81 | is static; |
82 | |
83 | |
84 | Perform(me: in out; P: ThePoint; U0: Real) |
85 | ---Purpose: |
86 | |
87 | is static; |
88 | |
89 | |
90 | IsDone (me) returns Boolean |
91 | ---Purpose: Returns True if the distance is found. |
92 | is static; |
93 | |
94 | SquareDistance (me) returns Real |
95 | ---Purpose: Returns the value of the extremum square distance. |
96 | raises NotDone from StdFail |
97 | -- if IsDone(me)=False. |
98 | is static; |
99 | |
100 | IsMin (me) returns Boolean |
101 | ---Purpose: Returns True if the extremum distance is a minimum. |
102 | raises NotDone from StdFail |
103 | -- if IsDone(me)=False. |
104 | is static; |
105 | |
106 | Point (me) returns ThePOnC |
107 | ---Purpose: Returns the point of the extremum distance. |
108 | raises NotDone from StdFail |
109 | -- if IsDone(me)=False. |
110 | is static; |
111 | |
112 | |
113 | |
114 | fields |
115 | mypp: ThePOnC; |
116 | myC: Address from Standard; |
117 | mydist2: Real from Standard; |
118 | myismin: Boolean from Standard; |
119 | myDone : Boolean from Standard; |
120 | myumin: Real from Standard; |
121 | myusup: Real from Standard; |
122 | mytol: Real from Standard; |
123 | myLocExtPC: LocEPC from Extrema; |
124 | myExtremPC: ELPC from Extrema; |
125 | type: CurveType from GeomAbs; |
126 | numberext: Integer from Standard; |
127 | |
128 | end GLocateExtPC; |