Commit | Line | Data |
---|---|---|
7fd59977 | 1 | -- File: FuncExtPC.cdl |
2 | -- Created: Wed Jul 24 14:31:49 1991 | |
3 | -- Author: Michel CHAUVAT | |
4 | -- <mca@topsn3> | |
5 | ---Copyright: Matra Datavision 1991 | |
6 | ||
7 | ||
8 | private generic class FuncExtPC from Extrema | |
9 | (Curve as any; | |
10 | Tool as any; | |
11 | POnC as any; | |
12 | Pnt as any; | |
13 | Vec as any) | |
14 | ||
15 | inherits FunctionWithDerivative from math | |
0d969553 Y |
16 | --- Purpose: Function to find extrema of the distance between a |
17 | --- point and a curve. | |
7fd59977 | 18 | |
19 | uses SequenceOfReal from TColStd, | |
20 | SequenceOfInteger from TColStd | |
21 | ||
22 | raises OutOfRange from Standard, | |
23 | TypeMismatch from Standard | |
24 | ||
25 | private class SeqPC instantiates Sequence from TCollection(POnC); | |
26 | ||
27 | ||
28 | is | |
29 | ||
30 | Create returns FuncExtPC; | |
31 | ||
32 | Create (P: Pnt; C: Curve) returns FuncExtPC; | |
33 | ---Purpose: | |
34 | ||
35 | Initialize(me: in out; C: Curve) | |
36 | ---Purpose: sets the field mycurve of the function. | |
37 | is static; | |
38 | ||
39 | SetPoint(me: in out; P: Pnt) | |
40 | ---Purpose: sets the field P of the function. | |
41 | is static; | |
42 | ||
43 | ||
44 | -- In all next methods, an exception is raised if the fields | |
45 | -- were not initialized. | |
46 | ||
47 | Value (me: in out; U: Real; F: out Real) returns Boolean; | |
0d969553 | 48 | ---Purpose: Calculation of F(U). |
7fd59977 | 49 | |
50 | Derivative (me: in out; U: Real; DF: out Real) returns Boolean; | |
0d969553 | 51 | ---Purpose: Calculation of F'(U). |
7fd59977 | 52 | |
53 | Values (me: in out; U: Real; F,DF: out Real) returns Boolean; | |
0d969553 | 54 | ---Purpose: Calculation of F(U) and F'(U). |
7fd59977 | 55 | |
56 | GetStateNumber (me: in out) returns Integer | |
0d969553 | 57 | ---Purpose: Save the found extremum. |
7fd59977 | 58 | is redefined; |
59 | ||
60 | NbExt (me) returns Integer | |
0d969553 | 61 | ---Purpose: Return the nunber of found extrema. |
7fd59977 | 62 | raises TypeMismatch from Standard; |
63 | ||
64 | SquareDistance (me; N: Integer) returns Real | |
0d969553 | 65 | ---Purpose: Returns the Nth distance. |
7fd59977 | 66 | raises OutOfRange from Standard, |
67 | TypeMismatch from Standard; | |
0d969553 | 68 | -- if N < 1 or N > NbExt(me). |
7fd59977 | 69 | |
70 | IsMin (me; N: Integer) returns Boolean | |
0d969553 | 71 | ---Purpose: Shows if the Nth distance is a minimum. |
7fd59977 | 72 | raises OutOfRange from Standard, |
73 | TypeMismatch from Standard; | |
0d969553 | 74 | -- if N < 1 or N > NbExt(me). |
7fd59977 | 75 | |
76 | Point (me; N: Integer) returns POnC | |
0d969553 | 77 | ---Purpose: Returns the Nth extremum. |
7fd59977 | 78 | raises OutOfRange from Standard, |
79 | TypeMismatch from Standard; | |
0d969553 | 80 | -- if N < 1 or N > NbExt(me). |
7fd59977 | 81 | |
82 | fields | |
83 | myP : Pnt; | |
84 | myC : Address from Standard; | |
85 | ||
0d969553 Y |
86 | myU : Real; -- current |
87 | myPc : Pnt; -- current point | |
88 | myD1f : Real; -- value of derivative of the function | |
7fd59977 | 89 | |
90 | mySqDist: SequenceOfReal from TColStd; | |
91 | myIsMin: SequenceOfInteger from TColStd; | |
92 | myPoint: SeqPC; | |
93 | myPinit: Boolean; | |
94 | myCinit: Boolean; | |
95 | myD1Init: Boolean; | |
96 | ||
97 | end FuncExtPC; |