Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00025
00028
00029 #ifndef THOR_TRIANGULATIONFIGURES_HPP
00030 #define THOR_TRIANGULATIONFIGURES_HPP
00031
00032 #include <Thor/Config.hpp>
00033
00034 #include <SFML/System/Vector2.hpp>
00035 #include <SFML/System/NonCopyable.hpp>
00036
00037 #include <array>
00038 #include <cassert>
00039
00040
00041 namespace thor
00042 {
00043
00046
00050 template <typename V>
00051 class Edge
00052 {
00053
00054
00055 public:
00058 Edge(V& corner0, V& corner1);
00059
00063 V& operator[] (std::size_t cornerIndex);
00064
00068 const V& operator[] (std::size_t cornerIndex) const;
00069
00070
00071
00072
00073 protected:
00074 std::array<V*, 2> mCorners;
00075 };
00076
00077
00082 template <typename V>
00083 class Triangle
00084 {
00085
00086
00087 public:
00091 Triangle(V& corner0, V& corner1, V& corner2);
00092
00096 V& operator[] (std::size_t cornerIndex);
00097
00101 const V& operator[] (std::size_t cornerIndex) const;
00102
00103
00104
00105
00106 private:
00107 std::array<V*, 3> mCorners;
00108 };
00109
00110
00119 template <typename V>
00120 struct TriangulationTraits
00121 {
00122 static sf::Vector2f getPosition(const V& vertex)
00123 {
00124 return vertex.getPosition();
00125 }
00126 };
00127
00128
00129 template <>
00130 struct TriangulationTraits<sf::Vector2f>
00131 {
00132 static sf::Vector2f getPosition(sf::Vector2f vertex)
00133 {
00134 return vertex;
00135 }
00136 };
00137
00139
00140 }
00141
00142 #include <Thor/Math/Detail/TriangulationFigures.inl>
00143 #endif // THOR_TRIANGULATIONFIGURES_HPP