b311480e |
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 |
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 | |
7fd59977 |
21 | |
22 | |
23 | generic class GenExtPC from Extrema (Curve as any; |
24 | Tool as any; --as ToolCurve(Curve) |
25 | POnC as any; |
26 | Pnt as any; |
27 | Vec as any) |
28 | |
29 | ---Purpose: It calculates all the distances between a point |
30 | -- and a curve. |
31 | -- These distances can be minimum or maximum. |
32 | |
33 | |
34 | raises NotDone from StdFail, |
35 | OutOfRange from Standard, |
36 | TypeMismatch from Standard |
37 | |
38 | private class PCF instantiates FuncExtPC from Extrema (Curve, Tool, POnC, Pnt, Vec); |
39 | |
40 | is |
41 | |
42 | Create returns GenExtPC; |
43 | |
44 | |
45 | Create (P: Pnt; C: Curve; NbU: Integer; TolU,TolF: Real) |
46 | returns GenExtPC; |
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 |
52 | -- find the zeros. |
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. |
57 | |
58 | |
59 | Create (P: Pnt; C: Curve; NbU: Integer; Umin, Usup: Real; TolU,TolF: Real) |
60 | returns GenExtPC; |
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 |
66 | -- find the zeros. |
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. |
72 | |
73 | |
74 | |
75 | Initialize(me: in out; C: Curve; NbU: Integer; TolU, TolF: Real) |
76 | ---Purpose: sets the fields of the algorithm. |
77 | is static; |
78 | |
79 | |
80 | Initialize(me: in out; C: Curve; NbU: Integer; |
81 | Umin, Usup: Real; TolU, TolF: Real) |
82 | ---Purpose: sets the fields of the algorithm. |
83 | is static; |
84 | |
85 | Initialize(me: in out; C: Curve) |
86 | ---Purpose: sets the fields of the algorithm. |
87 | is static; |
88 | |
89 | Initialize(me: in out; NbU: Integer; Umin, Usup: Real; TolU, TolF: Real) |
90 | ---Purpose: sets the fields of the algorithm. |
91 | is static; |
92 | |
93 | |
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 |
97 | -- been initialized. |
98 | raises TypeMismatch from Standard |
99 | is static; |
100 | |
101 | |
102 | IsDone (me) returns Boolean |
103 | ---Purpose: True if the distances are found. |
104 | raises TypeMismatch from Standard |
105 | is static; |
106 | |
107 | NbExt (me) returns Integer |
108 | ---Purpose: Returns the number of extremum distances. |
109 | raises TypeMismatch from Standard, |
110 | NotDone from StdFail |
111 | -- if IsDone(me)=False. |
112 | is static; |
113 | |
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). |
121 | is static; |
122 | |
123 | |
124 | IsMin (me; N: Integer) returns Boolean |
125 | ---Purpose: Returns True if the Nth extremum distance is a |
126 | -- minimum. |
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). |
132 | is static; |
133 | |
134 | |
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). |
142 | is static; |
143 | |
144 | |
145 | |
146 | fields |
147 | myDone : Boolean; |
148 | myInit: Boolean; |
149 | mynbsample: Integer; |
150 | myumin: Real; |
151 | myusup: Real; |
152 | mytolu: Real; |
153 | mytolF: Real; |
154 | myF : PCF; |
155 | |
156 | end GenExtPC; |
157 | |