1 -- File: Extrema_GenLocateExtPC.cdl
2 -- Created: Tue Jul 18 17:40:06 1995
3 -- Author: Modelistation
5 ---Copyright: Matra Datavision 1995
9 generic class GenLocateExtPC from Extrema
11 Tool as any; -- as ToolCurve(Curve);
16 ---Purpose: It calculates the distance between a point and a
17 -- curve with a close point.
18 -- This distance can be a minimum or a maximum.
21 raises DomainError from Standard,
22 TypeMismatch from Standard,
25 private class PCLocF instantiates FuncExtPC (Curve, Tool, POnC, Pnt, Vec);
28 Create returns GenLocateExtPC;
30 Create (P: Pnt; C: Curve; U0: Real; TolU: Real)
31 returns GenLocateExtPC
32 ---Purpose: Calculates the distance with a close point.
33 -- The close point is defined by the parameter value
35 -- The function F(u)=distance(P,C(u)) has an extremum
36 -- when g(u)=dF/du=0. The algorithm searchs a zero
37 -- near the close point.
38 -- TolU is used to decide to stop the iterations.
39 -- At the nth iteration, the criteria is:
40 -- abs(Un - Un-1) < TolU.
42 -- if U0 is outside the definition range of the curve.
45 Create (P: Pnt; C: Curve; U0: Real; Umin, Usup: Real; TolU: Real)
46 returns GenLocateExtPC
47 ---Purpose: Calculates the distance with a close point.
48 -- The close point is defined by the parameter value
50 -- The function F(u)=distance(P,C(u)) has an extremum
51 -- when g(u)=dF/du=0. The algorithm searchs a zero
52 -- near the close point.
53 -- Zeros are searched between Umin et Usup.
54 -- TolU is used to decide to stop the iterations.
55 -- At the nth iteration, the criteria is:
56 -- abs(Un - Un-1) < TolU.
58 -- if U0 is outside the definition range of the curve.
62 Initialize(me: in out; C: Curve; Umin, Usup: Real; TolU: Real)
63 ---Purpose: sets the fields of the algorithm.
66 Perform(me: in out; P: Pnt; U0: Real)
67 ---Purpose: the algorithm is done with the point P.
68 -- An exception is raised if the fields have not
70 raises TypeMismatch from Standard
73 IsDone (me) returns Boolean
74 ---Purpose: Returns True if the distance is found.
77 SquareDistance (me) returns Real
78 ---Purpose: Returns the value of the extremum square distance.
79 raises NotDone from StdFail
80 -- if IsDone(me)=False.
83 IsMin (me) returns Boolean
84 ---Purpose: Returns True if the extremum distance is a minimum.
85 raises NotDone from StdFail
86 -- if IsDone(me)=False.
89 Point (me) returns POnC
90 ---Purpose: Returns the point of the extremum distance.
91 raises NotDone from StdFail
92 -- if IsDone(me)=False.