src/basics.h

changeset 1031
55c0d3beea0d
parent 1026
fb320996cce0
child 1036
993c46d7eb75
equal deleted inserted replaced
1030:d931a7547578 1031:55c0d3beea0d
83 { 83 {
84 return vertex * scalar; 84 return vertex * scalar;
85 } 85 }
86 86
87 Q_DECLARE_METATYPE (Vertex) 87 Q_DECLARE_METATYPE (Vertex)
88 uint qHash(const Vertex& key);
88 89
89 // 90 //
90 // A mathematical 3 x 3 matrix 91 // A mathematical 3 x 3 matrix
91 // 92 //
92 class Matrix 93 class Matrix
209 bool isInteger (T a) 210 bool isInteger (T a)
210 { 211 {
211 return (qAbs (a - floor(a)) < 0.00001) or (qAbs (a - ceil(a)) < 0.00001); 212 return (qAbs (a - floor(a)) < 0.00001) or (qAbs (a - ceil(a)) < 0.00001);
212 } 213 }
213 214
214 template<typename T>
215 void removeDuplicates (T& a)
216 {
217 std::sort (a.begin(), a.end());
218 a.erase (std::unique (a.begin(), a.end()), a.end());
219 }
220
221 // 215 //
222 // Returns true if first arg is equal to any of the other args 216 // Returns true if first arg is equal to any of the other args
223 // 217 //
224 template<typename T, typename Arg, typename... Args> 218 template<typename T, typename Arg, typename... Args>
225 bool isOneOf (T const& a, Arg const& arg, Args const&... args) 219 bool isOneOf (T const& a, Arg const& arg, Args const&... args)

mercurial