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_Edge_HeaderFile
15 #define _BRepMesh_Edge_HeaderFile
17 #include <Standard.hxx>
18 #include <Standard_DefineAlloc.hxx>
19 #include <Standard_Macro.hxx>
20 #include <BRepMesh_DegreeOfFreedom.hxx>
21 #include <BRepMesh_OrientedEdge.hxx>
23 //! Light weighted structure representing link of the mesh.
24 class BRepMesh_Edge : public BRepMesh_OrientedEdge
28 //! Default constructor.
30 : BRepMesh_OrientedEdge(),
31 myMovability(BRepMesh_Deleted)
35 //! Constructs a link between two vertices.
37 const Standard_Integer theFirstNode,
38 const Standard_Integer theLastNode,
39 const BRepMesh_DegreeOfFreedom theMovability)
40 : BRepMesh_OrientedEdge(theFirstNode, theLastNode),
41 myMovability(theMovability)
45 //! Returns movability flag of the Link.
46 inline BRepMesh_DegreeOfFreedom Movability() const
51 //! Sets movability flag of the Link.
52 //! @param theMovability flag to be set.
53 inline void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
55 myMovability = theMovability;
58 //! Checks if the given edge and this one have the same orientation.
59 //! @param theOther edge to be checked against this one.
60 //! \retrun TRUE if edges have the same orientation, FALSE if not.
61 inline Standard_Boolean IsSameOrientation(const BRepMesh_Edge& theOther) const
63 return BRepMesh_OrientedEdge::IsEqual(theOther);
66 //! Checks for equality with another edge.
67 //! @param theOther edge to be checked against this one.
68 //! @return TRUE if equal, FALSE if not.
69 inline Standard_Boolean IsEqual(const BRepMesh_Edge& theOther) const
71 if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
72 return Standard_False;
74 return IsSameOrientation(theOther) ||
75 (FirstNode() == theOther.LastNode() && LastNode() == theOther.FirstNode());
78 //! Alias for IsEqual.
79 Standard_Boolean operator ==(const BRepMesh_Edge& Other) const
81 return IsEqual(Other);
86 BRepMesh_DegreeOfFreedom myMovability;
89 inline Standard_Integer HashCode(const BRepMesh_Edge& theEdge,
90 const Standard_Integer theUpper)
92 return theEdge.HashCode(theUpper);