0030686: Visualization, SelectMgr_ViewerSelector - sorting issues of transformation...
[occt.git] / src / IntCurveSurface / IntCurveSurface_ThePolyhedronOfHInter.hxx
1 // Created on: 1993-04-07
2 // Created by: Laurent BUCHARD
3 // Copyright (c) 1993-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 _IntCurveSurface_ThePolyhedronOfHInter_HeaderFile
18 #define _IntCurveSurface_ThePolyhedronOfHInter_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Integer.hxx>
25 #include <Bnd_Box.hxx>
26 #include <Bnd_HArray1OfBox.hxx>
27 #include <Standard_Real.hxx>
28 #include <Standard_Address.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <TColStd_Array1OfReal.hxx>
31 class Standard_OutOfRange;
32 class Adaptor3d_HSurface;
33 class Adaptor3d_HSurfaceTool;
34 class gp_Pnt;
35 class Bnd_Box;
36 class gp_XYZ;
37
38
39
40 class IntCurveSurface_ThePolyhedronOfHInter 
41 {
42 public:
43
44   DEFINE_STANDARD_ALLOC
45
46   
47   Standard_EXPORT IntCurveSurface_ThePolyhedronOfHInter(const Handle(Adaptor3d_HSurface)& Surface, const Standard_Integer nbdU, const Standard_Integer nbdV, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2);
48   
49   Standard_EXPORT IntCurveSurface_ThePolyhedronOfHInter(const Handle(Adaptor3d_HSurface)& Surface, const TColStd_Array1OfReal& Upars, const TColStd_Array1OfReal& Vpars);
50   
51   Standard_EXPORT void Destroy();
52 ~IntCurveSurface_ThePolyhedronOfHInter()
53 {
54   Destroy();
55 }
56   
57   Standard_EXPORT void DeflectionOverEstimation (const Standard_Real flec);
58   
59   Standard_EXPORT Standard_Real DeflectionOnTriangle (const Handle(Adaptor3d_HSurface)& Surface, const Standard_Integer Index) const;
60   
61   Standard_EXPORT void UMinSingularity (const Standard_Boolean Sing);
62   
63   Standard_EXPORT void UMaxSingularity (const Standard_Boolean Sing);
64   
65   Standard_EXPORT void VMinSingularity (const Standard_Boolean Sing);
66   
67   Standard_EXPORT void VMaxSingularity (const Standard_Boolean Sing);
68   
69   //! get the size of the discretization.
70   Standard_EXPORT void Size (Standard_Integer& nbdu, Standard_Integer& nbdv) const;
71   
72   //! Give the number of triangles in this double array of
73   Standard_EXPORT Standard_Integer NbTriangles() const;
74   
75   //! Give the 3 points of the triangle of addresse Index in
76   //! the double array of triangles.
77   Standard_EXPORT void Triangle (const Standard_Integer Index, Standard_Integer& P1, Standard_Integer& P2, Standard_Integer& P3) const;
78   
79   //! Give the addresse Tricon of the triangle connexe to the
80   //! triangle of address Triang by the edge Pivot Pedge and
81   //! the third point of this connexe triangle. When we are
82   //! on a free edge TriCon==0 but the function return the
83   //! value of the triangle in the other side of Pivot on
84   //! the free edge. Used to turn around a vertex.
85   Standard_EXPORT Standard_Integer TriConnex (const Standard_Integer Triang, const Standard_Integer Pivot, const Standard_Integer Pedge, Standard_Integer& TriCon, Standard_Integer& OtherP) const;
86   
87   //! Give the number of point in the double array of
88   //! triangles ((nbdu+1)*(nbdv+1)).
89   Standard_EXPORT Standard_Integer NbPoints() const;
90   
91   //! Set the value of a field of the double array of
92   //! points.
93   Standard_EXPORT void Point (const gp_Pnt& thePnt, const Standard_Integer lig, const Standard_Integer col, const Standard_Real U, const Standard_Real V);
94   
95   //! Give the point of index i in the MaTriangle.
96   Standard_EXPORT const gp_Pnt& Point (const Standard_Integer Index, Standard_Real& U, Standard_Real& V) const;
97   
98   //! Give the point of index i in the MaTriangle.
99   Standard_EXPORT const gp_Pnt& Point (const Standard_Integer Index) const;
100   
101   //! Give the point of index i in the MaTriangle.
102   Standard_EXPORT void Point (const Standard_Integer Index, gp_Pnt& P) const;
103   
104   //! Give the bounding box of the MaTriangle.
105   Standard_EXPORT const Bnd_Box& Bounding() const;
106   
107   //! Compute the array of boxes. The box <n> corresponding
108   //! to the triangle <n>.
109   Standard_EXPORT void FillBounding();
110   
111   //! Give the array of boxes. The box <n> corresponding
112   //! to the triangle <n>.
113   Standard_EXPORT const Handle(Bnd_HArray1OfBox)& ComponentsBounding() const;
114   
115   Standard_EXPORT Standard_Real DeflectionOverEstimation() const;
116   
117   Standard_EXPORT Standard_Boolean HasUMinSingularity() const;
118   
119   Standard_EXPORT Standard_Boolean HasUMaxSingularity() const;
120   
121   Standard_EXPORT Standard_Boolean HasVMinSingularity() const;
122   
123   Standard_EXPORT Standard_Boolean HasVMaxSingularity() const;
124   
125   //! Give the plane equation of the triangle of addresse Triang.
126   Standard_EXPORT void PlaneEquation (const Standard_Integer Triang, gp_XYZ& NormalVector, Standard_Real& PolarDistance) const;
127   
128   //! Give the plane equation of the triangle of addresse Triang.
129   Standard_EXPORT Standard_Boolean Contain (const Standard_Integer Triang, const gp_Pnt& ThePnt) const;
130   
131   Standard_EXPORT void Parameters (const Standard_Integer Index, Standard_Real& U, Standard_Real& V) const;
132   
133   //! This method returns true if the edge based on points with
134   //! indices Index1 and Index2 represents a boundary edge. It is
135   //! necessary to take into account the boundary deflection for
136   //! this edge.
137   Standard_EXPORT Standard_Boolean IsOnBound (const Standard_Integer Index1, const Standard_Integer Index2) const;
138   
139   //! This method returns a border deflection.
140     Standard_Real GetBorderDeflection() const;
141   
142   Standard_EXPORT void Dump() const;
143
144
145
146
147 protected:
148
149   
150   Standard_EXPORT void Init (const Handle(Adaptor3d_HSurface)& Surface, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2);
151   
152   Standard_EXPORT void Init (const Handle(Adaptor3d_HSurface)& Surface, const TColStd_Array1OfReal& Upars, const TColStd_Array1OfReal& Vpars);
153
154
155
156
157 private:
158
159   
160   //! This method computes and returns a deflection of isoline
161   //! of given parameter on Surface.
162   Standard_EXPORT Standard_Real ComputeBorderDeflection (const Handle(Adaptor3d_HSurface)& Surface, const Standard_Real Parameter, const Standard_Real PMin, const Standard_Real PMax, const Standard_Boolean isUIso) const;
163
164
165   Standard_Integer nbdeltaU;
166   Standard_Integer nbdeltaV;
167   Bnd_Box TheBnd;
168   Handle(Bnd_HArray1OfBox) TheComponentsBnd;
169   Standard_Real TheDeflection;
170   Standard_Address C_MyPnts;
171   Standard_Address C_MyU;
172   Standard_Address C_MyV;
173   Standard_Boolean UMinSingular;
174   Standard_Boolean UMaxSingular;
175   Standard_Boolean VMinSingular;
176   Standard_Boolean VMaxSingular;
177   Standard_Real TheBorderDeflection;
178   Standard_Address C_MyIsOnBounds;
179
180
181 };
182
183 #define ThePSurface Handle(Adaptor3d_HSurface)
184 #define ThePSurface_hxx <Adaptor3d_HSurface.hxx>
185 #define ThePSurfaceTool Adaptor3d_HSurfaceTool
186 #define ThePSurfaceTool_hxx <Adaptor3d_HSurfaceTool.hxx>
187 #define IntCurveSurface_Polyhedron IntCurveSurface_ThePolyhedronOfHInter
188 #define IntCurveSurface_Polyhedron_hxx <IntCurveSurface_ThePolyhedronOfHInter.hxx>
189
190 #include <IntCurveSurface_Polyhedron.lxx>
191
192 #undef ThePSurface
193 #undef ThePSurface_hxx
194 #undef ThePSurfaceTool
195 #undef ThePSurfaceTool_hxx
196 #undef IntCurveSurface_Polyhedron
197 #undef IntCurveSurface_Polyhedron_hxx
198
199
200
201
202 #endif // _IntCurveSurface_ThePolyhedronOfHInter_HeaderFile