Commit | Line | Data |
---|---|---|
b311480e | 1 | -- Created on: 1995-07-18 |
2 | -- Created by: Modelistation | |
3 | -- Copyright (c) 1995-1999 Matra Datavision | |
973c2be1 | 4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e | 5 | -- |
973c2be1 | 6 | -- This file is part of Open CASCADE Technology software library. |
b311480e | 7 | -- |
973c2be1 | 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. | |
b311480e | 13 | -- |
973c2be1 | 14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. | |
7fd59977 | 16 | |
17 | class GenExtPS from Extrema | |
18 | ||
19 | ---Purpose: It calculates all the extremum distances | |
20 | -- between a point and a surface. | |
21 | -- These distances can be minimum or maximum. | |
22 | ||
23 | uses POnSurf from Extrema, | |
24 | Pnt from gp, | |
7fd59977 | 25 | FuncExtPS from Extrema, |
26 | Surface from Adaptor3d, | |
92d1589b A |
27 | SurfacePtr from Adaptor3d, |
28 | HUBTreeOfSphere from Extrema, | |
29 | ExtFlag from Extrema, | |
30 | ExtAlgo from Extrema, | |
31 | HArray1OfSphere from Bnd, | |
32 | Vector from math, | |
6060dd1f | 33 | HArray1OfReal from TColStd, |
34 | POnSurfParams from Extrema, | |
35 | HArray2OfPOnSurfParams from Extrema | |
7fd59977 | 36 | |
37 | raises NotDone from StdFail, | |
38 | OutOfRange from Standard, | |
39 | TypeMismatch from Standard | |
40 | ||
41 | ||
42 | is | |
43 | ||
44 | Create returns GenExtPS; | |
45 | ||
92d1589b | 46 | 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 | 47 | returns GenExtPS; |
48 | ---Purpose: It calculates all the distances. | |
49 | -- The function F(u,v)=distance(P,S(u,v)) has an | |
50 | -- extremum when gradient(F)=0. The algorithm searchs | |
51 | -- all the zeros inside the definition ranges of the | |
52 | -- surface. | |
53 | -- NbU and NbV are used to locate the close points | |
54 | -- to find the zeros. They must be great enough | |
55 | -- such that if there is N extrema, there will | |
56 | -- be N extrema between P and the grid. | |
57 | -- TolU et TolV are used to determine the conditions | |
58 | -- to stop the iterations; at the iteration number n: | |
59 | -- (Un - Un-1) < TolU and (Vn - Vn-1) < TolV . | |
60 | ||
61 | ||
62 | Create (P: Pnt; S: Surface from Adaptor3d; NbU,NbV: Integer; | |
92d1589b | 63 | Umin, Usup, Vmin, Vsup: Real; TolU,TolV: Real; F : ExtFlag from Extrema = Extrema_ExtFlag_MINMAX; A : ExtAlgo from Extrema = Extrema_ExtAlgo_Grad) |
7fd59977 | 64 | returns GenExtPS; |
65 | ---Purpose: It calculates all the distances. | |
66 | -- The function F(u,v)=distance(P,S(u,v)) has an | |
67 | -- extremum when gradient(F)=0. The algorithm searchs | |
68 | -- all the zeros inside the definition ranges of the | |
69 | -- surface. | |
70 | -- NbU and NbV are used to locate the close points | |
71 | -- to find the zeros. They must be great enough | |
72 | -- such that if there is N extrema, there will | |
73 | -- be N extrema between P and the grid. | |
74 | -- TolU et TolV are used to determine the conditions | |
75 | -- to stop the iterations; at the iteration number n: | |
76 | -- (Un - Un-1) < TolU and (Vn - Vn-1) < TolV . | |
77 | ||
78 | ||
79 | Initialize(me: in out; S: Surface from Adaptor3d; NbU, NbV: Integer; TolU, TolV: Real) | |
80 | ---Pupose: sets the fields of the algorithm. | |
81 | is static; | |
82 | ||
83 | ||
84 | Initialize(me: in out; S: Surface from Adaptor3d; NbU, NbV: Integer; | |
85 | Umin, Usup, Vmin, Vsup: Real; TolU, TolV: Real) | |
86 | ---Pupose: sets the fields of the algorithm. | |
87 | is static; | |
88 | ||
89 | ||
90 | Perform(me: in out; P: Pnt from gp) | |
91 | ---Purpose: the algorithm is done with the point P. | |
92 | -- An exception is raised if the fields have not | |
93 | -- been initialized. | |
94 | raises TypeMismatch from Standard | |
95 | is static; | |
92d1589b A |
96 | |
97 | SetFlag(me : in out; F : ExtFlag from Extrema) | |
98 | is static; | |
99 | ||
100 | SetAlgo(me : in out; A : ExtAlgo from Extrema) | |
101 | is static; | |
7fd59977 | 102 | |
103 | ||
104 | IsDone (me) returns Boolean | |
105 | ---Purpose: Returns True if the distances are found. | |
106 | is static; | |
107 | ||
108 | NbExt (me) returns Integer | |
109 | ---Purpose: Returns the number of extremum distances. | |
110 | raises NotDone from StdFail | |
111 | -- if IsDone(me)=False. | |
112 | is static; | |
113 | ||
114 | SquareDistance (me; N: Integer) returns Real | |
115 | ---Purpose: Returns the value of the Nth resulting square distance. | |
116 | raises NotDone from StdFail, | |
117 | -- if IsDone(me)=False. | |
118 | OutOfRange | |
119 | -- if N < 1 or N > NbPoints(me). | |
120 | is static; | |
121 | ||
122 | Point (me; N: Integer) returns POnSurf | |
5d99f2c8 | 123 | ---C++: return const & |
7fd59977 | 124 | ---Purpose: Returns the point of the Nth resulting distance. |
125 | raises NotDone from StdFail, | |
126 | -- if IsDone(me)=False. | |
127 | OutOfRange | |
128 | -- if N < 1 or N > NbPoints(me). | |
129 | is static; | |
130 | ||
131 | Bidon(me) returns SurfacePtr from Adaptor3d | |
132 | is static private; | |
92d1589b A |
133 | |
134 | BuildTree(me : in out) | |
135 | is static private; | |
136 | ||
6060dd1f | 137 | FindSolution(me: in out; P : Pnt from gp; |
138 | theParams: POnSurfParams from Extrema) | |
92d1589b | 139 | is static private; |
5368adff | 140 | |
141 | GetGridPoints(me: in out; theSurf: Surface from Adaptor3d) is private; | |
142 | ---Purpose: Selection of points to build grid, depending on the type of surface | |
143 | ||
6060dd1f | 144 | BuildGrid(me: in out; thePoint: Pnt from gp) is private; |
5368adff | 145 | ---Purpose: Creation of grid of parametric points |
7fd59977 | 146 | |
147 | fields | |
148 | myDone : Boolean; | |
149 | myInit : Boolean; | |
150 | myumin : Real; | |
151 | myusup : Real; | |
152 | myvmin : Real; | |
153 | myvsup : Real; | |
154 | myusample : Integer; | |
155 | myvsample : Integer; | |
7fd59977 | 156 | mytolu : Real; |
157 | mytolv : Real; | |
6060dd1f | 158 | myPoints : HArray2OfPOnSurfParams from Extrema; |
92d1589b A |
159 | mySphereUBTree : HUBTreeOfSphere from Extrema; |
160 | mySphereArray : HArray1OfSphere from Bnd; | |
7fd59977 | 161 | myF : FuncExtPS from Extrema; |
162 | myS : SurfacePtr from Adaptor3d; | |
92d1589b A |
163 | myFlag : ExtFlag from Extrema; |
164 | myAlgo : ExtAlgo from Extrema; | |
5368adff | 165 | myUParams : HArray1OfReal from TColStd; |
166 | myVParams : HArray1OfReal from TColStd; | |
6060dd1f | 167 | myFacePntParams : HArray2OfPOnSurfParams from Extrema; |
7fd59977 | 168 | |
169 | end GenExtPS; |