Blender  V3.3
btMiniSDF.h
Go to the documentation of this file.
1 #ifndef MINISDF_H
2 #define MINISDF_H
3 
4 #include "LinearMath/btVector3.h"
7 
9 {
10  unsigned int ijk[3];
11 };
12 
14 {
17 
18  const btVector3& min() const
19  {
20  return m_min;
21  }
22 
23  const btVector3& max() const
24  {
25  return m_max;
26  }
27 
28  bool contains(const btVector3& x) const
29  {
31  }
32 
33  btAlignedBox3d(const btVector3& mn, const btVector3& mx)
34  : m_min(mn),
35  m_max(mx)
36  {
37  }
38 
40  {
41  }
42 };
43 
45 {
46  double m_vec[32];
47 
48  inline double& operator[](int i)
49  {
50  return m_vec[i];
51  }
52 
53  inline const double& operator[](int i) const
54  {
55  return m_vec[i];
56  }
57 };
58 
60 {
62 
63  void topRowsDivide(int row, double denom)
64  {
65  for (int i = 0; i < row; i++)
66  {
67  m_vec[i] /= denom;
68  }
69  }
70 
71  void bottomRowsMul(int row, double val)
72  {
73  for (int i = 32 - row; i < 32; i++)
74  {
75  m_vec[i] *= val;
76  }
77  }
78 
79  inline btScalar& operator()(int i, int j)
80  {
81  return m_vec[i][j];
82  }
83 };
84 
85 struct btCell32
86 {
87  unsigned int m_cells[32];
88 };
89 
90 struct btMiniSDF
91 {
93  unsigned int m_resolution[3];
96  std::size_t m_n_cells;
97  std::size_t m_n_fields;
98  bool m_isValid;
99 
103 
105  : m_isValid(false)
106  {
107  }
108  bool load(const char* data, int size);
109  bool isValid() const
110  {
111  return m_isValid;
112  }
113  unsigned int multiToSingleIndex(btMultiIndex const& ijk) const;
114 
115  btAlignedBox3d subdomain(btMultiIndex const& ijk) const;
116 
117  btMultiIndex singleToMultiIndex(unsigned int l) const;
118 
119  btAlignedBox3d subdomain(unsigned int l) const;
120 
122  shape_function_(btVector3 const& xi, btShapeGradients* gradient = 0) const;
123 
124  bool interpolate(unsigned int field_id, double& dist, btVector3 const& x, btVector3* gradient) const;
125 };
126 
127 #endif //MINISDF_H
ATTR_WARN_UNUSED_RESULT const BMLoop * l
SIMD_FORCE_INLINE bool TestPointAgainstAabb2(const btVector3 &aabbMin1, const btVector3 &aabbMax1, const btVector3 &point)
conservative test for overlap between two aabbs
Definition: btAabbUtil2.h:32
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
Definition: btVector3.h:82
btVector3 m_max
Definition: btMiniSDF.h:16
const btVector3 & min() const
Definition: btMiniSDF.h:18
btAlignedBox3d(const btVector3 &mn, const btVector3 &mx)
Definition: btMiniSDF.h:33
bool contains(const btVector3 &x) const
Definition: btMiniSDF.h:28
btVector3 m_min
Definition: btMiniSDF.h:15
const btVector3 & max() const
Definition: btMiniSDF.h:23
unsigned int m_cells[32]
Definition: btMiniSDF.h:87
btVector3 m_inv_cell_size
Definition: btMiniSDF.h:95
std::size_t m_n_cells
Definition: btMiniSDF.h:96
btShapeMatrix shape_function_(btVector3 const &xi, btShapeGradients *gradient=0) const
Definition: btMiniSDF.cpp:199
btAlignedBox3d m_domain
Definition: btMiniSDF.h:92
bool load(const char *data, int size)
Definition: btMiniSDF.cpp:45
unsigned int multiToSingleIndex(btMultiIndex const &ijk) const
Definition: btMiniSDF.cpp:155
bool interpolate(unsigned int field_id, double &dist, btVector3 const &x, btVector3 *gradient) const
Definition: btMiniSDF.cpp:442
btVector3 m_cell_size
Definition: btMiniSDF.h:94
btMultiIndex singleToMultiIndex(unsigned int l) const
Definition: btMiniSDF.cpp:176
btAlignedBox3d subdomain(btMultiIndex const &ijk) const
Definition: btMiniSDF.cpp:161
bool isValid() const
Definition: btMiniSDF.h:109
unsigned int m_resolution[3]
Definition: btMiniSDF.h:93
bool m_isValid
Definition: btMiniSDF.h:98
btAlignedObjectArray< btAlignedObjectArray< btCell32 > > m_cells
Definition: btMiniSDF.h:101
btAlignedObjectArray< btAlignedObjectArray< double > > m_nodes
Definition: btMiniSDF.h:100
btAlignedObjectArray< btAlignedObjectArray< unsigned int > > m_cell_map
Definition: btMiniSDF.h:102
std::size_t m_n_fields
Definition: btMiniSDF.h:97
unsigned int ijk[3]
Definition: btMiniSDF.h:10
void topRowsDivide(int row, double denom)
Definition: btMiniSDF.h:63
btVector3 m_vec[32]
Definition: btMiniSDF.h:61
btScalar & operator()(int i, int j)
Definition: btMiniSDF.h:79
void bottomRowsMul(int row, double val)
Definition: btMiniSDF.h:71
double & operator[](int i)
Definition: btMiniSDF.h:48
const double & operator[](int i) const
Definition: btMiniSDF.h:53
double m_vec[32]
Definition: btMiniSDF.h:46