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 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_GenExtCS_HeaderFile 18 #define _Extrema_GenExtCS_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 <Extrema_FuncExtCS.hxx> 28 #include <Adaptor3d_SurfacePtr.hxx> 29 #include <TColgp_HArray2OfPnt.hxx> 30 #include <Adaptor3d_CurvePtr.hxx> 31 class StdFail_NotDone; 32 class Standard_OutOfRange; 33 class Standard_TypeMismatch; 34 class Adaptor3d_Curve; 35 class Adaptor3d_Surface; 36 class Extrema_POnCurv; 37 class Extrema_POnSurf; 38 39 40 //! It calculates all the extremum distances 41 //! between acurve and a surface. 42 //! These distances can be minimum or maximum. 43 class Extrema_GenExtCS 44 { 45 public: 46 47 DEFINE_STANDARD_ALLOC 48 49 50 Standard_EXPORT Extrema_GenExtCS(); 51 52 //! It calculates all the distances. 53 //! The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an 54 //! extremum when gradient(F)=0. The algorithm searchs 55 //! all the zeros inside the definition ranges of the 56 //! surfaces. 57 //! NbU and NbV are used to locate the close points on the 58 //! surface and NbT on the curve to find the zeros. 59 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); 60 61 //! It calculates all the distances. 62 //! The function F(u,v)=distance(P,S(u,v)) has an 63 //! extremum when gradient(F)=0. The algorithm searchs 64 //! all the zeros inside the definition ranges of the 65 //! surface. 66 //! NbT,NbU and NbV are used to locate the close points 67 //! to find the zeros. 68 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); 69 70 Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Tol2); 71 72 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); 73 74 //! the algorithm is done with S 75 //! An exception is raised if the fields have not 76 //! been initialized. 77 Standard_EXPORT void Perform (const Adaptor3d_Curve& C, const Standard_Integer NbT, const Standard_Real Tol1); 78 79 //! the algorithm is done with C 80 //! An exception is raised if the fields have not 81 //! been initialized. 82 Standard_EXPORT void Perform (const Adaptor3d_Curve& C, const Standard_Integer NbT, const Standard_Real tmin, const Standard_Real tsup, const Standard_Real Tol1); 83 84 //! Returns True if the distances are found. 85 Standard_EXPORT Standard_Boolean IsDone() const; 86 87 //! Returns the number of extremum distances. 88 Standard_EXPORT Standard_Integer NbExt() const; 89 90 //! Returns the value of the Nth resulting square distance. 91 Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const; 92 93 //! Returns the point of the Nth resulting distance. 94 Standard_EXPORT const Extrema_POnCurv& PointOnCurve (const Standard_Integer N) const; 95 96 //! Returns the point of the Nth resulting distance. 97 Standard_EXPORT const Extrema_POnSurf& PointOnSurface (const Standard_Integer N) const; 98 99 100 101 102 protected: 103 104 105 106 107 108 private: 109 110 111 Standard_EXPORT Adaptor3d_CurvePtr BidonCurve() const; 112 113 Standard_EXPORT Adaptor3d_SurfacePtr BidonSurface() const; 114 115 116 Standard_Boolean myDone; 117 Standard_Boolean myInit; 118 Standard_Real mytmin; 119 Standard_Real mytsup; 120 Standard_Real myumin; 121 Standard_Real myusup; 122 Standard_Real myvmin; 123 Standard_Real myvsup; 124 Standard_Integer mytsample; 125 Standard_Integer myusample; 126 Standard_Integer myvsample; 127 Standard_Real mytol1; 128 Standard_Real mytol2; 129 Extrema_FuncExtCS myF; 130 Adaptor3d_SurfacePtr myS; 131 Handle(TColgp_HArray2OfPnt) mySurfPnts; 132 133 134 }; 135 136 137 138 139 140 141 142 #endif // _Extrema_GenExtCS_HeaderFile 143