0023404: Create SquareConfusion function in Precision package for speed and convenience
[occt.git] / src / Extrema / Extrema_GenExtSS.cdl
1 -- Created on: 1996-01-18
2 -- Created by: Laurent PAINNOT
3 -- Copyright (c) 1996-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
21
22 class   GenExtSS from Extrema 
23
24         ---Purpose: It calculates all the extremum distances
25         --          between two surfaces.
26         --          These distances can be minimum or maximum.
27
28 uses    POnSurf       from Extrema,
29         Pnt           from gp,
30         HArray2OfPnt  from TColgp,
31         FuncExtSS     from Extrema,
32         Surface       from Adaptor3d,
33         SurfacePtr    from Adaptor3d
34
35 raises  NotDone      from StdFail,
36         OutOfRange   from Standard,
37         TypeMismatch from Standard
38         
39
40 is
41
42     Create returns GenExtSS;
43     
44     Create (S1, S2: Surface from Adaptor3d; NbU,NbV: Integer; Tol1,Tol2: Real)
45         returns GenExtSS;
46         ---Purpose: It calculates all the distances.
47         --          The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an 
48         --          extremum when gradient(F)=0. The algorithm searchs
49         --          all the zeros inside the definition ranges of the 
50         --          surfaces.
51         --          NbU and NbV are used to locate the close points
52         --          to find the zeros. 
53
54     Create (S1, S2: Surface from Adaptor3d; NbU,NbV: Integer; 
55             U1min, U1sup, V1min, V1sup: Real; 
56             U2min, U2sup, V2min, V2sup: Real; 
57             Tol1,Tol2: Real)
58         returns GenExtSS;
59         ---Purpose: It calculates all the distances.
60         --          The function F(u,v)=distance(P,S(u,v)) has an 
61         --          extremum when gradient(F)=0. The algorithm searchs
62         --          all the zeros inside the definition ranges of the 
63         --          surface.
64         --          NbU and NbV are used to locate the close points
65         --          to find the zeros. 
66     
67     Initialize(me: in out; S2: Surface from Adaptor3d; 
68                NbU, NbV: Integer; Tol2: Real)
69         ---Pupose: sets the fields of the algorithm.
70     is static;
71
72
73     Initialize(me: in out; S2: Surface from Adaptor3d; NbU, NbV: Integer; 
74                U2min, U2sup, V2min, V2sup: Real; Tol2: Real)
75         ---Pupose: sets the fields of the algorithm.
76     is static;
77     
78
79     Perform(me: in out; S1: Surface from Adaptor3d; Tol1: Real)
80         ---Purpose: the algorithm is done with S1
81         --          An exception is raised if the fields have not
82         --          been initialized.  
83     raises TypeMismatch from Standard
84     is static;
85
86     Perform(me: in out; S1: Surface from Adaptor3d;
87             U1min, U1sup, V1min, V1sup: Real; Tol1: Real)
88         ---Purpose: the algorithm is done withS1
89         --          An exception is raised if the fields have not
90         --          been initialized.  
91     raises TypeMismatch from Standard
92     is static;
93
94
95     IsDone (me) returns Boolean
96         ---Purpose: Returns True if the distances are found.
97         is static;
98     
99     NbExt (me) returns Integer
100         ---Purpose: Returns the number of extremum distances.
101         raises  NotDone from StdFail
102                 -- if IsDone(me)=False.
103         is static;
104
105     SquareDistance (me; N: Integer) returns Real
106         ---Purpose: Returns the value of the Nth resulting square distance.
107         raises  NotDone from StdFail,
108                 -- if IsDone(me)=False.
109                 OutOfRange
110                 -- if N < 1 or N > NbPoints(me).
111         is static;
112
113     PointOnS1 (me; N: Integer) returns POnSurf
114         ---Purpose: Returns the point of the Nth resulting distance.
115         raises  NotDone from StdFail,
116                 -- if IsDone(me)=False.
117                 OutOfRange
118                 -- if N < 1 or N > NbPoints(me).
119         is static;
120
121     PointOnS2 (me; N: Integer) returns POnSurf
122         ---Purpose: Returns the point of the Nth resulting distance.
123         raises  NotDone from StdFail,
124                 -- if IsDone(me)=False.
125                 OutOfRange
126                 -- if N < 1 or N > NbPoints(me).
127         is static;
128
129     Bidon(me) returns SurfacePtr from Adaptor3d
130     is static private;
131
132 fields
133     myDone     : Boolean;
134     myInit     : Boolean;
135     myu1min    : Real;
136     myu1sup    : Real;
137     myv1min    : Real;
138     myv1sup    : Real;
139     myu2min    : Real;
140     myu2sup    : Real;
141     myv2min    : Real;
142     myv2sup    : Real;
143     myusample  : Integer;
144     myvsample  : Integer;
145     mypoints1  : HArray2OfPnt from TColgp;
146     mypoints2  : HArray2OfPnt from TColgp;
147     mytol1     : Real;
148     mytol2     : Real;
149     myF        : FuncExtSS from Extrema;
150     myS1       : SurfacePtr from Adaptor3d;
151     myS2       : SurfacePtr from Adaptor3d;
152
153 end GenExtSS;