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.
24 generic class GenLocateExtPC from Extrema
26 Tool as any; -- as ToolCurve(Curve);
31 ---Purpose: It calculates the distance between a point and a
32 -- curve with a close point.
33 -- This distance can be a minimum or a maximum.
36 raises DomainError from Standard,
37 TypeMismatch from Standard,
40 private class PCLocF instantiates FuncExtPC (Curve, Tool, POnC, Pnt, Vec);
43 Create returns GenLocateExtPC;
45 Create (P: Pnt; C: Curve; U0: Real; TolU: Real)
46 returns GenLocateExtPC
47 ---Purpose: Calculates the distance with a close point.
48 -- The close point is defined by the parameter value
50 -- The function F(u)=distance(P,C(u)) has an extremum
51 -- when g(u)=dF/du=0. The algorithm searchs a zero
52 -- near the close point.
53 -- TolU is used to decide to stop the iterations.
54 -- At the nth iteration, the criteria is:
55 -- abs(Un - Un-1) < TolU.
57 -- if U0 is outside the definition range of the curve.
60 Create (P: Pnt; C: Curve; U0: Real; Umin, Usup: Real; TolU: Real)
61 returns GenLocateExtPC
62 ---Purpose: Calculates the distance with a close point.
63 -- The close point is defined by the parameter value
65 -- The function F(u)=distance(P,C(u)) has an extremum
66 -- when g(u)=dF/du=0. The algorithm searchs a zero
67 -- near the close point.
68 -- Zeros are searched between Umin et Usup.
69 -- TolU is used to decide to stop the iterations.
70 -- At the nth iteration, the criteria is:
71 -- abs(Un - Un-1) < TolU.
73 -- if U0 is outside the definition range of the curve.
77 Initialize(me: in out; C: Curve; Umin, Usup: Real; TolU: Real)
78 ---Purpose: sets the fields of the algorithm.
81 Perform(me: in out; P: Pnt; U0: Real)
82 ---Purpose: the algorithm is done with the point P.
83 -- An exception is raised if the fields have not
85 raises TypeMismatch from Standard
88 IsDone (me) returns Boolean
89 ---Purpose: Returns True if the distance is found.
92 SquareDistance (me) returns Real
93 ---Purpose: Returns the value of the extremum square distance.
94 raises NotDone from StdFail
95 -- if IsDone(me)=False.
98 IsMin (me) returns Boolean
99 ---Purpose: Returns True if the extremum distance is a minimum.
100 raises NotDone from StdFail
101 -- if IsDone(me)=False.
104 Point (me) returns POnC
105 ---Purpose: Returns the point of the extremum distance.
106 raises NotDone from StdFail
107 -- if IsDone(me)=False.