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