b311480e |
1 | -- Created on: 1995-07-18 |
2 | -- Created by: Modelistation |
3 | -- Copyright (c) 1995-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
8 | -- This library is free software; you can redistribute it and/or modify it under |
9 | -- the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | generic class GenLocateExtPC from Extrema |
18 | (Curve as any; |
19 | Tool as any; -- as ToolCurve(Curve); |
20 | POnC as any; |
21 | Pnt as any; |
22 | Vec as any ) |
23 | |
24 | ---Purpose: It calculates the distance between a point and a |
25 | -- curve with a close point. |
26 | -- This distance can be a minimum or a maximum. |
27 | |
28 | |
29 | raises DomainError from Standard, |
30 | TypeMismatch from Standard, |
31 | NotDone from StdFail |
32 | |
33 | private class PCLocF instantiates FuncExtPC (Curve, Tool, POnC, Pnt, Vec); |
34 | |
35 | is |
36 | Create returns GenLocateExtPC; |
37 | |
38 | Create (P: Pnt; C: Curve; U0: Real; TolU: Real) |
39 | returns GenLocateExtPC |
40 | ---Purpose: Calculates the distance with a close point. |
41 | -- The close point is defined by the parameter value |
42 | -- U0. |
43 | -- The function F(u)=distance(P,C(u)) has an extremum |
44 | -- when g(u)=dF/du=0. The algorithm searchs a zero |
45 | -- near the close point. |
46 | -- TolU is used to decide to stop the iterations. |
47 | -- At the nth iteration, the criteria is: |
48 | -- abs(Un - Un-1) < TolU. |
49 | raises DomainError; |
50 | -- if U0 is outside the definition range of the curve. |
51 | |
52 | |
53 | Create (P: Pnt; C: Curve; U0: Real; Umin, Usup: Real; TolU: Real) |
54 | returns GenLocateExtPC |
55 | ---Purpose: Calculates the distance with a close point. |
56 | -- The close point is defined by the parameter value |
57 | -- U0. |
58 | -- The function F(u)=distance(P,C(u)) has an extremum |
59 | -- when g(u)=dF/du=0. The algorithm searchs a zero |
60 | -- near the close point. |
61 | -- Zeros are searched between Umin et Usup. |
62 | -- TolU is used to decide to stop the iterations. |
63 | -- At the nth iteration, the criteria is: |
64 | -- abs(Un - Un-1) < TolU. |
65 | raises DomainError; |
66 | -- if U0 is outside the definition range of the curve. |
67 | |
68 | |
69 | |
70 | Initialize(me: in out; C: Curve; Umin, Usup: Real; TolU: Real) |
71 | ---Purpose: sets the fields of the algorithm. |
72 | is static; |
73 | |
74 | Perform(me: in out; P: Pnt; U0: Real) |
75 | ---Purpose: the algorithm is done with the point P. |
76 | -- An exception is raised if the fields have not |
77 | -- been initialized. |
78 | raises TypeMismatch from Standard |
79 | is static; |
80 | |
81 | IsDone (me) returns Boolean |
82 | ---Purpose: Returns True if the distance is found. |
83 | is static; |
84 | |
85 | SquareDistance (me) returns Real |
86 | ---Purpose: Returns the value of the extremum square distance. |
87 | raises NotDone from StdFail |
88 | -- if IsDone(me)=False. |
89 | is static; |
90 | |
91 | IsMin (me) returns Boolean |
92 | ---Purpose: Returns True if the extremum distance is a minimum. |
93 | raises NotDone from StdFail |
94 | -- if IsDone(me)=False. |
95 | is static; |
96 | |
97 | Point (me) returns POnC |
5d99f2c8 |
98 | ---C++: return const & |
7fd59977 |
99 | ---Purpose: Returns the point of the extremum distance. |
100 | raises NotDone from StdFail |
101 | -- if IsDone(me)=False. |
102 | is static; |
103 | |
104 | |
105 | fields |
106 | myDone : Boolean; |
107 | mytolU : Real; |
108 | myumin: Real; |
109 | myusup: Real; |
110 | myF: PCLocF; |
111 | |
112 | end GenLocateExtPC; |