42cf5bc1 |
1 | // Created on: 1995-03-06 |
2 | // Created by: Laurent PAINNOT |
3 | // Copyright (c) 1995-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 _Poly_Triangle_HeaderFile |
18 | #define _Poly_Triangle_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Integer.hxx> |
25 | class Standard_OutOfRange; |
26 | |
27 | |
28 | //! Describes a component triangle of a triangulation |
29 | //! (Poly_Triangulation object). |
30 | //! A Triangle is defined by a triplet of nodes. Each node is an |
31 | //! index in the table of nodes specific to an existing |
32 | //! triangulation of a shape, and represents a point on the surface. |
33 | class Poly_Triangle |
34 | { |
35 | public: |
36 | |
37 | DEFINE_STANDARD_ALLOC |
38 | |
39 | |
40 | //! Constructs a triangle and sets all indices to zero. |
41 | Standard_EXPORT Poly_Triangle(); |
42 | |
43 | //! Constructs a triangle and sets its three indices |
44 | //! to N1, N2 and N3 respectively, where these node values |
45 | //! are indices in the table of nodes specific to an existing |
46 | //! triangulation of a shape. |
47 | Standard_EXPORT Poly_Triangle(const Standard_Integer N1, const Standard_Integer N2, const Standard_Integer N3); |
48 | |
49 | //! Sets the value of the three nodes of this triangle to N1, N2 and N3 respectively. |
50 | Standard_EXPORT void Set (const Standard_Integer N1, const Standard_Integer N2, const Standard_Integer N3); |
51 | |
52 | //! Sets the value of the Indexth node of this triangle to Node. |
53 | //! Raises OutOfRange if Index is not in 1,2,3 |
54 | void Set (const Standard_Integer Index, const Standard_Integer Node); |
55 | |
56 | //! Returns the node indices of this triangle in N1, N2 and N3. |
57 | Standard_EXPORT void Get (Standard_Integer& N1, Standard_Integer& N2, Standard_Integer& N3) const; |
58 | |
59 | //! Get the node of given Index. |
60 | //! Raises OutOfRange from Standard if Index is not in 1,2,3 |
61 | Standard_Integer Value (const Standard_Integer Index) const; |
62 | Standard_Integer operator() (const Standard_Integer Index) const |
63 | { |
64 | return Value(Index); |
65 | } |
66 | |
67 | //! Get the node of given Index. |
68 | //! Raises OutOfRange if Index is not in 1,2,3 |
69 | Standard_Integer& ChangeValue (const Standard_Integer Index); |
70 | Standard_Integer& operator() (const Standard_Integer Index) |
71 | { |
72 | return ChangeValue(Index); |
73 | } |
74 | |
75 | |
76 | |
77 | |
78 | protected: |
79 | |
80 | |
81 | |
82 | |
83 | |
84 | private: |
85 | |
86 | |
87 | |
88 | Standard_Integer myNodes[3]; |
89 | |
90 | |
91 | }; |
92 | |
93 | |
94 | #include <Poly_Triangle.lxx> |
95 | |
96 | |
97 | |
98 | |
99 | |
100 | #endif // _Poly_Triangle_HeaderFile |