1 // Copyright (c) 2013 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef _BRepMesh_OrientedEdge_HeaderFile
15 #define _BRepMesh_OrientedEdge_HeaderFile
17 #include <Standard.hxx>
18 #include <Standard_DefineAlloc.hxx>
19 #include <Standard_Macro.hxx>
20 #include <BRepMesh_DegreeOfFreedom.hxx>
22 //! Light weighted structure representing simple link.
23 class BRepMesh_OrientedEdge
29 //! Default constructor.
30 BRepMesh_OrientedEdge()
36 //! Constructs a link between two vertices.
37 BRepMesh_OrientedEdge(
38 const Standard_Integer theFirstNode,
39 const Standard_Integer theLastNode)
40 : myFirstNode(theFirstNode),
41 myLastNode(theLastNode)
45 //! Returns index of first node of the Link.
46 Standard_Integer FirstNode() const
51 //! Returns index of last node of the Link.
52 Standard_Integer LastNode() const
57 //! Computes a hash code for this oriented edge, in the range [1, theUpperBound]
58 //! @param theUpperBound the upper bound of the range a computing hash code must be within
59 //! @return a computed hash code, in the range [1, theUpperBound]
60 Standard_Integer HashCode (const Standard_Integer theUpperBound) const
62 return ::HashCode (myFirstNode + myLastNode, theUpperBound);
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 Standard_Boolean IsEqual(const BRepMesh_OrientedEdge& theOther) const
70 return (myFirstNode == theOther.myFirstNode && myLastNode == theOther.myLastNode);
73 //! Alias for IsEqual.
74 Standard_Boolean operator ==(const BRepMesh_OrientedEdge& Other) const
76 return IsEqual(Other);
81 Standard_Integer myFirstNode;
82 Standard_Integer myLastNode;
85 //! Computes a hash code for the given oriented edge, in the range [1, theUpperBound]
86 //! @param theOrientedEdge the oriented edge which hash code is to be computed
87 //! @param theUpperBound the upper bound of the range a computing hash code must be within
88 //! @return a computed hash code, in the range [1, theUpperBound]
89 inline Standard_Integer HashCode (const BRepMesh_OrientedEdge& theOrientedEdge, const Standard_Integer theUpperBound)
91 return theOrientedEdge.HashCode (theUpperBound);