1 -- File: Extrema_ExtPS.cdl
2 -- Created: Tue Feb 1 15:30:11 1994
3 -- Author: Laurent PAINNOT
5 ---Copyright: Matra Datavision 1994
8 class ExtPS 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.
18 SurfaceType from GeomAbs,
19 SequenceOfPOnSurf from Extrema,
20 SequenceOfReal from TColStd,
21 Surface from Adaptor3d,
22 SurfacePtr from Adaptor3d,
23 GenExtPS from Extrema,
26 -- ExtPExtS from Extrema,
27 -- ExtPRevS from Extrema
30 raises NotDone from StdFail,
31 OutOfRange from Standard,
32 TypeMismatch from Standard
40 Create (P: Pnt from gp; S: Surface from Adaptor3d; TolU,TolV: Real;
41 F : ExtFlag from Extrema = Extrema_ExtFlag_MINMAX;
42 A : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
44 ---Purpose: It calculates all the distances.
45 -- NbU and NbV are used to locate the close points
46 -- to find the zeros. They must be great enough
47 -- such that if there is N extrema, there will
48 -- be N extrema between P and the grid.
49 -- TolU et TolV are used to determine the conditions
50 -- to stop the iterations; at the iteration number n:
51 -- (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
53 Create (P: Pnt from gp; S: Surface from Adaptor3d;
54 Uinf, Usup, Vinf, Vsup: Real;
56 F : ExtFlag from Extrema = Extrema_ExtFlag_MINMAX;
57 A : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
59 ---Purpose: It calculates all the distances.
60 -- NbU and NbV are used to locate the close points
61 -- to find the zeros. They must be great enough
62 -- such that if there is N extrema, there will
63 -- be N extrema between P and the grid.
64 -- TolU et TolV are used to determine the conditions
65 -- to stop the iterations; at the iteration number n:
66 -- (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
69 Initialize(me: in out; S: Surface from Adaptor3d;
70 Uinf, Usup, Vinf, Vsup: Real;
72 ---Purpose: Initializes the fields of the algorithm.
76 Perform(me: in out; P: Pnt from gp)
77 ---Purpose: Computes the distances.
78 -- An exception is raised if the fieds have not been
81 raises TypeMismatch from Standard
85 IsDone (me) returns Boolean
86 ---Purpose: Returns True if the distances are found.
89 NbExt (me) returns Integer
90 ---Purpose: Returns the number of extremum distances.
91 raises NotDone from StdFail
92 -- if IsDone(me)=False.
95 SquareDistance (me; N: Integer) returns Real
96 ---Purpose: Returns the value of the Nth resulting square distance.
97 raises NotDone from StdFail,
98 -- if IsDone(me)=False.
100 -- if N < 1 or N > NbPoints(me).
103 Point (me; N: Integer) returns POnSurf
104 ---Purpose: Returns the point of the Nth resulting distance.
105 raises NotDone from StdFail,
106 -- if IsDone(me)=False.
108 -- if N < 1 or N > NbPoints(me).
111 TrimmedSquareDistances(me; dUfVf, dUfVl, dUlVf, dUlVl: out Real;
112 PUfVf, PUfVl, PUlVf, PUlVl: out Pnt)
113 ---Purpose: if the surface is a trimmed surface,
114 -- dUfVf is a square distance between <P> and the point
115 -- of parameter FirstUParameter and FirstVParameter <PUfVf>.
116 -- dUfVl is a square distance between <P> and the point
117 -- of parameter FirstUParameter and LastVParameter <PUfVl>.
118 -- dUlVf is a square distance between <P> and the point
119 -- of parameter LastUParameter and FirstVParameter <PUlVf>.
120 -- dUlVl is a square distance between <P> and the point
121 -- of parameter LastUParameter and LastVParameter <PUlVl>.
124 SetFlag(me : in out; F : ExtFlag from Extrema)
127 SetAlgo(me : in out; A : ExtAlgo from Extrema)
131 Bidon(me) returns SurfacePtr from Adaptor3d
134 -- modified by NIZHNY-EAP Fri Oct 29 09:44:34 1999 ___BEGIN___
135 TreatSolution (me:in out; PS: POnSurf from Extrema;
136 Val: Real from Standard)
138 -- modified by NIZHNY-EAP Fri Oct 29 09:44:37 1999 ___END___
140 myS : SurfacePtr from Adaptor3d;
141 myDone : Boolean from Standard;
142 myExtPElS: ExtPElS from Extrema;
143 myExtPS : GenExtPS from Extrema;
144 myPoints : SequenceOfPOnSurf from Extrema;
145 myuinf : Real from Standard;
146 myusup : Real from Standard;
147 myvinf : Real from Standard;
148 myvsup : Real from Standard;
149 mytolu : Real from Standard;
150 mytolv : Real from Standard;
151 d11 : Real from Standard;
152 d12 : Real from Standard;
153 d21 : Real from Standard;
154 d22 : Real from Standard;
159 mySqDist : SequenceOfReal from TColStd;
160 mytype : SurfaceType from GeomAbs;