1 -- Created on: 1995-07-18
2 -- Created by: Modelistation
3 -- Copyright (c) 1995-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
23 generic class GenExtPC from Extrema (Curve as any;
24 Tool as any; --as ToolCurve(Curve)
29 ---Purpose: It calculates all the distances between a point
31 -- These distances can be minimum or maximum.
34 raises NotDone from StdFail,
35 OutOfRange from Standard,
36 TypeMismatch from Standard
38 private class PCF instantiates FuncExtPC from Extrema (Curve, Tool, POnC, Pnt, Vec);
42 Create returns GenExtPC;
45 Create (P: Pnt; C: Curve; NbU: Integer; TolU,TolF: Real)
47 ---Purpose: It calculates all the distances.
48 -- The function F(u)=distance(P,C(u)) has an extremum
49 -- when g(u)=dF/du=0. The algorithm searchs all the
50 -- zeros inside the definition range of the curve.
51 -- NbU is used to locate the close points to
53 -- Tol and TolU are used to decide to stop the
54 -- iterations according to the following condition:
55 -- if n is the number of iterations,
56 -- abs(Un-Un-1) < TolU and abs(F(Un)-F(Un-1)) < Tol.
59 Create (P: Pnt; C: Curve; NbU: Integer; Umin, Usup: Real; TolU,TolF: Real)
61 ---Purpose: It calculates all the distances.
62 -- The function F(u)=distance(P,C(u)) has an extremum
63 -- when g(u)=dF/du=0. The algorithm searchs all the
64 -- zeros inside the definition range of the curve.
65 -- NbU is used to locate the close points to
67 -- Zeros are searched between umin and usup.
68 -- Tol and TolU are used to decide to stop the
69 -- iterations according to the following condition:
70 -- if n is the number of iterations,
71 -- abs(Un-Un-1) < TolU and abs(F(Un)-F(Un-1)) < Tol.
75 Initialize(me: in out; C: Curve; NbU: Integer; TolU, TolF: Real)
76 ---Purpose: sets the fields of the algorithm.
80 Initialize(me: in out; C: Curve; NbU: Integer;
81 Umin, Usup: Real; TolU, TolF: Real)
82 ---Purpose: sets the fields of the algorithm.
85 Initialize(me: in out; C: Curve)
86 ---Purpose: sets the fields of the algorithm.
89 Initialize(me: in out; NbU: Integer; Umin, Usup: Real; TolU, TolF: Real)
90 ---Purpose: sets the fields of the algorithm.
94 Perform(me: in out; P: Pnt)
95 ---Purpose: the algorithm is done with the point P.
96 -- An exception is raised if the fields have not
98 raises TypeMismatch from Standard
102 IsDone (me) returns Boolean
103 ---Purpose: True if the distances are found.
104 raises TypeMismatch from Standard
107 NbExt (me) returns Integer
108 ---Purpose: Returns the number of extremum distances.
109 raises TypeMismatch from Standard,
111 -- if IsDone(me)=False.
114 SquareDistance (me; N: Integer) returns Real
115 ---Purpose: Returns the value of the Nth extremum square distance.
116 raises TypeMismatch from Standard,
117 NotDone from StdFail,
118 -- if IsDone(me)=False.
119 OutOfRange from Standard
120 -- if N < 1 or N > NbPoints(me).
124 IsMin (me; N: Integer) returns Boolean
125 ---Purpose: Returns True if the Nth extremum distance is a
127 raises TypeMismatch from Standard,
128 NotDone from StdFail,
129 -- if IsDone(me)=False.
130 OutOfRange from Standard
131 -- if N < 1 or N > NbPoints(me).
135 Point (me; N: Integer) returns POnC
136 ---Purpose: Returns the point of the Nth extremum distance.
137 raises TypeMismatch from Standard,
138 NotDone from StdFail,
139 -- if IsDone(me)=False.
140 OutOfRange from Standard
141 -- if N < 1 or N > NbPoints(me).