0023706: Cannot project point on curve
[occt.git] / src / Extrema / Extrema_FuncExtPC.cdl
1 -- Created on: 1991-07-24
2 -- Created by: Michel CHAUVAT
3 -- Copyright (c) 1991-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
5 --
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
10 --
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 --
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
20
21
22
23 private generic class FuncExtPC from Extrema 
24 (Curve    as any;
25  Tool     as any;
26  POnC     as any;
27  Pnt      as any;
28  Vec      as any)
29                                                      
30     inherits FunctionWithDerivative from math
31     --- Purpose: Function to find extrema of the distance between a
32     --- point and a curve.
33
34 uses    SequenceOfReal    from TColStd,
35         SequenceOfInteger from TColStd
36         
37 raises  OutOfRange   from Standard,
38         TypeMismatch from Standard
39
40 private class SeqPC instantiates Sequence from TCollection(POnC);       
41
42
43 is
44
45     Create returns FuncExtPC;
46
47     Create (P: Pnt; C: Curve) returns FuncExtPC;
48         ---Purpose: 
49
50     Initialize(me: in out; C: Curve)
51         ---Purpose: sets the field mycurve of the function.
52     is static;
53     
54     SetPoint(me: in out; P: Pnt)
55         ---Purpose: sets the field P of the function.
56     is static;
57
58
59     -- In all next methods, an exception is raised if the fields 
60     -- were not initialized.
61
62     Value (me: in out; U: Real; F: out Real) returns Boolean;
63         ---Purpose: Calculation of F(U).
64
65     Derivative (me: in out; U: Real; DF: out Real) returns Boolean;
66         ---Purpose: Calculation of F'(U).
67
68     Values (me: in out; U: Real; F,DF: out Real) returns Boolean;
69         ---Purpose: Calculation of F(U) and F'(U).
70
71     GetStateNumber (me: in out) returns Integer
72         ---Purpose: Save the found extremum.
73         is redefined;
74
75     NbExt (me) returns Integer
76         ---Purpose: Return the nunber of found extrema.
77     raises TypeMismatch from Standard;
78
79     SquareDistance (me; N: Integer) returns Real
80         ---Purpose: Returns the Nth distance.
81         raises  OutOfRange from Standard,
82                 TypeMismatch from Standard;
83                 -- if N < 1 or N > NbExt(me).
84
85     IsMin (me; N: Integer) returns Boolean
86         ---Purpose: Shows if the Nth distance is a minimum.
87         raises  OutOfRange from Standard,
88                 TypeMismatch from Standard;
89                 -- if N < 1 or N > NbExt(me).
90
91     Point (me; N: Integer) returns POnC
92         ---Purpose: Returns the Nth extremum.
93         raises  OutOfRange from Standard,
94                 TypeMismatch from Standard;
95                 -- if N < 1 or N > NbExt(me).
96
97     SubIntervalInitialize(me: in out; theUfirst, theUlast: Real from Standard);
98         ---Purpose: Determines boundaries of subinterval for find of root.
99     
100     SearchOfTolerance(me: in out) returns Real from Standard;
101         ---Purpose: Computes a Tol value. If 1st derivative of curve
102         --          |D1|<Tol, it is considered D1=0.      
103     
104
105 fields
106     myP    : Pnt;
107     myC    : Address from Standard;
108
109     myU    : Real;          -- current
110     myPc   : Pnt;           -- current point 
111     myD1f  : Real;          -- value of derivative of the function
112
113     mySqDist: SequenceOfReal    from TColStd;
114     myIsMin: SequenceOfInteger from TColStd;
115     myPoint: SeqPC;
116     myPinit: Boolean;
117     myCinit: Boolean;
118     myD1Init: Boolean;
119     
120     myTol: Real from Standard;  -- toolerance for derivate
121
122 --Supremum of search 1st non-zero derivative    
123     myMaxDerivOrder: Integer from Standard;
124     
125 --boundaries of subinterval for find of root
126     myUinfium, myUsupremum: Real from Standard;
127     
128
129 end FuncExtPC;