MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / Quadruplet

Class Quadruplet

src/Misc/Multiplet.h:116–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114};
115
116class Quadruplet : public Multiplet<int, 4> {
117 public:
118 using Parent = Multiplet<int, 4>;
119 Quadruplet(int v1=0, int v2=0, int v3=0, int v4=0) : Parent({v1, v2, v3, v4}) {}
120 virtual ~Quadruplet() = default;
121
122 inline virtual int hash() const {
123 // Magic primes (p1, p2, p3) from the following paper.
124 // "Optimized Spacial Hashing for Collision Detection of
125 // Deformable Objects" by Teschner et al. (VMV 2003)
126 constexpr int p1 = 73856093;
127 constexpr int p2 = 19349663;
128 constexpr int p3 = 83492791;
129 constexpr int p4 = 100663319;
130 return (Parent::m_data.coeff(0)*p1) ^
131 (Parent::m_data.coeff(1)*p2) ^
132 (Parent::m_data.coeff(2)*p3) ^
133 (Parent::m_data.coeff(4)*p4);
134 }
135};
136
137template<typename KeyType>
138struct MultipletHashFunc {

Callers 2

SetUpMethod · 0.85

Calls

no outgoing calls

Tested by 1

SetUpMethod · 0.68