1 -- Created on: 1996-01-23
2 -- Created by: Laurent PAINNOT
3 -- Copyright (c) 1996-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.
22 class GenExtCS from Extrema
24 ---Purpose: It calculates all the extremum distances
25 -- between acurve and a surface.
26 -- These distances can be minimum or maximum.
28 uses POnSurf from Extrema,
31 HArray1OfPnt from TColgp,
32 HArray2OfPnt from TColgp,
33 FuncExtCS from Extrema,
34 Surface from Adaptor3d,
35 SurfacePtr from Adaptor3d,
37 CurvePtr from Adaptor3d
39 raises NotDone from StdFail,
40 OutOfRange from Standard,
41 TypeMismatch from Standard
46 Create returns GenExtCS;
48 Create (C: Curve from Adaptor3d; S: Surface from Adaptor3d;
49 NbT: Integer; NbU,NbV: Integer; Tol1,Tol2: Real)
51 ---Purpose: It calculates all the distances.
52 -- The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an
53 -- extremum when gradient(F)=0. The algorithm searchs
54 -- all the zeros inside the definition ranges of the
56 -- NbU and NbV are used to locate the close points on the
57 -- surface and NbT on the curve to find the zeros.
59 Create (C: Curve from Adaptor3d; S: Surface from Adaptor3d;
62 Umin, Usup, Vmin, Vsup: Real;
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
70 -- NbT,NbU and NbV are used to locate the close points
73 Initialize(me: in out; S: Surface from Adaptor3d;
74 NbU, NbV: Integer; Tol2: Real)
75 ---Pupose: sets the fields of the algorithm.
79 Initialize(me: in out; S: Surface from Adaptor3d; NbU, NbV: Integer;
80 Umin, Usup, Vmin, Vsup: Real; Tol2: Real)
81 ---Pupose: sets the fields of the algorithm.
85 Perform(me: in out; C: Curve from Adaptor3d;
86 NbT: Integer; Tol1: Real)
87 ---Purpose: the algorithm is done with S
88 -- An exception is raised if the fields have not
90 raises TypeMismatch from Standard
93 Perform(me: in out; C: Curve from Adaptor3d; NbT: Integer;
94 tmin, tsup: Real; Tol1: Real)
95 ---Purpose: the algorithm is done with C
96 -- An exception is raised if the fields have not
98 raises TypeMismatch from Standard
102 IsDone (me) returns Boolean
103 ---Purpose: Returns True if the distances are found.
106 NbExt (me) returns Integer
107 ---Purpose: Returns the number of extremum distances.
108 raises NotDone from StdFail
109 -- if IsDone(me)=False.
112 SquareDistance(me; N: Integer) returns Real
113 ---Purpose: Returns the value of the Nth resulting square distance.
114 raises NotDone from StdFail,
115 -- if IsDone(me)=False.
117 -- if N < 1 or N > NbPoints(me).
120 PointOnCurve (me; N: Integer) returns POnCurv
121 ---Purpose: Returns the point of the Nth resulting distance.
122 ---C++: return const&
123 raises NotDone from StdFail,
124 -- if IsDone(me)=False.
126 -- if N < 1 or N > NbPoints(me).
129 PointOnSurface (me; N: Integer) returns POnSurf
130 ---Purpose: Returns the point of the Nth resulting distance.
131 ---C++: return const&
132 raises NotDone from StdFail,
133 -- if IsDone(me)=False.
135 -- if N < 1 or N > NbPoints(me).
138 BidonCurve(me) returns CurvePtr from Adaptor3d
141 BidonSurface(me) returns SurfacePtr from Adaptor3d
156 mypoints1 : HArray1OfPnt from TColgp;
157 mypoints2 : HArray2OfPnt from TColgp;
160 myF : FuncExtCS from Extrema;
161 myC : CurvePtr from Adaptor3d;
162 myS : SurfacePtr from Adaptor3d;