#ifndef MINISDF_H #define MINISDF_H #include "LinearMath/btVector3.h" #include "LinearMath/btAabbUtil2.h" #include "LinearMath/btAlignedObjectArray.h" struct btMultiIndex { unsigned int ijk[3]; }; struct btAlignedBox3d { btVector3 m_min; btVector3 m_max; const btVector3& min() const { return m_min; } const btVector3& max() const { return m_max; } bool contains(const btVector3& x) const { return TestPointAgainstAabb2(m_min, m_max, x); } btAlignedBox3d(const btVector3& mn, const btVector3& mx) :m_min(mn), m_max(mx) { } btAlignedBox3d() { } }; struct btShapeMatrix { double m_vec[32]; inline double& operator[](int i) { return m_vec[i]; } inline const double& operator[](int i) const { return m_vec[i]; } }; struct btShapeGradients { btVector3 m_vec[32]; void topRowsDivide(int row, double denom) { for (int i=0;i > m_nodes; btAlignedObjectArray > m_cells; btAlignedObjectArray > m_cell_map; btMiniSDF() :m_isValid(false) { } bool load(const char* data, int size); bool isValid() const { return m_isValid; } unsigned int multiToSingleIndex(btMultiIndex const & ijk) const; btAlignedBox3d subdomain(btMultiIndex const& ijk) const; btMultiIndex singleToMultiIndex(unsigned int l) const; btAlignedBox3d subdomain(unsigned int l) const; btShapeMatrix shape_function_(btVector3 const& xi, btShapeGradients* gradient = 0) const; bool interpolate(unsigned int field_id, double& dist, btVector3 const& x, btVector3* gradient) const; }; #endif //MINISDF_H