1 -- File: Extrema_GenExtPS.cdl
2 -- Created: Tue Jul 18 08:20:44 1995
3 -- Author: Modelistation
5 ---Copyright: Matra Datavision 1995
8 class GenExtPS from Extrema
10 ---Purpose: It calculates all the extremum distances
11 -- between a point and a surface.
12 -- These distances can be minimum or maximum.
14 uses POnSurf from Extrema,
16 FuncExtPS from Extrema,
17 Surface from Adaptor3d,
18 SurfacePtr from Adaptor3d,
19 HUBTreeOfSphere from Extrema,
22 HArray1OfSphere from Bnd,
24 HArray2OfPnt from TColgp
26 raises NotDone from StdFail,
27 OutOfRange from Standard,
28 TypeMismatch from Standard
33 Create returns GenExtPS;
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)
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
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 .
51 Create (P: Pnt; S: Surface from Adaptor3d; NbU,NbV: Integer;
52 Umin, Usup, Vmin, Vsup: Real; TolU,TolV: Real; F : ExtFlag from Extrema = Extrema_ExtFlag_MINMAX; A : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
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
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 .
68 Initialize(me: in out; S: Surface from Adaptor3d; NbU, NbV: Integer; TolU, TolV: Real)
69 ---Pupose: sets the fields of the algorithm.
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.
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
83 raises TypeMismatch from Standard
86 SetFlag(me : in out; F : ExtFlag from Extrema)
89 SetAlgo(me : in out; A : ExtAlgo from Extrema)
93 IsDone (me) returns Boolean
94 ---Purpose: Returns True if the distances are found.
97 NbExt (me) returns Integer
98 ---Purpose: Returns the number of extremum distances.
99 raises NotDone from StdFail
100 -- if IsDone(me)=False.
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.
108 -- if N < 1 or N > NbPoints(me).
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.
116 -- if N < 1 or N > NbPoints(me).
119 Bidon(me) returns SurfacePtr from Adaptor3d
122 BuildTree(me : in out)
125 FindSolution(me: in out; P : Pnt from gp; UV : Vector from math; PasU, PasV : Real; f : ExtFlag from Extrema)
139 mypoints : HArray2OfPnt from TColgp;
140 mySphereUBTree : HUBTreeOfSphere from Extrema;
141 mySphereArray : HArray1OfSphere from Bnd;
142 myF : FuncExtPS from Extrema;
143 myS : SurfacePtr from Adaptor3d;
144 myFlag : ExtFlag from Extrema;
145 myAlgo : ExtAlgo from Extrema;