#pragma once
#include "./parallel.h"
#include "./sparse.h"
#include "./utils.h"
#include "./vec.h"
#include "manifold/common.h"
#ifdef _MSC_VER
#include <intrin.h>
#endif
#if (MANIFOLD_PAR == 1)
#include <tbb/combinable.h>
#endif
namespace manifold {
namespace collider_internal {
constexpr int kInitialLength = …;
constexpr int kLengthMultiple = …;
constexpr int kSequentialThreshold = …;
constexpr int kRoot = …;
#ifdef _MSC_VER
#ifndef _WINDEF_
typedef unsigned long DWORD;
#endif
uint32_t inline ctz(uint32_t value) {
DWORD trailing_zero = 0;
if (_BitScanForward(&trailing_zero, value)) {
return trailing_zero;
} else {
return 32;
}
}
uint32_t inline clz(uint32_t value) {
DWORD leading_zero = 0;
if (_BitScanReverse(&leading_zero, value)) {
return 31 - leading_zero;
} else {
return 32;
}
}
#endif
constexpr inline bool IsLeaf(int node) { … }
constexpr inline bool IsInternal(int node) { … }
constexpr inline int Node2Internal(int node) { … }
constexpr inline int Internal2Node(int internal) { … }
constexpr inline int Node2Leaf(int node) { … }
constexpr inline int Leaf2Node(int leaf) { … }
struct CreateRadixTree { … };
template <typename T, const bool selfCollision, typename Recorder>
struct FindCollision { … };
template <const bool inverted>
struct SeqCollisionRecorder { … };
#if (MANIFOLD_PAR == 1)
template <const bool inverted>
struct ParCollisionRecorder {
tbb::combinable<SparseIndices>& store;
inline void record(int queryIdx, int leafIdx, SparseIndices& ind) const {
if (inverted)
ind.Add(leafIdx, queryIdx, true);
else
ind.Add(queryIdx, leafIdx, true);
}
SparseIndices& local() { return store.local(); }
};
#endif
struct BuildInternalBoxes { … };
struct TransformBox { … };
constexpr inline uint32_t SpreadBits3(uint32_t v) { … }
}
class Collider { … };
}