xmsgrid  1.0
XmEdge.h
1 #pragma once
2 //------------------------------------------------------------------------------
8 //------------------------------------------------------------------------------
9 
10 //----- Included files ---------------------------------------------------------
11 
12 // 3. Standard library headers
13 #include <utility>
14 
15 // 4. External library headers
16 
17 // 5. Shared code headers
18 
19 //----- Forward declarations ---------------------------------------------------
20 
21 //----- Namespace declaration --------------------------------------------------
22 
24 namespace xms
25 {
26 //----- Forward declarations ---------------------------------------------------
27 
28 //----- Constants / Enumerations -----------------------------------------------
29 
30 //----- Structs / Classes ------------------------------------------------------
31 
33 class XmEdge
34 {
35 public:
36  XmEdge();
37  XmEdge(int a_pt1, int a_pt2, bool a_sorted = false);
38  explicit XmEdge(const std::pair<int, int>& a_edge);
39 
40  bool operator<(const XmEdge& a_rhs) const;
41  bool operator==(const XmEdge& a_rhs) const;
42 
43  int GetFirst() const;
44  void SetFirst(int a_pt1);
45  int GetSecond() const;
46  void SetSecond(int a_pt2);
47  bool IsEquivalent(const XmEdge& a_edge) const;
48  void SortIndexes();
49 
50 private:
51  int m_pt1;
52  int m_pt2;
53 };
54 
55 //----- Function prototypes ----------------------------------------------------
56 bool XmEdgesEquivalent(const XmEdge& a_edge1, const XmEdge& a_edge2);
57 
58 } // namespace xms
void SetFirst(int a_pt1)
Set the first index.
Definition: XmEdge.cpp:111
void SetSecond(int a_pt2)
Set the second index.
Definition: XmEdge.cpp:127
int GetSecond() const
Get the second index.
Definition: XmEdge.cpp:119
int m_pt1
First point on the edge.
Definition: XmEdge.h:51
bool IsEquivalent(const XmEdge &a_edge) const
Test if edge is the same ignoring direction.
Definition: XmEdge.cpp:136
int m_pt2
Second point on the edge.
Definition: XmEdge.h:52
void SortIndexes()
Sort the indexes so minimum index is first.
Definition: XmEdge.cpp:147
Two integer values representing an edge of an XmUGrid. By default has a direction. Can be sorted to have minimum index first.
Definition: XmEdge.h:33
XMS Namespace.
Definition: geoms.cpp:34
bool XmEdgesEquivalent(const XmEdge &a_edge1, const XmEdge &a_edge2)
Test if two edges are the same ignoring direction.
Definition: XmEdge.cpp:158
int GetFirst() const
Get the first index.
Definition: XmEdge.cpp:103
bool operator==(const XmEdge &a_rhs) const
Equals operator.
Definition: XmEdge.cpp:95
XmEdge()
Default constructor.
Definition: XmEdge.cpp:47
bool operator<(const XmEdge &a_rhs) const
Less than operator by first index then second.
Definition: XmEdge.cpp:79