Blender  V3.3
mesh_fair.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
9 #include "BLI_map.hh"
10 #include "BLI_math.h"
11 #include "BLI_vector.hh"
12 
13 #include "DNA_mesh_types.h"
14 #include "DNA_meshdata_types.h"
15 #include "DNA_object_types.h"
16 
17 #include "BKE_lib_id.h"
18 #include "BKE_lib_query.h"
19 #include "BKE_mesh.h"
20 #include "BKE_mesh_fair.h"
21 #include "BKE_mesh_mapping.h"
22 
23 #include "bmesh.h"
24 #include "bmesh_tools.h"
25 
26 #include "MEM_guardedalloc.h"
27 #include "eigen_capi.h"
28 
29 using blender::Map;
30 using blender::Vector;
31 using std::array;
32 
33 class VertexWeight {
34  public:
35  virtual float weight_at_index(const int index) = 0;
36  virtual ~VertexWeight() = default;
37 };
38 
39 class LoopWeight {
40  public:
41  virtual float weight_at_index(const int index) = 0;
42  virtual ~LoopWeight() = default;
43 };
44 
46  public:
47  /* Get coordinates of vertices which are adjacent to the loop with specified index. */
48  virtual void adjacents_coords_from_loop(const int loop,
49  float r_adj_next[3],
50  float r_adj_prev[3]) = 0;
51 
52  /* Get the other vertex index for a loop. */
53  virtual int other_vertex_index_from_loop(const int loop, const uint v) = 0;
54 
56  {
57  return totvert_;
58  }
59 
61  {
62  return totvert_;
63  }
64 
66  {
67  return &vlmap_[v];
68  }
69 
70  float *vertex_deformation_co_get(const int v)
71  {
72  return co_[v];
73  }
74 
75  virtual ~FairingContext() = default;
76 
77  void fair_vertices(bool *affected,
78  const eMeshFairingDepth depth,
79  VertexWeight *vertex_weight,
80  LoopWeight *loop_weight)
81  {
82 
83  fair_vertices_ex(affected, (int)depth, vertex_weight, loop_weight);
84  }
85 
86  protected:
88 
89  int totvert_;
90  int totloop_;
91 
93  int *vlmap_mem_;
94 
95  private:
96  void fair_setup_fairing(const int v,
97  const int i,
98  LinearSolver *solver,
99  float multiplier,
100  const int depth,
101  Map<int, int> &vert_col_map,
102  VertexWeight *vertex_weight,
103  LoopWeight *loop_weight)
104  {
105  if (depth == 0) {
106  if (vert_col_map.contains(v)) {
107  const int j = vert_col_map.lookup(v);
108  EIG_linear_solver_matrix_add(solver, i, j, -multiplier);
109  return;
110  }
111  for (int j = 0; j < 3; j++) {
112  EIG_linear_solver_right_hand_side_add(solver, j, i, multiplier * co_[v][j]);
113  }
114  return;
115  }
116 
117  float w_ij_sum = 0;
118  const float w_i = vertex_weight->weight_at_index(v);
119  MeshElemMap *vlmap_elem = &vlmap_[v];
120  for (int l = 0; l < vlmap_elem->count; l++) {
121  const int l_index = vlmap_elem->indices[l];
122  const int other_vert = other_vertex_index_from_loop(l_index, v);
123  const float w_ij = loop_weight->weight_at_index(l_index);
124  w_ij_sum += w_ij;
125  fair_setup_fairing(other_vert,
126  i,
127  solver,
128  w_i * w_ij * multiplier,
129  depth - 1,
130  vert_col_map,
131  vertex_weight,
132  loop_weight);
133  }
134  fair_setup_fairing(v,
135  i,
136  solver,
137  -1 * w_i * w_ij_sum * multiplier,
138  depth - 1,
139  vert_col_map,
140  vertex_weight,
141  loop_weight);
142  }
143 
144  void fair_vertices_ex(const bool *affected,
145  const int order,
146  VertexWeight *vertex_weight,
147  LoopWeight *loop_weight)
148  {
149  Map<int, int> vert_col_map;
150  int num_affected_vertices = 0;
151  for (int i = 0; i < totvert_; i++) {
152  if (!affected[i]) {
153  continue;
154  }
155  vert_col_map.add(i, num_affected_vertices);
156  num_affected_vertices++;
157  }
158 
159  /* Early return, nothing to do. */
160  if (ELEM(num_affected_vertices, 0, totvert_)) {
161  return;
162  }
163 
164  /* Setup fairing matrices */
165  LinearSolver *solver = EIG_linear_solver_new(num_affected_vertices, num_affected_vertices, 3);
166  for (auto item : vert_col_map.items()) {
167  const int v = item.key;
168  const int col = item.value;
169  fair_setup_fairing(v, col, solver, 1.0f, order, vert_col_map, vertex_weight, loop_weight);
170  }
171 
172  /* Solve linear system */
173  EIG_linear_solver_solve(solver);
174 
175  /* Copy the result back to the mesh */
176  for (auto item : vert_col_map.items()) {
177  const int v = item.key;
178  const int col = item.value;
179  for (int j = 0; j < 3; j++) {
180  co_[v][j] = EIG_linear_solver_variable_get(solver, j, col);
181  }
182  }
183 
184  /* Free solver data */
185  EIG_linear_solver_delete(solver);
186  }
187 };
188 
190  public:
191  MeshFairingContext(Mesh *mesh, MVert *deform_mverts)
192  {
193  totvert_ = mesh->totvert;
194  totloop_ = mesh->totloop;
195 
196  medge_ = mesh->medge;
197  mpoly_ = mesh->mpoly;
198  mloop_ = mesh->mloop;
200  &vlmap_mem_,
201  mesh->mpoly,
202  mesh->mloop,
203  mesh->totvert,
204  mesh->totpoly,
205  mesh->totloop);
206 
207  /* Deformation coords. */
209  if (deform_mverts) {
210  for (int i = 0; i < mesh->totvert; i++) {
211  co_[i] = deform_mverts[i].co;
212  }
213  }
214  else {
215  for (int i = 0; i < mesh->totvert; i++) {
216  co_[i] = mesh->mvert[i].co;
217  }
218  }
219 
221  for (int i = 0; i < mesh->totpoly; i++) {
222  for (int l = 0; l < mesh->mpoly[i].totloop; l++) {
224  }
225  }
226  }
227 
229  {
232  }
233 
234  void adjacents_coords_from_loop(const int loop,
235  float r_adj_next[3],
236  float r_adj_prev[3]) override
237  {
238  const int vert = mloop_[loop].v;
239  const MPoly *p = &mpoly_[loop_to_poly_map_[loop]];
240  const int corner = poly_find_loop_from_vert(p, &mloop_[p->loopstart], vert);
241  copy_v3_v3(r_adj_next, co_[ME_POLY_LOOP_NEXT(mloop_, p, corner)->v]);
242  copy_v3_v3(r_adj_prev, co_[ME_POLY_LOOP_PREV(mloop_, p, corner)->v]);
243  }
244 
245  int other_vertex_index_from_loop(const int loop, const uint v) override
246  {
247  MEdge *e = &medge_[mloop_[loop].e];
248  if (e->v1 == v) {
249  return e->v2;
250  }
251  return e->v1;
252  }
253 
254  protected:
260 };
261 
263  public:
265  {
266  this->bm = bm;
267  totvert_ = bm->totvert;
268  totloop_ = bm->totloop;
269 
272 
273  /* Deformation coords. */
274  co_.reserve(bm->totvert);
275  for (int i = 0; i < bm->totvert; i++) {
276  BMVert *v = BM_vert_at_index(bm, i);
277  co_[i] = v->co;
278  }
279 
281  vlmap_ = (MeshElemMap *)MEM_calloc_arrayN(bm->totvert, sizeof(MeshElemMap), "bmesh loop map");
282  vlmap_mem_ = (int *)MEM_malloc_arrayN(bm->totloop, sizeof(int), "bmesh loop map mempool");
283 
284  BMVert *v;
285  BMLoop *l;
286  BMIter iter;
287  BMIter loop_iter;
288  int index_iter = 0;
289 
290  /* This initializes both the bmloop and the vlmap for bmesh in a single loop. */
291  BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
292  int loop_count = 0;
293  const int vert_index = BM_elem_index_get(v);
294  vlmap_[vert_index].indices = &vlmap_mem_[index_iter];
295  BM_ITER_ELEM (l, &loop_iter, v, BM_LOOPS_OF_VERT) {
296  const int loop_index = BM_elem_index_get(l);
297  bmloop_[loop_index] = l;
298  vlmap_mem_[index_iter] = loop_index;
299  index_iter++;
300  loop_count++;
301  }
302  vlmap_[vert_index].count = loop_count;
303  }
304  }
305 
307  {
310  }
311 
312  void adjacents_coords_from_loop(const int loop,
313  float r_adj_next[3],
314  float r_adj_prev[3]) override
315  {
316  copy_v3_v3(r_adj_next, bmloop_[loop]->next->v->co);
317  copy_v3_v3(r_adj_prev, bmloop_[loop]->prev->v->co);
318  }
319 
320  int other_vertex_index_from_loop(const int loop, const uint v) override
321  {
322  BMLoop *l = bmloop_[loop];
323  BMVert *bmvert = BM_vert_at_index(bm, v);
324  BMVert *bm_other_vert = BM_edge_other_vert(l->e, bmvert);
325  return BM_elem_index_get(bm_other_vert);
326  }
327 
328  protected:
331 };
332 
334  public:
336  {
337  const int totvert = fairing_context->vertex_count_get();
338  vertex_weights_.reserve(totvert);
339  for (int i = 0; i < totvert; i++) {
340  const int tot_loop = fairing_context->vertex_loop_map_get(i)->count;
341  if (tot_loop != 0) {
342  vertex_weights_[i] = 1.0f / tot_loop;
343  }
344  else {
345  vertex_weights_[i] = FLT_MAX;
346  }
347  }
348  }
349 
350  float weight_at_index(const int index) override
351  {
352  return vertex_weights_[index];
353  }
354 
355  private:
356  Vector<float> vertex_weights_;
357 };
358 
360 
361  public:
363  {
364 
365  const int totvert = fairing_context->vertex_count_get();
366  vertex_weights_.reserve(totvert);
367  for (int i = 0; i < totvert; i++) {
368 
369  float area = 0.0f;
370  float a[3];
371  copy_v3_v3(a, fairing_context->vertex_deformation_co_get(i));
372  const float acute_threshold = M_PI_2;
373 
374  MeshElemMap *vlmap_elem = fairing_context->vertex_loop_map_get(i);
375  for (int l = 0; l < vlmap_elem->count; l++) {
376  const int l_index = vlmap_elem->indices[l];
377 
378  float b[3], c[3], d[3];
379  fairing_context->adjacents_coords_from_loop(l_index, b, c);
380 
381  if (angle_v3v3v3(c, fairing_context->vertex_deformation_co_get(i), b) < acute_threshold) {
382  calc_circumcenter(d, a, b, c);
383  }
384  else {
385  add_v3_v3v3(d, b, c);
386  mul_v3_fl(d, 0.5f);
387  }
388 
389  float t[3];
390  add_v3_v3v3(t, a, b);
391  mul_v3_fl(t, 0.5f);
392  area += area_tri_v3(a, t, d);
393 
394  add_v3_v3v3(t, a, c);
395  mul_v3_fl(t, 0.5f);
396  area += area_tri_v3(a, d, t);
397  }
398 
399  vertex_weights_[i] = area != 0.0f ? 1.0f / area : 1e12;
400  }
401  }
402 
403  float weight_at_index(const int index) override
404  {
405  return vertex_weights_[index];
406  }
407 
408  private:
409  Vector<float> vertex_weights_;
410 
411  void calc_circumcenter(float r[3], const float a[3], const float b[3], const float c[3])
412  {
413  float ab[3];
414  sub_v3_v3v3(ab, b, a);
415 
416  float ac[3];
417  sub_v3_v3v3(ac, c, a);
418 
419  float ab_cross_ac[3];
420  cross_v3_v3v3(ab_cross_ac, ab, ac);
421 
422  if (len_squared_v3(ab_cross_ac) > 0.0f) {
423  float d[3];
424  cross_v3_v3v3(d, ab_cross_ac, ab);
425  mul_v3_fl(d, len_squared_v3(ac));
426 
427  float t[3];
428  cross_v3_v3v3(t, ac, ab_cross_ac);
429  mul_v3_fl(t, len_squared_v3(ab));
430 
431  add_v3_v3(d, t);
432 
433  mul_v3_fl(d, 1.0f / (2.0f * len_squared_v3(ab_cross_ac)));
434 
435  add_v3_v3v3(r, a, d);
436  return;
437  }
438  copy_v3_v3(r, a);
439  }
440 };
441 
443  public:
444  float weight_at_index(const int UNUSED(index)) override
445  {
446  return 1.0f;
447  }
448 };
449 
450 static void prefair_and_fair_vertices(FairingContext *fairing_context,
451  bool *affected_vertices,
452  const eMeshFairingDepth depth)
453 {
454  /* Prefair. */
455  UniformVertexWeight *uniform_vertex_weights = new UniformVertexWeight(fairing_context);
456  UniformLoopWeight *uniform_loop_weights = new UniformLoopWeight();
457  fairing_context->fair_vertices(
458  affected_vertices, depth, uniform_vertex_weights, uniform_loop_weights);
459  delete uniform_vertex_weights;
460 
461  /* Fair. */
462  VoronoiVertexWeight *voronoi_vertex_weights = new VoronoiVertexWeight(fairing_context);
463  /* TODO: Implement cotangent loop weights. */
464  fairing_context->fair_vertices(
465  affected_vertices, depth, voronoi_vertex_weights, uniform_loop_weights);
466 
467  delete uniform_loop_weights;
468  delete voronoi_vertex_weights;
469 }
470 
472  struct MVert *deform_mverts,
473  bool *affect_vertices,
474  const eMeshFairingDepth depth)
475 {
476  MeshFairingContext *fairing_context = new MeshFairingContext(mesh, deform_mverts);
477  prefair_and_fair_vertices(fairing_context, affect_vertices, depth);
478  delete fairing_context;
479 }
480 
482  bool *affect_vertices,
483  const eMeshFairingDepth depth)
484 {
485  BMeshFairingContext *fairing_context = new BMeshFairingContext(bm);
486  prefair_and_fair_vertices(fairing_context, affect_vertices, depth);
487  delete fairing_context;
488 }
int poly_find_loop_from_vert(const struct MPoly *poly, const struct MLoop *loopstart, uint vert)
eMeshFairingDepth
Definition: BKE_mesh_fair.h:21
void BKE_mesh_vert_loop_map_create(MeshElemMap **r_map, int **r_mem, const struct MPoly *mpoly, const struct MLoop *mloop, int totvert, int totpoly, int totloop)
#define M_PI_2
Definition: BLI_math_base.h:23
float area_tri_v3(const float v1[3], const float v2[3], const float v3[3])
Definition: math_geom.c:92
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
float angle_v3v3v3(const float a[3], const float b[3], const float c[3]) ATTR_WARN_UNUSED_RESULT
Definition: math_vector.c:361
MINLINE void add_v3_v3(float r[3], const float a[3])
unsigned int uint
Definition: BLI_sys_types.h:67
#define UNUSED(x)
#define ELEM(...)
#define ME_POLY_LOOP_PREV(mloop, mp, i)
#define ME_POLY_LOOP_NEXT(mloop, mp, i)
Object is a sort of wrapper for general info.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint order
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Map
@ BM_LOOP
Definition: bmesh_class.h:385
@ BM_VERT
Definition: bmesh_class.h:383
#define BM_elem_index_get(ele)
Definition: bmesh_inline.h:110
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
@ BM_VERTS_OF_MESH
@ BM_LOOPS_OF_VERT
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
Definition: bmesh_mesh.cc:558
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
Definition: bmesh_mesh.cc:446
BLI_INLINE BMVert * BM_vert_at_index(BMesh *bm, const int index)
Definition: bmesh_mesh.h:103
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
~BMeshFairingContext() override
Definition: mesh_fair.cc:306
BMeshFairingContext(BMesh *bm)
Definition: mesh_fair.cc:264
int other_vertex_index_from_loop(const int loop, const uint v) override
Definition: mesh_fair.cc:320
void adjacents_coords_from_loop(const int loop, float r_adj_next[3], float r_adj_prev[3]) override
Definition: mesh_fair.cc:312
Vector< BMLoop * > bmloop_
Definition: mesh_fair.cc:330
int loop_count_get()
Definition: mesh_fair.cc:60
int vertex_count_get()
Definition: mesh_fair.cc:55
Vector< float * > co_
Definition: mesh_fair.cc:87
virtual ~FairingContext()=default
int * vlmap_mem_
Definition: mesh_fair.cc:93
MeshElemMap * vertex_loop_map_get(const int v)
Definition: mesh_fair.cc:65
virtual void adjacents_coords_from_loop(const int loop, float r_adj_next[3], float r_adj_prev[3])=0
MeshElemMap * vlmap_
Definition: mesh_fair.cc:92
float * vertex_deformation_co_get(const int v)
Definition: mesh_fair.cc:70
virtual int other_vertex_index_from_loop(const int loop, const uint v)=0
void fair_vertices(bool *affected, const eMeshFairingDepth depth, VertexWeight *vertex_weight, LoopWeight *loop_weight)
Definition: mesh_fair.cc:77
virtual float weight_at_index(const int index)=0
virtual ~LoopWeight()=default
void adjacents_coords_from_loop(const int loop, float r_adj_next[3], float r_adj_prev[3]) override
Definition: mesh_fair.cc:234
MeshFairingContext(Mesh *mesh, MVert *deform_mverts)
Definition: mesh_fair.cc:191
Vector< int > loop_to_poly_map_
Definition: mesh_fair.cc:259
int other_vertex_index_from_loop(const int loop, const uint v) override
Definition: mesh_fair.cc:245
~MeshFairingContext() override
Definition: mesh_fair.cc:228
float weight_at_index(const int UNUSED(index)) override
Definition: mesh_fair.cc:444
float weight_at_index(const int index) override
Definition: mesh_fair.cc:350
UniformVertexWeight(FairingContext *fairing_context)
Definition: mesh_fair.cc:335
virtual float weight_at_index(const int index)=0
virtual ~VertexWeight()=default
VoronoiVertexWeight(FairingContext *fairing_context)
Definition: mesh_fair.cc:362
float weight_at_index(const int index) override
Definition: mesh_fair.cc:403
bool add(const Key &key, const Value &value)
Definition: BLI_map.hh:250
const Value & lookup(const Key &key) const
Definition: BLI_map.hh:485
ItemIterator items() const
Definition: BLI_map.hh:859
bool contains(const Key &key) const
Definition: BLI_map.hh:308
void reserve(const int64_t min_capacity)
Definition: BLI_vector.hh:340
uint col
LinearSolver * EIG_linear_solver_new(int num_rows, int num_columns, int num_rhs)
void EIG_linear_solver_right_hand_side_add(LinearSolver *solver, int rhs, int index, double value)
void EIG_linear_solver_delete(LinearSolver *solver)
double EIG_linear_solver_variable_get(LinearSolver *solver, int rhs, int index)
void EIG_linear_solver_matrix_add(LinearSolver *solver, int row, int col, double value)
bool EIG_linear_solver_solve(LinearSolver *solver)
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
Definition: mallocn.c:34
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str)
Definition: mallocn.c:32
static ulong * next
void BKE_mesh_prefair_and_fair_vertices(struct Mesh *mesh, struct MVert *deform_mverts, bool *affect_vertices, const eMeshFairingDepth depth)
Definition: mesh_fair.cc:471
static void prefair_and_fair_vertices(FairingContext *fairing_context, bool *affected_vertices, const eMeshFairingDepth depth)
Definition: mesh_fair.cc:450
void BKE_bmesh_prefair_and_fair_vertices(struct BMesh *bm, bool *affect_vertices, const eMeshFairingDepth depth)
Definition: mesh_fair.cc:481
static unsigned c
Definition: RandGen.cpp:83
static unsigned a[3]
Definition: RandGen.cpp:78
static void area(int d1, int d2, int e1, int e2, float weights[2])
SymEdge< T > * prev(const SymEdge< T > *se)
Definition: delaunay_2d.cc:105
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
struct BMEdge * e
Definition: bmesh_class.h:164
float co[3]
Definition: bmesh_class.h:87
int totvert
Definition: bmesh_class.h:297
int totloop
Definition: bmesh_class.h:297
unsigned int e
unsigned int v
float co[3]
struct MEdge * medge
struct MVert * mvert
int totvert
struct MLoop * mloop
int totpoly
int totloop
struct MPoly * mpoly