My Project
 All Classes Files Functions Variables Enumerations Pages
triangle_edge.h
Go to the documentation of this file.
1 /**************************************************************************/
2 /* Copyright 2009 Tim Day */
3 /* */
4 /* This file is part of Fracplanet */
5 /* */
6 /* Fracplanet is free software: you can redistribute it and/or modify */
7 /* it under the terms of the GNU General Public License as published by */
8 /* the Free Software Foundation, either version 3 of the License, or */
9 /* (at your option) any later version. */
10 /* */
11 /* Fracplanet is distributed in the hope that it will be useful, */
12 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* GNU General Public License for more details. */
15 /* */
16 /* You should have received a copy of the GNU General Public License */
17 /* along with Fracplanet. If not, see <http://www.gnu.org/licenses/>. */
18 /**************************************************************************/
19 
24 #ifndef _triangle_edge_h_
25 #define _triangle_edge_h_
26 
28 
34 {
35  public:
36 
38  TriangleEdge(uint v0,uint v1)
39  :_vertex0(v0<v1 ? v0 : v1)
40  ,_vertex1(v0>v1 ? v0 : v1)
41  {}
42 
45  :_vertex0(e._vertex0)
46  ,_vertex1(e._vertex1)
47  {}
48 
51  {}
52 
54  uint vertex0() const
55  {return _vertex0;}
56 
58  uint vertex1() const
59  {return _vertex1;}
60 
61  protected:
62 
64  const uint _vertex0;
65 
67  const uint _vertex1;
68 };
69 
71 inline bool operator<(const TriangleEdge& e0,const TriangleEdge& e1)
72 {
73  return
74  (
75  e0.vertex0()<e1.vertex0()
76  ||
77  (
78  e0.vertex0()==e1.vertex0()
79  &&
80  e0.vertex1()<e1.vertex1()
81  )
82  );
83 }
84 
85 #endif