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
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.
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.
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.
23 class GenExtPS from Extrema
25 ---Purpose: It calculates all the extremum distances
26 -- between a point and a surface.
27 -- These distances can be minimum or maximum.
29 uses POnSurf from Extrema,
31 FuncExtPS from Extrema,
32 Surface from Adaptor3d,
33 SurfacePtr from Adaptor3d,
34 HUBTreeOfSphere from Extrema,
37 HArray1OfSphere from Bnd,
39 HArray1OfReal from TColStd,
40 POnSurfParams from Extrema,
41 HArray2OfPOnSurfParams from Extrema
43 raises NotDone from StdFail,
44 OutOfRange from Standard,
45 TypeMismatch from Standard
50 Create returns GenExtPS;
52 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)
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 Create (P: Pnt; S: Surface from Adaptor3d; NbU,NbV: Integer;
69 Umin, Usup, Vmin, Vsup: Real; TolU,TolV: Real; F : ExtFlag from Extrema = Extrema_ExtFlag_MINMAX; A : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad)
71 ---Purpose: It calculates all the distances.
72 -- The function F(u,v)=distance(P,S(u,v)) has an
73 -- extremum when gradient(F)=0. The algorithm searchs
74 -- all the zeros inside the definition ranges of the
76 -- NbU and NbV are used to locate the close points
77 -- to find the zeros. They must be great enough
78 -- such that if there is N extrema, there will
79 -- be N extrema between P and the grid.
80 -- TolU et TolV are used to determine the conditions
81 -- to stop the iterations; at the iteration number n:
82 -- (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
85 Initialize(me: in out; S: Surface from Adaptor3d; NbU, NbV: Integer; TolU, TolV: Real)
86 ---Pupose: sets the fields of the algorithm.
90 Initialize(me: in out; S: Surface from Adaptor3d; NbU, NbV: Integer;
91 Umin, Usup, Vmin, Vsup: Real; TolU, TolV: Real)
92 ---Pupose: sets the fields of the algorithm.
96 Perform(me: in out; P: Pnt from gp)
97 ---Purpose: the algorithm is done with the point P.
98 -- An exception is raised if the fields have not
100 raises TypeMismatch from Standard
103 SetFlag(me : in out; F : ExtFlag from Extrema)
106 SetAlgo(me : in out; A : ExtAlgo from Extrema)
110 IsDone (me) returns Boolean
111 ---Purpose: Returns True if the distances are found.
114 NbExt (me) returns Integer
115 ---Purpose: Returns the number of extremum distances.
116 raises NotDone from StdFail
117 -- if IsDone(me)=False.
120 SquareDistance (me; N: Integer) returns Real
121 ---Purpose: Returns the value of the Nth resulting square distance.
122 raises NotDone from StdFail,
123 -- if IsDone(me)=False.
125 -- if N < 1 or N > NbPoints(me).
128 Point (me; N: Integer) returns POnSurf
129 ---C++: return const &
130 ---Purpose: Returns the point of the Nth resulting distance.
131 raises NotDone from StdFail,
132 -- if IsDone(me)=False.
134 -- if N < 1 or N > NbPoints(me).
137 Bidon(me) returns SurfacePtr from Adaptor3d
140 BuildTree(me : in out)
143 FindSolution(me: in out; P : Pnt from gp;
144 theParams: POnSurfParams from Extrema)
147 GetGridPoints(me: in out; theSurf: Surface from Adaptor3d) is private;
148 ---Purpose: Selection of points to build grid, depending on the type of surface
150 BuildGrid(me: in out; thePoint: Pnt from gp) is private;
151 ---Purpose: Creation of grid of parametric points
164 myPoints : HArray2OfPOnSurfParams from Extrema;
165 mySphereUBTree : HUBTreeOfSphere from Extrema;
166 mySphereArray : HArray1OfSphere from Bnd;
167 myF : FuncExtPS from Extrema;
168 myS : SurfacePtr from Adaptor3d;
169 myFlag : ExtFlag from Extrema;
170 myAlgo : ExtAlgo from Extrema;
171 myUParams : HArray1OfReal from TColStd;
172 myVParams : HArray1OfReal from TColStd;
173 myFacePntParams : HArray2OfPOnSurfParams from Extrema;