voxelTerrain
 All Classes Functions Variables Typedefs Enumerations Pages
triangle.hpp
1 #ifndef TRIANGLE_HPP
2 #define TRIANGLE_HPP
3 
4 #include "blub/core/list.hpp"
5 #include "blub/core/globals.hpp"
6 
7 namespace blub
8 {
9 
10 class triangle
11 {
12 public:
13  triangle()
14  {;}
15  triangle(blub::uint32 a, blub::uint32 b, blub::uint32 c)
16  {
17  ind[0] = a;
18  ind[1] = b;
19  ind[2] = c;
20  }
21 
22  bool contains(blub::uint32 _ind)
23  {
24  return ind[0] == _ind || ind[1] == _ind || ind[2] == _ind;
25  }
26 
27  bool valid()
28  {
29  return ind[0] != ind[1] && ind[0] != ind[2] && ind[1] != ind[2];
30  }
31 
32  bool operator == (const triangle & other) const
33  {
34  list<uint32> otherVec;
35  for (uint16 ind1 = 0; ind1 < 3; ++ind1)
36  otherVec.push_back(other.ind[ind1]);
37  for (uint16 ind1 = 0; ind1 < 3; ++ind1)
38  {
39  int32 index = otherVec.indexOf(ind[ind1]);
40  if (index == -1)
41  return false;
42  else
43  otherVec.removeAt(index);
44  }
45  return true;
46  }
47  triangle operator + (const int32 & other) const
48  {
49  return triangle(ind[0]+other, ind[1]+other, ind[2]+other);
50  }
51 
52  blub::uint16 ind[3];
53 };
54 
55 }
56 
57 #endif // TRIANGLE_HPP
Definition: triangle.hpp:10
Definition: deadlineTimer.hpp:10
Definition: list.hpp:13