CommitLineData
7fd59977 1-- File: Extrema_GenExtPS.cdl
2-- Created: Tue Jul 18 08:20:44 1995
3-- Author: Modelistation
4-- <model@metrox>
6
7
8class GenExtPS from Extrema
9
10 ---Purpose: It calculates all the extremum distances
11 -- between a point and a surface.
12 -- These distances can be minimum or maximum.
13
14uses POnSurf from Extrema,
15 Pnt from gp,
7fd59977 16 FuncExtPS from Extrema,
92d1589b
A
19 HUBTreeOfSphere from Extrema,
20 ExtFlag from Extrema,
21 ExtAlgo from Extrema,
22 HArray1OfSphere from Bnd,
23 Vector from math,
24 HArray2OfPnt from TColgp
7fd59977 25
26raises NotDone from StdFail,
27 OutOfRange from Standard,
28 TypeMismatch from Standard
29
30
31is
32
33 Create returns GenExtPS;
34
92d1589b 35 Create (P: Pnt; S: Surface from Adaptor3d; NbU,NbV: Integer; TolU,TolV: Real; F : ExtFlag from Extrema = Extrema_ExtFlag_MINMAX; A : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
7fd59977 36 returns GenExtPS;
37 ---Purpose: It calculates all the distances.
38 -- The function F(u,v)=distance(P,S(u,v)) has an
39 -- extremum when gradient(F)=0. The algorithm searchs
40 -- all the zeros inside the definition ranges of the
41 -- surface.
42 -- NbU and NbV are used to locate the close points
43 -- to find the zeros. They must be great enough
44 -- such that if there is N extrema, there will
45 -- be N extrema between P and the grid.
46 -- TolU et TolV are used to determine the conditions
47 -- to stop the iterations; at the iteration number n:
48 -- (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
49
50
51 Create (P: Pnt; S: Surface from Adaptor3d; NbU,NbV: Integer;
92d1589b 52 Umin, Usup, Vmin, Vsup: Real; TolU,TolV: Real; F : ExtFlag from Extrema = Extrema_ExtFlag_MINMAX; A : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
7fd59977 53 returns GenExtPS;
54 ---Purpose: It calculates all the distances.
55 -- The function F(u,v)=distance(P,S(u,v)) has an
56 -- extremum when gradient(F)=0. The algorithm searchs
57 -- all the zeros inside the definition ranges of the
58 -- surface.
59 -- NbU and NbV are used to locate the close points
60 -- to find the zeros. They must be great enough
61 -- such that if there is N extrema, there will
62 -- be N extrema between P and the grid.
63 -- TolU et TolV are used to determine the conditions
64 -- to stop the iterations; at the iteration number n:
65 -- (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
66
67
68 Initialize(me: in out; S: Surface from Adaptor3d; NbU, NbV: Integer; TolU, TolV: Real)
69 ---Pupose: sets the fields of the algorithm.
70 is static;
71
72
73 Initialize(me: in out; S: Surface from Adaptor3d; NbU, NbV: Integer;
74 Umin, Usup, Vmin, Vsup: Real; TolU, TolV: Real)
75 ---Pupose: sets the fields of the algorithm.
76 is static;
77
78
79 Perform(me: in out; P: Pnt from gp)
80 ---Purpose: the algorithm is done with the point P.
81 -- An exception is raised if the fields have not
82 -- been initialized.
83 raises TypeMismatch from Standard
84 is static;
92d1589b
A
85
86 SetFlag(me : in out; F : ExtFlag from Extrema)
87 is static;
88
89 SetAlgo(me : in out; A : ExtAlgo from Extrema)
90 is static;
7fd59977 91
92
93 IsDone (me) returns Boolean
94 ---Purpose: Returns True if the distances are found.
95 is static;
96
97 NbExt (me) returns Integer
98 ---Purpose: Returns the number of extremum distances.
99 raises NotDone from StdFail
100 -- if IsDone(me)=False.
101 is static;
102
103 SquareDistance (me; N: Integer) returns Real
104 ---Purpose: Returns the value of the Nth resulting square distance.
105 raises NotDone from StdFail,
106 -- if IsDone(me)=False.
107 OutOfRange
108 -- if N < 1 or N > NbPoints(me).
109 is static;
110
111 Point (me; N: Integer) returns POnSurf
112 ---Purpose: Returns the point of the Nth resulting distance.
113 raises NotDone from StdFail,
114 -- if IsDone(me)=False.
115 OutOfRange
116 -- if N < 1 or N > NbPoints(me).
117 is static;
118
119 Bidon(me) returns SurfacePtr from Adaptor3d
120 is static private;
92d1589b
A
121
122 BuildTree(me : in out)
123 is static private;
124
125 FindSolution(me: in out; P : Pnt from gp; UV : Vector from math; PasU, PasV : Real; f : ExtFlag from Extrema)
126 is static private;
7fd59977 127
128fields
129 myDone : Boolean;
130 myInit : Boolean;
131 myumin : Real;
132 myusup : Real;
133 myvmin : Real;
134 myvsup : Real;
135 myusample : Integer;
136 myvsample : Integer;
7fd59977 137 mytolu : Real;
138 mytolv : Real;
92d1589b
A
139 mypoints : HArray2OfPnt from TColgp;
140 mySphereUBTree : HUBTreeOfSphere from Extrema;
141 mySphereArray : HArray1OfSphere from Bnd;
7fd59977 142 myF : FuncExtPS from Extrema;
143 myS : SurfacePtr from Adaptor3d;
92d1589b
A
144 myFlag : ExtFlag from Extrema;
145 myAlgo : ExtAlgo from Extrema;
7fd59977 146
147end GenExtPS;