Commit | Line | Data |
---|---|---|
b311480e | 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 | |
5 | -- | |
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. | |
10 | -- | |
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. | |
13 | -- | |
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. | |
20 | ||
7fd59977 | 21 | |
22 | ||
23 | class GenExtPS from Extrema | |
24 | ||
25 | ---Purpose: It calculates all the extremum distances | |
26 | -- between a point and a surface. | |
27 | -- These distances can be minimum or maximum. | |
28 | ||
29 | uses POnSurf from Extrema, | |
30 | Pnt from gp, | |
7fd59977 | 31 | FuncExtPS from Extrema, |
32 | Surface from Adaptor3d, | |
92d1589b A |
33 | SurfacePtr from Adaptor3d, |
34 | HUBTreeOfSphere from Extrema, | |
35 | ExtFlag from Extrema, | |
36 | ExtAlgo from Extrema, | |
37 | HArray1OfSphere from Bnd, | |
38 | Vector from math, | |
6060dd1f | 39 | HArray1OfReal from TColStd, |
40 | POnSurfParams from Extrema, | |
41 | HArray2OfPOnSurfParams from Extrema | |
7fd59977 | 42 | |
43 | raises NotDone from StdFail, | |
44 | OutOfRange from Standard, | |
45 | TypeMismatch from Standard | |
46 | ||
47 | ||
48 | is | |
49 | ||
50 | Create returns GenExtPS; | |
51 | ||
92d1589b | 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) |
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 | Create (P: Pnt; S: Surface from Adaptor3d; NbU,NbV: Integer; | |
92d1589b | 69 | Umin, Usup, Vmin, Vsup: Real; TolU,TolV: Real; F : ExtFlag from Extrema = Extrema_ExtFlag_MINMAX; A : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad) |
7fd59977 | 70 | returns GenExtPS; |
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 | |
75 | -- surface. | |
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 . | |
83 | ||
84 | ||
85 | Initialize(me: in out; S: Surface from Adaptor3d; NbU, NbV: Integer; TolU, TolV: Real) | |
86 | ---Pupose: sets the fields of the algorithm. | |
87 | is static; | |
88 | ||
89 | ||
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. | |
93 | is static; | |
94 | ||
95 | ||
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 | |
99 | -- been initialized. | |
100 | raises TypeMismatch from Standard | |
101 | is static; | |
92d1589b A |
102 | |
103 | SetFlag(me : in out; F : ExtFlag from Extrema) | |
104 | is static; | |
105 | ||
106 | SetAlgo(me : in out; A : ExtAlgo from Extrema) | |
107 | is static; | |
7fd59977 | 108 | |
109 | ||
110 | IsDone (me) returns Boolean | |
111 | ---Purpose: Returns True if the distances are found. | |
112 | is static; | |
113 | ||
114 | NbExt (me) returns Integer | |
115 | ---Purpose: Returns the number of extremum distances. | |
116 | raises NotDone from StdFail | |
117 | -- if IsDone(me)=False. | |
118 | is static; | |
119 | ||
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. | |
124 | OutOfRange | |
125 | -- if N < 1 or N > NbPoints(me). | |
126 | is static; | |
127 | ||
128 | Point (me; N: Integer) returns POnSurf | |
5d99f2c8 | 129 | ---C++: return const & |
7fd59977 | 130 | ---Purpose: Returns the point of the Nth resulting distance. |
131 | raises NotDone from StdFail, | |
132 | -- if IsDone(me)=False. | |
133 | OutOfRange | |
134 | -- if N < 1 or N > NbPoints(me). | |
135 | is static; | |
136 | ||
137 | Bidon(me) returns SurfacePtr from Adaptor3d | |
138 | is static private; | |
92d1589b A |
139 | |
140 | BuildTree(me : in out) | |
141 | is static private; | |
142 | ||
6060dd1f | 143 | FindSolution(me: in out; P : Pnt from gp; |
144 | theParams: POnSurfParams from Extrema) | |
92d1589b | 145 | is static private; |
5368adff | 146 | |
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 | |
149 | ||
6060dd1f | 150 | BuildGrid(me: in out; thePoint: Pnt from gp) is private; |
5368adff | 151 | ---Purpose: Creation of grid of parametric points |
7fd59977 | 152 | |
153 | fields | |
154 | myDone : Boolean; | |
155 | myInit : Boolean; | |
156 | myumin : Real; | |
157 | myusup : Real; | |
158 | myvmin : Real; | |
159 | myvsup : Real; | |
160 | myusample : Integer; | |
161 | myvsample : Integer; | |
7fd59977 | 162 | mytolu : Real; |
163 | mytolv : Real; | |
6060dd1f | 164 | myPoints : HArray2OfPOnSurfParams from Extrema; |
92d1589b A |
165 | mySphereUBTree : HUBTreeOfSphere from Extrema; |
166 | mySphereArray : HArray1OfSphere from Bnd; | |
7fd59977 | 167 | myF : FuncExtPS from Extrema; |
168 | myS : SurfacePtr from Adaptor3d; | |
92d1589b A |
169 | myFlag : ExtFlag from Extrema; |
170 | myAlgo : ExtAlgo from Extrema; | |
5368adff | 171 | myUParams : HArray1OfReal from TColStd; |
172 | myVParams : HArray1OfReal from TColStd; | |
6060dd1f | 173 | myFacePntParams : HArray2OfPOnSurfParams from Extrema; |
7fd59977 | 174 | |
175 | end GenExtPS; |