1 -- File: Extrema_GLocateExtPC.cdl
2 -- Created: Tue Dec 14 16:24:56 1993
3 -- Author: Christophe MARION
5 ---Copyright: Matra Datavision 1993
8 generic class GLocateExtPC from Extrema(
15 TheSequenceOfPOnC as any)
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.
21 uses CurveType from GeomAbs
24 raises DomainError from Standard,
27 class ELPC instantiates GExtPC from Extrema
37 class LocEPC instantiates GenLocateExtPC from Extrema
47 Create returns GLocateExtPC;
49 Create (P: ThePoint; C: TheCurve; U0: Real; TolF: Real)
51 ---Purpose: Calculates the distance with a close point.
52 -- The close point is defined by the parameter value
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.
61 -- if U0 is outside the definition range of the curve.
64 Create (P: ThePoint; C: TheCurve; U0: Real; Umin, Usup: Real; TolF: Real)
66 ---Purpose: Calculates the distance with a close point.
67 -- The close point is defined by the parameter value
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.
77 -- if U0 is outside the definition range of the curve.
79 Initialize(me: in out; C: TheCurve; Umin, Usup: Real; TolF: Real)
80 ---Purpose: sets the fields of the algorithm.
84 Perform(me: in out; P: ThePoint; U0: Real)
90 IsDone (me) returns Boolean
91 ---Purpose: Returns True if the distance is found.
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.
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.
106 Point (me) returns ThePOnC
107 ---Purpose: Returns the point of the extremum distance.
108 raises NotDone from StdFail
109 -- if IsDone(me)=False.
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;