42cf5bc1 |
1 | // Created on: 1996-01-18 |
2 | // Created by: Laurent PAINNOT |
3 | // Copyright (c) 1996-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License 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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Extrema_GenExtSS_HeaderFile |
18 | #define _Extrema_GenExtSS_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | #include <TColgp_HArray2OfPnt.hxx> |
28 | #include <Extrema_FuncExtSS.hxx> |
29 | #include <Adaptor3d_SurfacePtr.hxx> |
30 | class StdFail_NotDone; |
31 | class Standard_OutOfRange; |
32 | class Standard_TypeMismatch; |
33 | class Adaptor3d_Surface; |
34 | class Extrema_POnSurf; |
35 | |
36 | |
37 | //! It calculates all the extremum distances |
38 | //! between two surfaces. |
39 | //! These distances can be minimum or maximum. |
40 | class Extrema_GenExtSS |
41 | { |
42 | public: |
43 | |
44 | DEFINE_STANDARD_ALLOC |
45 | |
46 | |
47 | Standard_EXPORT Extrema_GenExtSS(); |
48 | |
49 | //! It calculates all the distances. |
50 | //! The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an |
51 | //! extremum when gradient(F)=0. The algorithm searchs |
52 | //! all the zeros inside the definition ranges of the |
53 | //! surfaces. |
54 | //! NbU and NbV are used to locate the close points |
55 | //! to find the zeros. |
56 | Standard_EXPORT Extrema_GenExtSS(const Adaptor3d_Surface& S1, const Adaptor3d_Surface& S2, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Tol1, const Standard_Real Tol2); |
57 | |
58 | //! It calculates all the distances. |
59 | //! The function F(u,v)=distance(P,S(u,v)) has an |
60 | //! extremum when gradient(F)=0. The algorithm searchs |
61 | //! all the zeros inside the definition ranges of the |
62 | //! surface. |
63 | //! NbU and NbV are used to locate the close points |
64 | //! to find the zeros. |
65 | Standard_EXPORT Extrema_GenExtSS(const Adaptor3d_Surface& S1, const Adaptor3d_Surface& S2, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real U1min, const Standard_Real U1sup, const Standard_Real V1min, const Standard_Real V1sup, const Standard_Real U2min, const Standard_Real U2sup, const Standard_Real V2min, const Standard_Real V2sup, const Standard_Real Tol1, const Standard_Real Tol2); |
66 | |
67 | Standard_EXPORT void Initialize (const Adaptor3d_Surface& S2, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Tol2); |
68 | |
69 | Standard_EXPORT void Initialize (const Adaptor3d_Surface& S2, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real U2min, const Standard_Real U2sup, const Standard_Real V2min, const Standard_Real V2sup, const Standard_Real Tol2); |
70 | |
71 | //! the algorithm is done with S1 |
72 | //! An exception is raised if the fields have not |
73 | //! been initialized. |
74 | Standard_EXPORT void Perform (const Adaptor3d_Surface& S1, const Standard_Real Tol1); |
75 | |
76 | //! the algorithm is done withS1 |
77 | //! An exception is raised if the fields have not |
78 | //! been initialized. |
79 | Standard_EXPORT void Perform (const Adaptor3d_Surface& S1, const Standard_Real U1min, const Standard_Real U1sup, const Standard_Real V1min, const Standard_Real V1sup, const Standard_Real Tol1); |
80 | |
81 | //! Returns True if the distances are found. |
82 | Standard_EXPORT Standard_Boolean IsDone() const; |
83 | |
84 | //! Returns the number of extremum distances. |
85 | Standard_EXPORT Standard_Integer NbExt() const; |
86 | |
87 | //! Returns the value of the Nth resulting square distance. |
88 | Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const; |
89 | |
90 | //! Returns the point of the Nth resulting distance. |
91 | Standard_EXPORT const Extrema_POnSurf& PointOnS1 (const Standard_Integer N) const; |
92 | |
93 | //! Returns the point of the Nth resulting distance. |
94 | Standard_EXPORT const Extrema_POnSurf& PointOnS2 (const Standard_Integer N) const; |
95 | |
96 | |
97 | |
98 | |
99 | protected: |
100 | |
101 | |
102 | |
103 | |
104 | |
105 | private: |
106 | |
107 | |
108 | Standard_EXPORT Adaptor3d_SurfacePtr Bidon() const; |
109 | |
110 | |
111 | Standard_Boolean myDone; |
112 | Standard_Boolean myInit; |
113 | Standard_Real myu1min; |
114 | Standard_Real myu1sup; |
115 | Standard_Real myv1min; |
116 | Standard_Real myv1sup; |
117 | Standard_Real myu2min; |
118 | Standard_Real myu2sup; |
119 | Standard_Real myv2min; |
120 | Standard_Real myv2sup; |
121 | Standard_Integer myusample; |
122 | Standard_Integer myvsample; |
123 | Handle(TColgp_HArray2OfPnt) mypoints1; |
124 | Handle(TColgp_HArray2OfPnt) mypoints2; |
125 | Standard_Real mytol1; |
126 | Standard_Real mytol2; |
127 | Extrema_FuncExtSS myF; |
128 | Adaptor3d_SurfacePtr myS2; |
129 | |
130 | |
131 | }; |
132 | |
133 | |
134 | |
135 | |
136 | |
137 | |
138 | |
139 | #endif // _Extrema_GenExtSS_HeaderFile |