0023964: Extrema_ExtXX::Point methods might return constant reference instead of...
[occt.git] / src / Extrema / Extrema_GExtPC.cdl
1 -- Created on: 1992-10-19
2 -- Created by: Laurent PAINNOT
3 -- Copyright (c) 1992-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 generic class GExtPC from Extrema(
23     TheCurve          as any;
24     TheCurveTool      as any;
25     TheExtPElC        as any;
26     ThePoint          as any;
27     TheVector         as any;
28     ThePOnC           as any;
29     TheSequenceOfPOnC as any)
30     ---Purpose: It calculates all the distances between  a point and a
31     --          curve. The   Algorithm finds the  C2  intervals on the
32     --          curve.
33
34 uses
35     SequenceOfBoolean from TColStd,
36     SequenceOfReal    from TColStd,
37     CurveType         from GeomAbs
38      
39 raises
40     NotDone      from StdFail,
41     OutOfRange   from Standard,
42     TypeMismatch from Standard
43
44
45     class EPC    instantiates  GenExtPC      from Extrema
46         (TheCurve,
47          TheCurveTool,
48          ThePOnC,
49          ThePoint,
50          TheVector);
51
52 is
53     Create returns GExtPC;
54     
55     Create(P          : ThePoint;
56            C          : TheCurve;
57            Uinf, Usup : Real from Standard;
58            TolF       : Real from Standard = 1.0e-10)
59         ---Purpose: It calculates all the distances.
60         --          The function F(u)=distance(P,C(u)) has an extremum
61         --          when g(u)=dF/du=0. The algorithm searchs all the
62         --          zeros inside the definition range of the curve.
63         --          Zeros are searched between uinf and usup.
64         --          Tol  is used to decide to stop the 
65         --          iterations according to the following condition:
66         --          if n is the number of iterations,
67         --          the algorithm stops when abs(F(Un)-F(Un-1)) < Tol.
68     returns GExtPC;
69
70     Create(P    : ThePoint;
71            C    : TheCurve;
72            TolF : Real from Standard = 1.0e-10)
73         ---Purpose: It calculates all the distances.
74         --          The function F(u)=distance(P,C(u)) has an extremum
75         --          when g(u)=dF/du=0. The algorithm searchs all the
76         --          zeros inside the definition range of the curve.
77         --          Tol is used to decide to stop the 
78         --          iterations according to the following condition:
79         --          if n is the number of iterations,
80         --          the algorithm stops when abs(F(Un)-F(Un-1)) < Tol.
81     returns GExtPC;
82     
83     Initialize(me : in out; C          : TheCurve;
84                             Uinf, Usup : Real from Standard;
85                             TolF       : Real from Standard = 1.0e-10)
86         ---Purpose: initializes the fields of the algorithm.
87     is static;
88     
89     Perform(me: in out; P: ThePoint)
90         ---Purpose: An exception is raised if the fields have not been
91         --          initialized.
92     raises TypeMismatch from Standard
93     is static;
94
95     IntervalPerform(me: in out; P: ThePoint)
96     is static protected;
97
98     IsDone(me) returns Boolean from Standard
99         ---Purpose: True if the distances are found.
100     is static;
101     
102     SquareDistance(me; N: Integer from Standard) returns Real from Standard
103         ---Purpose: Returns the value of the <N>th extremum square distance.
104     raises NotDone    from StdFail,
105            OutOfRange from Standard
106     is static;
107     
108     NbExt(me) returns Integer from Standard
109         ---Purpose: Returns the number of extremum distances.
110     raises NotDone from StdFail
111     is static;
112     
113     IsMin(me; N: Integer from Standard) returns Boolean from Standard
114         ---Purpose: Returns True if the <N>th extremum distance is a
115         --          minimum.
116     raises NotDone    from StdFail,
117            OutOfRange from Standard
118     is static;
119     
120     Point(me; N: Integer from Standard) returns ThePOnC
121         ---C++: return const &
122         ---Purpose: Returns the point of the <N>th extremum distance.
123     raises NotDone    from StdFail, 
124            OutOfRange from Standard
125     is static;
126     
127     TrimmedSquareDistances(me; dist1: out Real from Standard;
128                          dist2: out Real from Standard;
129                          P1: out ThePoint;
130                          P2: out ThePoint)
131         ---Purpose: if the curve is a trimmed curve,
132         --          dist1 is a square distance between <P> and the point
133         --          of parameter FirstParameter <P1> and
134         --          dist2 is a square distance between <P> and the point
135         --          of parameter LastParameter <P2>.
136     is static;
137
138     
139     
140 fields
141     myC:       Address            from Standard;
142     Pf:        ThePoint;
143     Pl:        ThePoint;
144     myExtPElC: TheExtPElC;
145     mypoint:   TheSequenceOfPOnC;
146     mydone:    Boolean            from Standard;
147     mydist1:   Real               from Standard;
148     mydist2:   Real               from Standard;
149     myExtPC:   EPC                from Extrema;
150     mytolu:    Real               from Standard;
151     mytolf:    Real               from Standard;
152     mysample:  Integer            from Standard;
153     myintuinf: Real               from Standard;
154     myintusup: Real               from Standard;
155     myuinf:    Real               from Standard;
156     myusup:    Real               from Standard;
157     type:      CurveType          from GeomAbs;
158     myismin:   SequenceOfBoolean  from TColStd;
159     mySqDist:  SequenceOfReal     from TColStd;
160     
161 end GExtPC;