1 -- Created on: 1995-07-18
2 -- Created by: Modelistation
3 -- Copyright (c) 1995-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
8 -- This library is free software; you can redistribute it and / or modify it
9 -- under the terms of the GNU Lesser General Public version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 generic class GenExtPC from Extrema (Curve as any;
18 Tool as any; --as ToolCurve(Curve)
23 ---Purpose: It calculates all the distances between a point
25 -- These distances can be minimum or maximum.
28 raises NotDone from StdFail,
29 OutOfRange from Standard,
30 TypeMismatch from Standard
32 private class PCF instantiates FuncExtPC from Extrema (Curve, Tool, POnC, Pnt, Vec);
36 Create returns GenExtPC;
39 Create (P: Pnt; C: Curve; NbU: Integer; TolU,TolF: Real)
41 ---Purpose: It calculates all the distances.
42 -- The function F(u)=distance(P,C(u)) has an extremum
43 -- when g(u)=dF/du=0. The algorithm searchs all the
44 -- zeros inside the definition range of the curve.
45 -- NbU is used to locate the close points to
47 -- Tol and TolU are used to decide to stop the
48 -- iterations according to the following condition:
49 -- if n is the number of iterations,
50 -- abs(Un-Un-1) < TolU and abs(F(Un)-F(Un-1)) < Tol.
53 Create (P: Pnt; C: Curve; NbU: Integer; Umin, Usup: Real; TolU,TolF: Real)
55 ---Purpose: It calculates all the distances.
56 -- The function F(u)=distance(P,C(u)) has an extremum
57 -- when g(u)=dF/du=0. The algorithm searchs all the
58 -- zeros inside the definition range of the curve.
59 -- NbU is used to locate the close points to
61 -- Zeros are searched between umin and usup.
62 -- Tol and TolU are used to decide to stop the
63 -- iterations according to the following condition:
64 -- if n is the number of iterations,
65 -- abs(Un-Un-1) < TolU and abs(F(Un)-F(Un-1)) < Tol.
69 Initialize(me: in out; C: Curve; NbU: Integer; TolU, TolF: Real)
70 ---Purpose: sets the fields of the algorithm.
74 Initialize(me: in out; C: Curve; NbU: Integer;
75 Umin, Usup: Real; TolU, TolF: Real)
76 ---Purpose: sets the fields of the algorithm.
79 Initialize(me: in out; C: Curve)
80 ---Purpose: sets the fields of the algorithm.
83 Initialize(me: in out; NbU: Integer; Umin, Usup: Real; TolU, TolF: Real)
84 ---Purpose: sets the fields of the algorithm.
88 Perform(me: in out; P: Pnt)
89 ---Purpose: the algorithm is done with the point P.
90 -- An exception is raised if the fields have not
92 raises TypeMismatch from Standard
96 IsDone (me) returns Boolean
97 ---Purpose: True if the distances are found.
98 raises TypeMismatch from Standard
101 NbExt (me) returns Integer
102 ---Purpose: Returns the number of extremum distances.
103 raises TypeMismatch from Standard,
105 -- if IsDone(me)=False.
108 SquareDistance (me; N: Integer) returns Real
109 ---Purpose: Returns the value of the Nth extremum square distance.
110 raises TypeMismatch from Standard,
111 NotDone from StdFail,
112 -- if IsDone(me)=False.
113 OutOfRange from Standard
114 -- if N < 1 or N > NbPoints(me).
118 IsMin (me; N: Integer) returns Boolean
119 ---Purpose: Returns True if the Nth extremum distance is a
121 raises TypeMismatch from Standard,
122 NotDone from StdFail,
123 -- if IsDone(me)=False.
124 OutOfRange from Standard
125 -- if N < 1 or N > NbPoints(me).
129 Point (me; N: Integer) returns POnC
130 ---C++: return const &
131 ---Purpose: Returns the point of the Nth extremum distance.
132 raises TypeMismatch from Standard,
133 NotDone from StdFail,
134 -- if IsDone(me)=False.
135 OutOfRange from Standard
136 -- if N < 1 or N > NbPoints(me).