27 #define KD_THRESH 0.00002f
36 const bool use_em = (!me_eval && em && me->
edit_mesh == em);
61 for (i = 0; i < totvert; i++, mvert++) {
79 KDTreeNearest_3d nearest;
80 const int i = BLI_kdtree_3d_find_nearest(
MirrKdStore.tree, co, &nearest);
137 const bool is_editmode = em !=
NULL;
161 const bool skip_em_vert_array_init)
166 const bool is_editmode = (em !=
NULL);
174 int totvert, totedge;
175 int tot_unique = -1, tot_unique_prev = -1;
176 int tot_unique_edges = 0, tot_unique_edges_prev;
215 for (
a = 0, med = medge;
a < totedge;
a++, med++) {
216 const uint i1 = med->v1, i2 = med->v2;
224 tot_unique_prev = -1;
225 tot_unique_edges_prev = -1;
229 tot_unique_edges = 0;
235 topo_hash[
i1] += topo_hash_prev[i2] * topo_pass;
236 topo_hash[i2] += topo_hash_prev[
i1] * topo_pass;
237 tot_unique_edges += (topo_hash[
i1] != topo_hash[i2]);
241 for (
a = 0, med = medge;
a < totedge;
a++, med++) {
242 const uint i1 = med->v1, i2 = med->v2;
243 topo_hash[
i1] += topo_hash_prev[i2] * topo_pass;
244 topo_hash[i2] += topo_hash_prev[
i1] * topo_pass;
245 tot_unique_edges += (topo_hash[
i1] != topo_hash[i2]);
248 memcpy(topo_hash_prev, topo_hash,
sizeof(
MirrTopoHash_t) * totvert);
254 for (
a = 1;
a < totvert;
a++) {
255 if (topo_hash_prev[
a - 1] != topo_hash_prev[
a]) {
260 if ((tot_unique <= tot_unique_prev) && (tot_unique_edges <= tot_unique_edges_prev)) {
265 tot_unique_prev = tot_unique;
266 tot_unique_edges_prev = tot_unique_edges;
268 memcpy(topo_hash_prev, topo_hash,
sizeof(
MirrTopoHash_t) * totvert);
277 index_lookup =
MEM_mallocN(totvert *
sizeof(*index_lookup),
"mesh_topo_lookup");
280 if (skip_em_vert_array_init ==
false) {
285 for (
a = 0;
a < totvert;
a++) {
286 topo_pairs[
a].
hash = topo_hash[
a];
290 index_lookup[
a] = -1;
302 for (
a = 1;
a <= totvert;
a++) {
305 if ((
a == totvert) || (topo_pairs[
a - 1].
hash != topo_pairs[
a].
hash)) {
306 const int match_count =
a - last;
307 if (match_count == 2) {
309 index_lookup[j] = (
intptr_t)vtable[k];
310 index_lookup[k] = (
intptr_t)vtable[j];
312 else if (match_count == 1) {
314 const int j = topo_pairs[
a - 1].
v_index;
315 index_lookup[j] = (
intptr_t)vtable[j];
323 for (
a = 1;
a <= totvert;
a++) {
324 if ((
a == totvert) || (topo_pairs[
a - 1].
hash != topo_pairs[
a].
hash)) {
325 const int match_count =
a - last;
326 if (match_count == 2) {
331 else if (match_count == 1) {
333 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)
void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store)
static struct @484 MirrKdStore
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