42cf5bc1 |
1 | // Created on: 1993-02-03 |
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 _IntPatch_Polyhedron_HeaderFile |
18 | #define _IntPatch_Polyhedron_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Bnd_Box.hxx> |
25 | #include <Bnd_HArray1OfBox.hxx> |
26 | #include <Standard_Real.hxx> |
27 | #include <Standard_Integer.hxx> |
28 | #include <Standard_Address.hxx> |
29 | #include <Standard_Boolean.hxx> |
30 | class Standard_OutOfRange; |
31 | class Adaptor3d_HSurface; |
32 | class gp_Pnt; |
33 | class Bnd_Box; |
34 | class gp_XYZ; |
35 | |
36 | |
37 | //! This class provides a linear approximation of the PSurface. |
38 | //! preview a constructor on a zone of a surface |
39 | class IntPatch_Polyhedron |
40 | { |
41 | public: |
42 | |
43 | DEFINE_STANDARD_ALLOC |
44 | |
45 | |
46 | //! MaTriangle constructor with an double array of pnt for the |
47 | //! representation of a double array of triangles. |
48 | Standard_EXPORT IntPatch_Polyhedron(const Handle(Adaptor3d_HSurface)& Surface, const Standard_Integer nbdU, const Standard_Integer nbdV); |
49 | |
50 | Standard_EXPORT IntPatch_Polyhedron(const Handle(Adaptor3d_HSurface)& Surface); |
51 | |
52 | Standard_EXPORT void Destroy(); |
53 | ~IntPatch_Polyhedron() |
54 | { |
55 | Destroy(); |
56 | } |
57 | |
58 | Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Surface, const Standard_Integer nbdU, const Standard_Integer nbdV); |
59 | |
60 | Standard_EXPORT void DeflectionOverEstimation (const Standard_Real flec); |
61 | |
62 | Standard_EXPORT Standard_Real DeflectionOnTriangle (const Handle(Adaptor3d_HSurface)& Surface, const Standard_Integer Index) const; |
63 | |
64 | Standard_EXPORT void UMinSingularity (const Standard_Boolean Sing); |
65 | |
66 | Standard_EXPORT void UMaxSingularity (const Standard_Boolean Sing); |
67 | |
68 | Standard_EXPORT void VMinSingularity (const Standard_Boolean Sing); |
69 | |
70 | Standard_EXPORT void VMaxSingularity (const Standard_Boolean Sing); |
71 | |
72 | //! Get the size of the MaTriangle. |
73 | Standard_EXPORT void Size (Standard_Integer& nbdu, Standard_Integer& nbdv) const; |
74 | |
75 | //! Give the number of triangles in this double array of |
76 | //! triangles (nbdu*nbdv*2). |
77 | Standard_EXPORT Standard_Integer NbTriangles() const; |
78 | |
79 | //! Give the 3 points of the triangle of addresse Index in |
80 | //! the double array of triangles. |
81 | Standard_EXPORT void Triangle (const Standard_Integer Index, Standard_Integer& P1, Standard_Integer& P2, Standard_Integer& P3) const; |
82 | |
83 | //! Give the addresse Tricon of the triangle connexe to the |
84 | //! triangle of address Triang by the edge Pivot Pedge and |
85 | //! the third point of this connexe triangle. When we are |
86 | //! on a free edge TriCon==0 but the function return the |
87 | //! value of the triangle in the other side of Pivot on |
88 | //! the free edge. Used to turn around a vertex. |
89 | Standard_EXPORT Standard_Integer TriConnex (const Standard_Integer Triang, const Standard_Integer Pivot, const Standard_Integer Pedge, Standard_Integer& TriCon, Standard_Integer& OtherP) const; |
90 | |
91 | //! Give the number of point in the double array of |
92 | //! triangles ((nbdu+1)*(nbdv+1)). |
93 | Standard_EXPORT Standard_Integer NbPoints() const; |
94 | |
95 | //! Set the value of a field of the double array of |
96 | //! points. |
97 | Standard_EXPORT void Point (const gp_Pnt& thePnt, const Standard_Integer lig, const Standard_Integer col, const Standard_Real U, const Standard_Real V); |
98 | |
99 | //! Give the point of index i in the MaTriangle. |
100 | Standard_EXPORT const gp_Pnt& Point (const Standard_Integer Index, Standard_Real& U, Standard_Real& V) const; |
101 | |
102 | //! Give the point of index i in the MaTriangle. |
103 | Standard_EXPORT const gp_Pnt& Point (const Standard_Integer Index) const; |
104 | |
105 | //! Give the point of index i in the MaTriangle. |
106 | Standard_EXPORT void Point (const Standard_Integer Index, gp_Pnt& P) const; |
107 | |
108 | //! Give the bounding box of the MaTriangle. |
109 | Standard_EXPORT const Bnd_Box& Bounding() const; |
110 | |
111 | //! Compute the array of boxes. The box <n> corresponding |
112 | //! to the triangle <n>. |
113 | Standard_EXPORT void FillBounding(); |
114 | |
115 | //! Give the array of boxes. The box <n> corresponding |
116 | //! to the triangle <n>. |
117 | Standard_EXPORT const Handle(Bnd_HArray1OfBox)& ComponentsBounding() const; |
118 | |
119 | Standard_EXPORT Standard_Real DeflectionOverEstimation() const; |
120 | |
121 | Standard_EXPORT Standard_Boolean HasUMinSingularity() const; |
122 | |
123 | Standard_EXPORT Standard_Boolean HasUMaxSingularity() const; |
124 | |
125 | Standard_EXPORT Standard_Boolean HasVMinSingularity() const; |
126 | |
127 | Standard_EXPORT Standard_Boolean HasVMaxSingularity() const; |
128 | |
129 | //! Give the plane equation of the triangle of addresse Triang. |
130 | Standard_EXPORT void PlaneEquation (const Standard_Integer Triang, gp_XYZ& NormalVector, Standard_Real& PolarDistance) const; |
131 | |
132 | //! Give the plane equation of the triangle of addresse Triang. |
133 | Standard_EXPORT Standard_Boolean Contain (const Standard_Integer Triang, const gp_Pnt& ThePnt) const; |
134 | |
135 | Standard_EXPORT void Parameters (const Standard_Integer Index, Standard_Real& U, Standard_Real& V) const; |
136 | |
137 | Standard_EXPORT void Dump() const; |
138 | |
139 | |
140 | |
141 | |
142 | protected: |
143 | |
144 | |
145 | |
146 | |
147 | |
148 | private: |
149 | |
150 | |
151 | |
152 | Bnd_Box TheBnd; |
153 | Handle(Bnd_HArray1OfBox) TheComponentsBnd; |
154 | Standard_Real TheDeflection; |
155 | Standard_Integer nbdeltaU; |
156 | Standard_Integer nbdeltaV; |
157 | Standard_Address C_MyPnts; |
158 | Standard_Address C_MyU; |
159 | Standard_Address C_MyV; |
160 | Standard_Boolean UMinSingular; |
161 | Standard_Boolean UMaxSingular; |
162 | Standard_Boolean VMinSingular; |
163 | Standard_Boolean VMaxSingular; |
164 | |
165 | |
166 | }; |
167 | |
168 | |
169 | |
170 | |
171 | |
172 | |
173 | |
174 | #endif // _IntPatch_Polyhedron_HeaderFile |