summaryrefslogtreecommitdiff
path: root/inc/Poly_Connect.hxx
blob: 2c9a49bb54ca2a00b84c5b40c5d8adc79c994c4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _Poly_Connect_HeaderFile
#define _Poly_Connect_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif

#ifndef _Handle_Poly_Triangulation_HeaderFile
#include <Handle_Poly_Triangulation.hxx>
#endif
#ifndef _TColStd_Array1OfInteger_HeaderFile
#include <TColStd_Array1OfInteger.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
class Poly_Triangulation;



//! Provides an algorithm to explore, inside a triangulation, the <br>
//! adjacency data for a node or a triangle. <br>
//! Adjacency data for a node consists of triangles which <br>
//! contain the node. <br>
//! Adjacency data for a triangle consists of: <br>
//! -   the 3 adjacent triangles which share an edge of the triangle, <br>
//! -   and the 3 nodes which are the other nodes of these adjacent triangles. <br>
//! Example <br>
//! Inside a triangulation, a triangle T <br>
//! has nodes n1, n2 and n3. <br>
//! It has adjacent triangles AT1, AT2 and AT3 where: <br>
//! - AT1 shares the nodes n2 and n3, <br>
//! - AT2 shares the nodes n3 and n1, <br>
//! - AT3 shares the nodes n1 and n2. <br>
//! It has adjacent nodes an1, an2 and an3 where: <br>
//! - an1 is the third node of AT1, <br>
//! - an2 is the third node of AT2, <br>
//! - an3 is the third node of AT3. <br>
//! So triangle AT1 is composed of nodes n2, n3 and an1. <br>
//! There are two ways of using this algorithm. <br>
//! -   From a given node you can look for one triangle that <br>
//!   passes through the node, then look for the triangles <br>
//!   adjacent to this triangle, then the adjacent nodes. You <br>
//!   can thus explore the triangulation step by step (functions <br>
//!   Triangle, Triangles and Nodes). <br>
//! -   From a given node you can look for all the triangles <br>
//!   that pass through the node (iteration method, using the <br>
//!   functions Initialize, More, Next and Value). <br>
//! A Connect object can be seen as a tool which analyzes a <br>
//! triangulation and translates it into a series of triangles. By <br>
//! doing this, it provides an interface with other tools and <br>
//! applications working on basic triangles, and which do not <br>
//! work directly with a Poly_Triangulation. <br>
class Poly_Connect  {
public:

  void* operator new(size_t,void* anAddress) 
  {
    return anAddress;
  }
  void* operator new(size_t size) 
  {
    return Standard::Allocate(size); 
  }
  void  operator delete(void *anAddress) 
  {
    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
  }

  //! Constructs an algorithm to explore the adjacency data of <br>
//! nodes or triangles for the triangulation T. <br>
  Standard_EXPORT   Poly_Connect(const Handle(Poly_Triangulation)& T);
  //! Returns the triangulation analyzed by this tool. <br>
        Handle_Poly_Triangulation Triangulation() const;
  //! Returns the index of a triangle containing the node at <br>
//! index N in the nodes table specific to the triangulation analyzed by this tool <br>
        Standard_Integer Triangle(const Standard_Integer N) const;
  //! Returns in t1, t2 and t3, the indices of the 3 triangles <br>
//! adjacent to the triangle at index T in the triangles table <br>
//! specific to the triangulation analyzed by this tool. <br>
//! Warning <br>
//! Null indices are returned when there are fewer than 3 <br>
//! adjacent triangles. <br>
  Standard_EXPORT     void Triangles(const Standard_Integer T,Standard_Integer& t1,Standard_Integer& t2,Standard_Integer& t3) const;
  //! Returns, in n1, n2 and n3, the indices of the 3 nodes <br>
//! adjacent to the triangle referenced at index T in the <br>
//! triangles table specific to the triangulation analyzed by this tool. <br>
//! Warning <br>
//! Null indices are returned when there are fewer than 3 adjacent nodes. <br>
  Standard_EXPORT     void Nodes(const Standard_Integer T,Standard_Integer& n1,Standard_Integer& n2,Standard_Integer& n3) const;
  //! Initializes an iterator to search for all the triangles <br>
//! containing the node referenced at index N in the nodes <br>
//! table, for the triangulation analyzed by this tool. <br>
//! The iterator is managed by the following functions: <br>
//! -   More, which checks if there are still elements in the iterator <br>
//! -   Next, which positions the iterator on the next element <br>
//! -   Value, which returns the current element. <br>
//! The use of such an iterator provides direct access to the <br>
//! triangles around a particular node, i.e. it avoids iterating on <br>
//! all the component triangles of a triangulation. <br>
//! Example <br>
//! Poly_Connect C(Tr); <br>
//! for <br>
//! (C.Initialize(n1);C.More();C.Next()) <br>
//! { <br>
//!        t = C.Value(); <br>
//! } <br>
  Standard_EXPORT     void Initialize(const Standard_Integer N) ;
  //! Returns true if there is another element in the iterator <br>
//! defined with the function Initialize (i.e. if there is another <br>
//! triangle containing the given node). <br>
        Standard_Boolean More() const;
  //! Advances the iterator defined with the function Initialize to <br>
//! access the next triangle. <br>
//! Note: There is no action if the iterator is empty (i.e. if the <br>
//! function More returns false).- <br>
  Standard_EXPORT     void Next() ;
  //! Returns the index of the current triangle to which the <br>
//! iterator, defined with the function Initialize, points. This is <br>
//! an index in the triangles table specific to the triangulation <br>
//! analyzed by this tool <br>
  Standard_EXPORT     Standard_Integer Value() const;





protected:





private:



Handle_Poly_Triangulation myTriangulation;
TColStd_Array1OfInteger myTriangles;
TColStd_Array1OfInteger myAdjacents;
Standard_Integer mytr;
Standard_Integer myfirst;
Standard_Integer mynode;
Standard_Integer myothernode;
Standard_Boolean mysense;
Standard_Boolean mymore;


};


#include <Poly_Connect.lxx>



// other Inline functions and methods (like "C++: function call" methods)


#endif