| 95 | }; |
| 96 | |
| 97 | class Triplet : public Multiplet<int, 3> { |
| 98 | public: |
| 99 | using Parent = Multiplet<int, 3>; |
| 100 | Triplet(int v1=0, int v2=0, int v3=0) : Parent({v1, v2, v3}) {} |
| 101 | virtual ~Triplet() = default; |
| 102 | |
| 103 | inline virtual int hash() const { |
| 104 | // Magic primes (p1, p2, p3) from the following paper. |
| 105 | // "Optimized Spacial Hashing for Collision Detection of |
| 106 | // Deformable Objects" by Teschner et al. (VMV 2003) |
| 107 | constexpr int p1 = 73856093; |
| 108 | constexpr int p2 = 19349663; |
| 109 | constexpr int p3 = 83492791; |
| 110 | return (Parent::m_data.coeff(0)*p1) ^ |
| 111 | (Parent::m_data.coeff(1)*p2) ^ |
| 112 | (Parent::m_data.coeff(2)*p3); |
| 113 | } |
| 114 | }; |
| 115 | |
| 116 | class Quadruplet : public Multiplet<int, 4> { |
| 117 | public: |
no outgoing calls
no test coverage detected