summaryrefslogtreecommitdiff
path: root/src/Extrema/Extrema_FuncExtPC.cdl
blob: 751c1fe4c35def918e442427df4ccedbecdb3e22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
-- File:	FuncExtPC.cdl
-- Created:	Wed Jul 24 14:31:49 1991
-- Author:	Michel CHAUVAT
--		<mca@topsn3>
---Copyright:	 Matra Datavision 1991


private generic class FuncExtPC from Extrema 
(Curve    as any;
 Tool     as any;
 POnC     as any;
 Pnt      as any;
 Vec      as any)
						     
    inherits FunctionWithDerivative from math
    ---Purpose: Fonction permettant de rechercher les extrema de la 
    --          distance entre un point et une courbe.

uses    SequenceOfReal    from TColStd,
	SequenceOfInteger from TColStd
	
raises  OutOfRange   from Standard,
        TypeMismatch from Standard

private class SeqPC instantiates Sequence from TCollection(POnC);	


is

    Create returns FuncExtPC;

    Create (P: Pnt; C: Curve) returns FuncExtPC;
    	---Purpose: 

    Initialize(me: in out; C: Curve)
    	---Purpose: sets the field mycurve of the function.
    is static;
    
    SetPoint(me: in out; P: Pnt)
    	---Purpose: sets the field P of the function.
    is static;


    -- In all next methods, an exception is raised if the fields 
    -- were not initialized.

    Value (me: in out; U: Real; F: out Real) returns Boolean;
    	---Purpose: Calcul de F(U).

    Derivative (me: in out; U: Real; DF: out Real) returns Boolean;
    	---Purpose: Calcul de F'(U).

    Values (me: in out; U: Real; F,DF: out Real) returns Boolean;
    	---Purpose: Calcul de F(U) et F'(U).

    GetStateNumber (me: in out) returns Integer
    	---Purpose: Memorise l'extremum trouve.
    	is redefined;

    NbExt (me) returns Integer
    	---Purpose: Renvoie le nombre d'extrema trouves.
    raises TypeMismatch from Standard;

    SquareDistance (me; N: Integer) returns Real
    	---Purpose: Renvoie la Nieme distance.
    	raises  OutOfRange from Standard,
                TypeMismatch from Standard;
	    	-- si N < 1 ou N > NbExt(me).

    IsMin (me; N: Integer) returns Boolean
    	---Purpose: Indique si la Nieme distance est un minimum.
    	raises  OutOfRange from Standard,
                TypeMismatch from Standard;
	    	-- si N < 1 ou N > NbExt(me).

    Point (me; N: Integer) returns POnC
    	---Purpose: Renvoie le Nieme extremum.
    	raises  OutOfRange from Standard,
                TypeMismatch from Standard;
	    	-- si N < 1 ou N > NbExt(me).

fields
    myP    : Pnt;
    myC    : Address from Standard;

    myU    : Real;          -- valeur courante
    myPc   : Pnt;           -- point courant
    myD1f  : Real;          -- valeur de la derivee de la fonction

    mySqDist: SequenceOfReal    from TColStd;
    myIsMin: SequenceOfInteger from TColStd;
    myPoint: SeqPC;
    myPinit: Boolean;
    myCinit: Boolean;
    myD1Init: Boolean;

end FuncExtPC;