1 -- Created on: 1994-02-01
2 -- Created by: Laurent PAINNOT
3 -- Copyright (c) 1994-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
8 -- This library is free software; you can redistribute it and / or modify it
9 -- under the terms of the GNU Lesser General Public version 2.1 as published
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class ExtPS from Extrema
19 ---Purpose: It calculates all the extremum distances
20 -- between a point and a surface.
21 -- These distances can be minimum or maximum.
27 SurfaceType from GeomAbs,
28 SequenceOfPOnSurf from Extrema,
29 SequenceOfReal from TColStd,
30 Surface from Adaptor3d,
31 SurfacePtr from Adaptor3d,
32 GenExtPS from Extrema,
35 -- ExtPExtS from Extrema,
36 -- ExtPRevS from Extrema
39 raises NotDone from StdFail,
40 OutOfRange from Standard,
41 TypeMismatch from Standard
49 Create (P: Pnt from gp; S: Surface from Adaptor3d; TolU,TolV: Real;
50 F : ExtFlag from Extrema = Extrema_ExtFlag_MINMAX;
51 A : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
53 ---Purpose: It calculates all the distances.
54 -- NbU and NbV are used to locate the close points
55 -- to find the zeros. They must be great enough
56 -- such that if there is N extrema, there will
57 -- be N extrema between P and the grid.
58 -- TolU et TolV are used to determine the conditions
59 -- to stop the iterations; at the iteration number n:
60 -- (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
62 Create (P: Pnt from gp; S: Surface from Adaptor3d;
63 Uinf, Usup, Vinf, Vsup: Real;
65 F : ExtFlag from Extrema = Extrema_ExtFlag_MINMAX;
66 A : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
68 ---Purpose: It calculates all the distances.
69 -- NbU and NbV are used to locate the close points
70 -- to find the zeros. They must be great enough
71 -- such that if there is N extrema, there will
72 -- be N extrema between P and the grid.
73 -- TolU et TolV are used to determine the conditions
74 -- to stop the iterations; at the iteration number n:
75 -- (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
78 Initialize(me: in out; S: Surface from Adaptor3d;
79 Uinf, Usup, Vinf, Vsup: Real;
81 ---Purpose: Initializes the fields of the algorithm.
85 Perform(me: in out; P: Pnt from gp)
86 ---Purpose: Computes the distances.
87 -- An exception is raised if the fieds have not been
90 raises TypeMismatch from Standard
94 IsDone (me) returns Boolean
95 ---Purpose: Returns True if the distances are found.
98 NbExt (me) returns Integer
99 ---Purpose: Returns the number of extremum distances.
100 raises NotDone from StdFail
101 -- if IsDone(me)=False.
104 SquareDistance (me; N: Integer) returns Real
105 ---Purpose: Returns the value of the Nth resulting square distance.
106 raises NotDone from StdFail,
107 -- if IsDone(me)=False.
109 -- if N < 1 or N > NbPoints(me).
112 Point (me; N: Integer) returns POnSurf
113 ---C++: return const &
114 ---Purpose: Returns the point of the Nth resulting distance.
115 raises NotDone from StdFail,
116 -- if IsDone(me)=False.
118 -- if N < 1 or N > NbPoints(me).
121 TrimmedSquareDistances(me; dUfVf, dUfVl, dUlVf, dUlVl: out Real;
122 PUfVf, PUfVl, PUlVf, PUlVl: out Pnt)
123 ---Purpose: if the surface is a trimmed surface,
124 -- dUfVf is a square distance between <P> and the point
125 -- of parameter FirstUParameter and FirstVParameter <PUfVf>.
126 -- dUfVl is a square distance between <P> and the point
127 -- of parameter FirstUParameter and LastVParameter <PUfVl>.
128 -- dUlVf is a square distance between <P> and the point
129 -- of parameter LastUParameter and FirstVParameter <PUlVf>.
130 -- dUlVl is a square distance between <P> and the point
131 -- of parameter LastUParameter and LastVParameter <PUlVl>.
134 SetFlag(me : in out; F : ExtFlag from Extrema)
137 SetAlgo(me : in out; A : ExtAlgo from Extrema)
141 Bidon(me) returns SurfacePtr from Adaptor3d
144 -- modified by NIZHNY-EAP Fri Oct 29 09:44:34 1999 ___BEGIN___
145 TreatSolution (me:in out; PS: POnSurf from Extrema;
146 Val: Real from Standard)
148 -- modified by NIZHNY-EAP Fri Oct 29 09:44:37 1999 ___END___
150 myS : SurfacePtr from Adaptor3d;
151 myDone : Boolean from Standard;
152 myExtPElS: ExtPElS from Extrema;
153 myExtPS : GenExtPS from Extrema;
154 myPoints : SequenceOfPOnSurf from Extrema;
155 myuinf : Real from Standard;
156 myusup : Real from Standard;
157 myvinf : Real from Standard;
158 myvsup : Real from Standard;
159 mytolu : Real from Standard;
160 mytolv : Real from Standard;
161 d11 : Real from Standard;
162 d12 : Real from Standard;
163 d21 : Real from Standard;
164 d22 : Real from Standard;
169 mySqDist : SequenceOfReal from TColStd;
170 mytype : SurfaceType from GeomAbs;