848fa7e3 |
1 | // Copyright (c) 2013 OPEN CASCADE SAS |
2 | // |
3 | // This file is part of Open CASCADE Technology software library. |
4 | // |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
10 | // |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
13 | |
14 | #ifndef _BRepMesh_OrientedEdge_HeaderFile |
15 | #define _BRepMesh_OrientedEdge_HeaderFile |
16 | |
17 | #include <Standard.hxx> |
18 | #include <Standard_DefineAlloc.hxx> |
19 | #include <Standard_Macro.hxx> |
20 | #include <BRepMesh_DegreeOfFreedom.hxx> |
21 | |
22 | //! Light weighted structure representing simple link. |
23 | class BRepMesh_OrientedEdge |
24 | { |
25 | public: |
26 | |
27 | DEFINE_STANDARD_ALLOC |
28 | |
29 | //! Default constructor. |
be5c3602 |
30 | BRepMesh_OrientedEdge() |
848fa7e3 |
31 | : myFirstNode(-1), |
32 | myLastNode(-1) |
33 | { |
34 | } |
35 | |
36 | //! Constructs a link between two vertices. |
be5c3602 |
37 | BRepMesh_OrientedEdge( |
848fa7e3 |
38 | const Standard_Integer theFirstNode, |
39 | const Standard_Integer theLastNode) |
40 | : myFirstNode(theFirstNode), |
41 | myLastNode(theLastNode) |
42 | { |
43 | } |
44 | |
45 | //! Returns index of first node of the Link. |
46 | inline Standard_Integer FirstNode() const |
47 | { |
48 | return myFirstNode; |
49 | } |
50 | |
51 | //! Returns index of last node of the Link. |
52 | inline Standard_Integer LastNode() const |
53 | { |
54 | return myLastNode; |
55 | } |
56 | |
57 | //! Returns hash code for this edge. |
58 | //! @param theUpper upper index in the container. |
59 | //! @return hash code. |
be5c3602 |
60 | Standard_Integer HashCode(const Standard_Integer theUpper) const |
848fa7e3 |
61 | { |
62 | return ::HashCode(myFirstNode + myLastNode, theUpper); |
63 | } |
64 | |
65 | //! Checks this and other edge for equality. |
66 | //! @param theOther edge to be checked against this one. |
67 | //! @retrun TRUE if edges have the same orientation, FALSE if not. |
68 | inline Standard_Boolean IsEqual(const BRepMesh_OrientedEdge& theOther) const |
69 | { |
70 | return (myFirstNode == theOther.myFirstNode && myLastNode == theOther.myLastNode); |
71 | } |
72 | |
73 | //! Alias for IsEqual. |
74 | Standard_Boolean operator ==(const BRepMesh_OrientedEdge& Other) const |
75 | { |
76 | return IsEqual(Other); |
77 | } |
78 | |
79 | private: |
80 | |
81 | Standard_Integer myFirstNode; |
82 | Standard_Integer myLastNode; |
83 | }; |
84 | |
85 | inline Standard_Integer HashCode(const BRepMesh_OrientedEdge& theEdge, |
86 | const Standard_Integer theUpper) |
87 | { |
88 | return theEdge.HashCode(theUpper); |
89 | } |
90 | |
91 | #endif |