41 #define KD_THRESH 0.00002f
50 const bool use_em = (!me_eval && em && me->
edit_mesh == em);
75 for (i = 0; i < totvert; i++, mvert++) {
93 KDTreeNearest_3d nearest;
94 const int i = BLI_kdtree_3d_find_nearest(
MirrKdStore.tree, co, &nearest);
151 const bool is_editmode = em !=
NULL;
175 const bool skip_em_vert_array_init)
180 const bool is_editmode = (em !=
NULL);
188 int totvert, totedge;
189 int tot_unique = -1, tot_unique_prev = -1;
190 int tot_unique_edges = 0, tot_unique_edges_prev;
229 for (
a = 0, med = medge;
a < totedge;
a++, med++) {
230 const uint i1 = med->v1, i2 = med->v2;
238 tot_unique_prev = -1;
239 tot_unique_edges_prev = -1;
243 tot_unique_edges = 0;
249 topo_hash[
i1] += topo_hash_prev[i2] * topo_pass;
250 topo_hash[i2] += topo_hash_prev[
i1] * topo_pass;
251 tot_unique_edges += (topo_hash[
i1] != topo_hash[i2]);
255 for (
a = 0, med = medge;
a < totedge;
a++, med++) {
256 const uint i1 = med->v1, i2 = med->v2;
257 topo_hash[
i1] += topo_hash_prev[i2] * topo_pass;
258 topo_hash[i2] += topo_hash_prev[
i1] * topo_pass;
259 tot_unique_edges += (topo_hash[
i1] != topo_hash[i2]);
262 memcpy(topo_hash_prev, topo_hash,
sizeof(
MirrTopoHash_t) * totvert);
268 for (
a = 1;
a < totvert;
a++) {
269 if (topo_hash_prev[
a - 1] != topo_hash_prev[
a]) {
274 if ((tot_unique <= tot_unique_prev) && (tot_unique_edges <= tot_unique_edges_prev)) {
279 tot_unique_prev = tot_unique;
280 tot_unique_edges_prev = tot_unique_edges;
282 memcpy(topo_hash_prev, topo_hash,
sizeof(
MirrTopoHash_t) * totvert);
291 index_lookup =
MEM_mallocN(totvert *
sizeof(*index_lookup),
"mesh_topo_lookup");
294 if (skip_em_vert_array_init ==
false) {
299 for (
a = 0;
a < totvert;
a++) {
300 topo_pairs[
a].
hash = topo_hash[
a];
304 index_lookup[
a] = -1;
315 for (
a = 1;
a <= totvert;
a++) {
318 if ((
a == totvert) || (topo_pairs[
a - 1].
hash != topo_pairs[
a].
hash)) {
319 const int match_count =
a - last;
320 if (match_count == 2) {
322 index_lookup[j] = (
intptr_t)vtable[k];
323 index_lookup[k] = (
intptr_t)vtable[j];
325 else if (match_count == 1) {
327 const int j = topo_pairs[
a - 1].
v_index;
328 index_lookup[j] = (
intptr_t)vtable[j];
336 for (
a = 1;
a <= totvert;
a++) {
337 if ((
a == totvert) || (topo_pairs[
a - 1].
hash != topo_pairs[
a].
hash)) {
338 const int match_count =
a - last;
339 if (match_count == 2) {
344 else if (match_count == 1) {
346 const int j = topo_pairs[
a - 1].
v_index;
A kd-tree for nearest neighbor search.
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 i1
_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 v1
Read Guarded memory(de)allocation.
#define BM_elem_index_get(ele)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
int ED_mesh_mirror_spatial_table_lookup(Object *ob, BMEditMesh *em, Mesh *me_eval, const float co[3])
void ED_mesh_mirror_spatial_table_begin(Object *ob, BMEditMesh *em, Mesh *me_eval)
static int mirrtopo_vert_sort(const void *v1, const void *v2)
bool ED_mesh_mirrtopo_recalc_check(BMEditMesh *em, Mesh *me, MirrTopoStore_t *mesh_topo_store)
static int mirrtopo_hash_sort(const void *l1, const void *l2)
static struct @460 MirrKdStore
void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store)
struct MirrTopoVert_t MirrTopoVert_t
void ED_mesh_mirror_spatial_table_end(Object *UNUSED(ob))
void ED_mesh_mirrtopo_init(BMEditMesh *em, Mesh *me, MirrTopoStore_t *mesh_topo_store, const bool skip_em_vert_array_init)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
struct BMEditMesh * edit_mesh