1 // Created on: 1996-01-23
2 // Created by: Laurent PAINNOT
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Extrema_GenExtCS_HeaderFile
18 #define _Extrema_GenExtCS_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Real.hxx>
26 #include <Standard_Integer.hxx>
27 #include <Extrema_FuncExtCS.hxx>
28 #include <Adaptor3d_SurfacePtr.hxx>
29 #include <TColgp_HArray2OfPnt.hxx>
30 #include <Adaptor3d_CurvePtr.hxx>
32 class StdFail_NotDone;
33 class Standard_OutOfRange;
34 class Standard_TypeMismatch;
35 class Adaptor3d_Curve;
36 class Adaptor3d_Surface;
37 class Extrema_POnCurv;
38 class Extrema_POnSurf;
41 //! It calculates all the extremum distances
42 //! between acurve and a surface.
43 //! These distances can be minimum or maximum.
44 class Extrema_GenExtCS
51 Standard_EXPORT Extrema_GenExtCS();
53 //! It calculates all the distances.
54 //! The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an
55 //! extremum when gradient(F)=0. The algorithm searchs
56 //! all the zeros inside the definition ranges of the
58 //! NbU and NbV are used to locate the close points on the
59 //! surface and NbT on the curve to find the zeros.
60 Standard_EXPORT Extrema_GenExtCS(const Adaptor3d_Curve& C, const Adaptor3d_Surface& S, const Standard_Integer NbT, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Tol1, const Standard_Real Tol2);
62 //! It calculates all the distances.
63 //! The function F(u,v)=distance(P,S(u,v)) has an
64 //! extremum when gradient(F)=0. The algorithm searchs
65 //! all the zeros inside the definition ranges of the
67 //! NbT,NbU and NbV are used to locate the close points
68 //! to find the zeros.
69 Standard_EXPORT Extrema_GenExtCS(const Adaptor3d_Curve& C, const Adaptor3d_Surface& S, const Standard_Integer NbT, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real tmin, const Standard_Real tsup, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tol1, const Standard_Real Tol2);
71 Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Tol2);
73 Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tol2);
75 //! the algorithm is done with S
76 //! An exception is raised if the fields have not
78 Standard_EXPORT void Perform (const Adaptor3d_Curve& C, const Standard_Integer NbT, const Standard_Real Tol1);
80 //! the algorithm is done with C
81 //! An exception is raised if the fields have not
83 Standard_EXPORT void Perform (const Adaptor3d_Curve& C, const Standard_Integer NbT, const Standard_Real tmin, const Standard_Real tsup, const Standard_Real Tol1);
85 //! Returns True if the distances are found.
86 Standard_EXPORT Standard_Boolean IsDone() const;
88 //! Returns the number of extremum distances.
89 Standard_EXPORT Standard_Integer NbExt() const;
91 //! Returns the value of the Nth resulting square distance.
92 Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const;
94 //! Returns the point of the Nth resulting distance.
95 Standard_EXPORT const Extrema_POnCurv& PointOnCurve (const Standard_Integer N) const;
97 //! Returns the point of the Nth resulting distance.
98 Standard_EXPORT const Extrema_POnSurf& PointOnSurface (const Standard_Integer N) const;
112 Standard_EXPORT Adaptor3d_CurvePtr BidonCurve() const;
114 Standard_EXPORT Adaptor3d_SurfacePtr BidonSurface() const;
116 Standard_EXPORT void GlobMinGenCS(const Adaptor3d_Curve& theC,
117 const Standard_Integer theNbParticles,
118 const math_Vector& theTUVinf,
119 const math_Vector& theTUVsup,
120 math_Vector& theTUV);
122 Standard_EXPORT void GlobMinConicS(const Adaptor3d_Curve& theC,
123 const Standard_Integer theNbParticles,
124 const math_Vector& theTUVinf,
125 const math_Vector& theTUVsup,
126 math_Vector& theTUV);
128 Standard_EXPORT void GlobMinCQuadric(const Adaptor3d_Curve& theC,
129 const Standard_Integer theNbParticles,
130 const math_Vector& theTUVinf,
131 const math_Vector& theTUVsup,
132 math_Vector& theTUV);
135 Standard_Boolean myDone;
136 Standard_Real mytmin;
137 Standard_Real mytsup;
138 Standard_Real myumin;
139 Standard_Real myusup;
140 Standard_Real myvmin;
141 Standard_Real myvsup;
142 Standard_Integer mytsample;
143 Standard_Integer myusample;
144 Standard_Integer myvsample;
145 Standard_Real mytol1;
146 Standard_Real mytol2;
147 Extrema_FuncExtCS myF;
148 Adaptor3d_SurfacePtr myS;
149 Handle(TColgp_HArray2OfPnt) mySurfPnts;
160 #endif // _Extrema_GenExtCS_HeaderFile