42cf5bc1 |
1 | // Created on: 1994-02-01 |
2 | // Created by: Laurent PAINNOT |
3 | // Copyright (c) 1994-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_ExtPS_HeaderFile |
18 | #define _Extrema_ExtPS_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Adaptor3d_SurfacePtr.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <Extrema_ExtPElS.hxx> |
27 | #include <Extrema_GenExtPS.hxx> |
28 | #include <Extrema_SequenceOfPOnSurf.hxx> |
29 | #include <Standard_Real.hxx> |
30 | #include <gp_Pnt.hxx> |
31 | #include <TColStd_SequenceOfReal.hxx> |
32 | #include <GeomAbs_SurfaceType.hxx> |
33 | #include <Extrema_ExtFlag.hxx> |
34 | #include <Extrema_ExtAlgo.hxx> |
35 | #include <Standard_Integer.hxx> |
36 | class Extrema_ExtPExtS; |
37 | class Extrema_ExtPRevS; |
38 | class StdFail_NotDone; |
39 | class Standard_OutOfRange; |
40 | class Standard_TypeMismatch; |
41 | class gp_Pnt; |
42 | class Adaptor3d_Surface; |
43 | class Extrema_POnSurf; |
44 | |
45 | |
46 | //! It calculates all the extremum distances |
47 | //! between a point and a surface. |
48 | //! These distances can be minimum or maximum. |
49 | class Extrema_ExtPS |
50 | { |
51 | public: |
52 | |
53 | DEFINE_STANDARD_ALLOC |
54 | |
55 | |
56 | Standard_EXPORT Extrema_ExtPS(); |
57 | |
58 | //! It calculates all the distances. |
59 | //! NbU and NbV are used to locate the close points |
60 | //! to find the zeros. They must be great enough |
61 | //! such that if there is N extrema, there will |
62 | //! be N extrema between P and the grid. |
63 | //! TolU et TolV are used to determine the conditions |
64 | //! to stop the iterations; at the iteration number n: |
65 | //! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV . |
66 | Standard_EXPORT Extrema_ExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S, const Standard_Real TolU, const Standard_Real TolV, const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad); |
67 | |
68 | //! It calculates all the distances. |
69 | //! NbU and NbV are used to locate the close points |
70 | //! to find the zeros. They must be great enough |
71 | //! such that if there is N extrema, there will |
72 | //! be N extrema between P and the grid. |
73 | //! TolU et TolV are used to determine the conditions |
74 | //! to stop the iterations; at the iteration number n: |
75 | //! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV . |
76 | Standard_EXPORT Extrema_ExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV, const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad); |
77 | |
78 | //! Initializes the fields of the algorithm. |
79 | Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV); |
80 | |
81 | //! Computes the distances. |
82 | //! An exception is raised if the fieds have not been |
83 | //! initialized. |
84 | Standard_EXPORT void Perform (const gp_Pnt& P); |
85 | |
86 | //! Returns True if the distances are found. |
87 | Standard_EXPORT Standard_Boolean IsDone() const; |
88 | |
89 | //! Returns the number of extremum distances. |
90 | Standard_EXPORT Standard_Integer NbExt() const; |
91 | |
92 | //! Returns the value of the Nth resulting square distance. |
93 | Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const; |
94 | |
95 | //! Returns the point of the Nth resulting distance. |
96 | Standard_EXPORT const Extrema_POnSurf& Point (const Standard_Integer N) const; |
97 | |
98 | //! if the surface is a trimmed surface, |
99 | //! dUfVf is a square distance between <P> and the point |
100 | //! of parameter FirstUParameter and FirstVParameter <PUfVf>. |
101 | //! dUfVl is a square distance between <P> and the point |
102 | //! of parameter FirstUParameter and LastVParameter <PUfVl>. |
103 | //! dUlVf is a square distance between <P> and the point |
104 | //! of parameter LastUParameter and FirstVParameter <PUlVf>. |
105 | //! dUlVl is a square distance between <P> and the point |
106 | //! of parameter LastUParameter and LastVParameter <PUlVl>. |
107 | Standard_EXPORT void TrimmedSquareDistances (Standard_Real& dUfVf, Standard_Real& dUfVl, Standard_Real& dUlVf, Standard_Real& dUlVl, gp_Pnt& PUfVf, gp_Pnt& PUfVl, gp_Pnt& PUlVf, gp_Pnt& PUlVl) const; |
108 | |
109 | Standard_EXPORT void SetFlag (const Extrema_ExtFlag F); |
110 | |
111 | Standard_EXPORT void SetAlgo (const Extrema_ExtAlgo A); |
112 | |
113 | |
114 | |
115 | |
116 | protected: |
117 | |
118 | |
119 | |
120 | |
121 | |
122 | private: |
123 | |
124 | |
125 | Standard_EXPORT Adaptor3d_SurfacePtr Bidon() const; |
126 | |
127 | Standard_EXPORT void TreatSolution (const Extrema_POnSurf& PS, const Standard_Real Val); |
128 | |
129 | |
130 | Adaptor3d_SurfacePtr myS; |
131 | Standard_Boolean myDone; |
132 | Extrema_ExtPElS myExtPElS; |
133 | Extrema_GenExtPS myExtPS; |
134 | Extrema_SequenceOfPOnSurf myPoints; |
135 | Standard_Real myuinf; |
136 | Standard_Real myusup; |
137 | Standard_Real myvinf; |
138 | Standard_Real myvsup; |
139 | Standard_Real mytolu; |
140 | Standard_Real mytolv; |
141 | Standard_Real d11; |
142 | Standard_Real d12; |
143 | Standard_Real d21; |
144 | Standard_Real d22; |
145 | gp_Pnt P11; |
146 | gp_Pnt P12; |
147 | gp_Pnt P21; |
148 | gp_Pnt P22; |
149 | TColStd_SequenceOfReal mySqDist; |
150 | GeomAbs_SurfaceType mytype; |
151 | Handle(Extrema_ExtPExtS) myExtPExtS; |
152 | Handle(Extrema_ExtPRevS) myExtPRevS; |
153 | |
154 | |
155 | }; |
156 | |
157 | |
158 | |
159 | |
160 | |
161 | |
162 | |
163 | #endif // _Extrema_ExtPS_HeaderFile |