Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/python/mathutils/mathutils_bvhtree.c')
-rw-r--r--source/blender/python/mathutils/mathutils_bvhtree.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c b/source/blender/python/mathutils/mathutils_bvhtree.c
index 8af6e9a527e..ecc128bf008 100644
--- a/source/blender/python/mathutils/mathutils_bvhtree.c
+++ b/source/blender/python/mathutils/mathutils_bvhtree.c
@@ -97,8 +97,8 @@ typedef struct {
float epsilon;
float (*coords)[3];
- unsigned int (*tris)[3];
- unsigned int coords_len, tris_len;
+ uint (*tris)[3];
+ uint coords_len, tris_len;
/* Optional members */
/* aligned with 'tris' */
@@ -115,9 +115,9 @@ static PyObject *bvhtree_CreatePyObject(BVHTree *tree,
float epsilon,
float (*coords)[3],
- unsigned int coords_len,
- unsigned int (*tris)[3],
- unsigned int tris_len,
+ uint coords_len,
+ uint (*tris)[3],
+ uint tris_len,
/* optional arrays */
int *orig_index,
@@ -276,7 +276,7 @@ static void py_bvhtree_raycast_cb(void *userdata,
const PyBVHTree *self = userdata;
const float(*coords)[3] = (const float(*)[3])self->coords;
- const unsigned int *tri = self->tris[index];
+ const uint *tri = self->tris[index];
const float *tri_co[3] = {coords[tri[0]], coords[tri[1]], coords[tri[2]]};
float dist;
@@ -308,7 +308,7 @@ static void py_bvhtree_nearest_point_cb(void *userdata,
PyBVHTree *self = userdata;
const float(*coords)[3] = (const float(*)[3])self->coords;
- const unsigned int *tri = self->tris[index];
+ const uint *tri = self->tris[index];
const float *tri_co[3] = {coords[tri[0]], coords[tri[1]], coords[tri[2]]};
float nearest_tmp[3], dist_sq;
@@ -435,7 +435,7 @@ static void py_bvhtree_nearest_point_range_cb(void *userdata,
PyBVHTree *self = data->self;
const float(*coords)[3] = (const float(*)[3])self->coords;
- const unsigned int *tri = self->tris[index];
+ const uint *tri = self->tris[index];
const float *tri_co[3] = {coords[tri[0]], coords[tri[1]], coords[tri[2]]};
float nearest_tmp[3], dist_sq;
@@ -502,11 +502,11 @@ static PyObject *py_bvhtree_find_nearest_range(PyBVHTree *self, PyObject *args)
return ret;
}
-BLI_INLINE unsigned int overlap_hash(const void *overlap_v)
+BLI_INLINE uint overlap_hash(const void *overlap_v)
{
const BVHTreeOverlap *overlap = overlap_v;
/* same constants as edge-hash */
- return (((unsigned int)overlap->indexA * 65) ^ ((unsigned int)overlap->indexA * 31));
+ return (((uint)overlap->indexA * 65) ^ ((uint)overlap->indexA * 31));
}
BLI_INLINE bool overlap_cmp(const void *a_v, const void *b_v)
@@ -526,8 +526,8 @@ static bool py_bvhtree_overlap_cb(void *userdata, int index_a, int index_b, int
struct PyBVHTree_OverlapData *data = userdata;
PyBVHTree *tree_a = data->tree_pair[0];
PyBVHTree *tree_b = data->tree_pair[1];
- const unsigned int *tri_a = tree_a->tris[index_a];
- const unsigned int *tri_b = tree_b->tris[index_b];
+ const uint *tri_a = tree_a->tris[index_a];
+ const uint *tri_b = tree_b->tris[index_b];
const float *tri_a_co[3] = {
tree_a->coords[tri_a[0]], tree_a->coords[tri_a[1]], tree_a->coords[tri_a[2]]};
const float *tri_b_co[3] = {
@@ -569,7 +569,7 @@ static PyObject *py_bvhtree_overlap(PyBVHTree *self, PyBVHTree *other)
{
struct PyBVHTree_OverlapData data;
BVHTreeOverlap *overlap;
- unsigned int overlap_len = 0;
+ uint overlap_len = 0;
PyObject *ret;
if (!PyBVHTree_CheckExact(other)) {
@@ -595,7 +595,7 @@ static PyObject *py_bvhtree_overlap(PyBVHTree *self, PyBVHTree *other)
BLI_gset_new_ex(overlap_hash, overlap_cmp, __func__, overlap_len) :
NULL;
/* simple case, no index remapping */
- unsigned int i;
+ uint i;
for (i = 0; i < overlap_len; i++) {
PyObject *item;
@@ -664,8 +664,8 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P
MemArena *pf_arena = NULL;
float(*coords)[3] = NULL;
- unsigned int(*tris)[3] = NULL;
- unsigned int coords_len, tris_len;
+ uint(*tris)[3] = NULL;
+ uint coords_len, tris_len;
float epsilon = 0.0f;
bool all_triangles = false;
@@ -673,7 +673,7 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P
int *orig_index = NULL;
float(*orig_normal)[3] = NULL;
- unsigned int i;
+ uint i;
bool valid = true;
if (!PyArg_ParseTupleAndKeywords(args,
@@ -696,7 +696,7 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P
if (valid) {
PyObject **py_coords_fast_items = PySequence_Fast_ITEMS(py_coords_fast);
- coords_len = (unsigned int)PySequence_Fast_GET_SIZE(py_coords_fast);
+ coords_len = (uint)PySequence_Fast_GET_SIZE(py_coords_fast);
coords = MEM_mallocN((size_t)coords_len * sizeof(*coords), __func__);
for (i = 0; i < coords_len; i++) {
@@ -715,14 +715,14 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P
else if (all_triangles) {
/* all triangles, simple case */
PyObject **py_tris_fast_items = PySequence_Fast_ITEMS(py_tris_fast);
- tris_len = (unsigned int)PySequence_Fast_GET_SIZE(py_tris_fast);
+ tris_len = (uint)PySequence_Fast_GET_SIZE(py_tris_fast);
tris = MEM_mallocN((size_t)tris_len * sizeof(*tris), __func__);
for (i = 0; i < tris_len; i++) {
PyObject *py_tricoords = py_tris_fast_items[i];
PyObject *py_tricoords_fast;
PyObject **py_tricoords_fast_items;
- unsigned int *tri = tris[i];
+ uint *tri = tris[i];
int j;
if (!(py_tricoords_fast = PySequence_Fast(py_tricoords, error_prefix))) {
@@ -745,7 +745,7 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P
for (j = 0; j < 3; j++) {
tri[j] = PyC_Long_AsU32(py_tricoords_fast_items[j]);
- if (UNLIKELY(tri[j] >= (unsigned int)coords_len)) {
+ if (UNLIKELY(tri[j] >= (uint)coords_len)) {
PyErr_Format(PyExc_ValueError,
"%s: index %d must be less than %d",
error_prefix,
@@ -763,11 +763,11 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P
}
else {
/* ngon support (much more involved) */
- const unsigned int polys_len = (unsigned int)PySequence_Fast_GET_SIZE(py_tris_fast);
+ const uint polys_len = (uint)PySequence_Fast_GET_SIZE(py_tris_fast);
struct PolyLink {
struct PolyLink *next;
- unsigned int len;
- unsigned int poly[0];
+ uint len;
+ uint poly[0];
} *plink_first = NULL, **p_plink_prev = &plink_first, *plink = NULL;
int poly_index;
@@ -779,27 +779,27 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P
PyObject *py_tricoords = PySequence_Fast_GET_ITEM(py_tris_fast, i);
PyObject *py_tricoords_fast;
PyObject **py_tricoords_fast_items;
- unsigned int py_tricoords_len;
- unsigned int j;
+ uint py_tricoords_len;
+ uint j;
if (!(py_tricoords_fast = PySequence_Fast(py_tricoords, error_prefix))) {
valid = false;
break;
}
- py_tricoords_len = (unsigned int)PySequence_Fast_GET_SIZE(py_tricoords_fast);
+ py_tricoords_len = (uint)PySequence_Fast_GET_SIZE(py_tricoords_fast);
py_tricoords_fast_items = PySequence_Fast_ITEMS(py_tricoords_fast);
plink = BLI_memarena_alloc(poly_arena,
sizeof(*plink) + (sizeof(int) * (size_t)py_tricoords_len));
- plink->len = (unsigned int)py_tricoords_len;
+ plink->len = (uint)py_tricoords_len;
*p_plink_prev = plink;
p_plink_prev = &plink->next;
for (j = 0; j < py_tricoords_len; j++) {
plink->poly[j] = PyC_Long_AsU32(py_tricoords_fast_items[j]);
- if (UNLIKELY(plink->poly[j] >= (unsigned int)coords_len)) {
+ if (UNLIKELY(plink->poly[j] >= (uint)coords_len)) {
PyErr_Format(PyExc_ValueError,
"%s: index %d must be less than %d",
error_prefix,
@@ -829,8 +829,8 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P
for (plink = plink_first, poly_index = 0, i = 0; plink; plink = plink->next, poly_index++) {
if (plink->len == 3) {
- unsigned int *tri = tris[i];
- memcpy(tri, plink->poly, sizeof(unsigned int[3]));
+ uint *tri = tris[i];
+ memcpy(tri, plink->poly, sizeof(uint[3]));
orig_index[i] = poly_index;
normal_tri_v3(orig_normal[poly_index], coords[tri[0]], coords[tri[1]], coords[tri[2]]);
i++;
@@ -841,8 +841,8 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P
const float *co_prev;
const float *co_curr;
float axis_mat[3][3];
- unsigned int(*tris_offset)[3] = &tris[i];
- unsigned int j;
+ uint(*tris_offset)[3] = &tris[i];
+ uint j;
/* calc normal and setup 'proj_coords' */
zero_v3(normal);
@@ -864,7 +864,7 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P
j = plink->len - 2;
while (j--) {
- unsigned int *tri = tris_offset[j];
+ uint *tri = tris_offset[j];
/* remap to global indices */
tri[0] = plink->poly[tri[0]];
tri[1] = plink->poly[tri[1]];
@@ -942,8 +942,8 @@ static PyObject *C_BVHTree_FromBMesh(PyObject *UNUSED(cls), PyObject *args, PyOb
BPy_BMesh *py_bm;
float(*coords)[3] = NULL;
- unsigned int(*tris)[3] = NULL;
- unsigned int coords_len, tris_len;
+ uint(*tris)[3] = NULL;
+ uint coords_len, tris_len;
float epsilon = 0.0f;
BMesh *bm;
@@ -965,8 +965,8 @@ static PyObject *C_BVHTree_FromBMesh(PyObject *UNUSED(cls), PyObject *args, PyOb
{
int tris_len_dummy;
- coords_len = (unsigned int)bm->totvert;
- tris_len = (unsigned int)poly_to_tri_count(bm->totface, bm->totloop);
+ coords_len = (uint)bm->totvert;
+ tris_len = (uint)poly_to_tri_count(bm->totface, bm->totloop);
coords = MEM_mallocN(sizeof(*coords) * (size_t)coords_len, __func__);
tris = MEM_mallocN(sizeof(*tris) * (size_t)tris_len, __func__);
@@ -980,7 +980,7 @@ static PyObject *C_BVHTree_FromBMesh(PyObject *UNUSED(cls), PyObject *args, PyOb
{
BMIter iter;
BVHTree *tree;
- unsigned int i;
+ uint i;
int *orig_index = NULL;
float(*orig_normal)[3] = NULL;
@@ -1006,9 +1006,9 @@ static PyObject *C_BVHTree_FromBMesh(PyObject *UNUSED(cls), PyObject *args, PyOb
for (i = 0; i < tris_len; i++) {
float co[3][3];
- tris[i][0] = (unsigned int)BM_elem_index_get(looptris[i][0]->v);
- tris[i][1] = (unsigned int)BM_elem_index_get(looptris[i][1]->v);
- tris[i][2] = (unsigned int)BM_elem_index_get(looptris[i][2]->v);
+ tris[i][0] = (uint)BM_elem_index_get(looptris[i][0]->v);
+ tris[i][1] = (uint)BM_elem_index_get(looptris[i][1]->v);
+ tris[i][2] = (uint)BM_elem_index_get(looptris[i][2]->v);
copy_v3_v3(co[0], coords[tris[i][0]]);
copy_v3_v3(co[1], coords[tris[i][1]]);
@@ -1136,8 +1136,8 @@ static PyObject *C_BVHTree_FromObject(PyObject *UNUSED(cls), PyObject *args, PyO
const MLoop *mloop;
float(*coords)[3] = NULL;
- unsigned int(*tris)[3] = NULL;
- unsigned int coords_len, tris_len;
+ uint(*tris)[3] = NULL;
+ uint coords_len, tris_len;
float epsilon = 0.0f;
if (!PyArg_ParseTupleAndKeywords(args,
@@ -1167,8 +1167,8 @@ static PyObject *C_BVHTree_FromObject(PyObject *UNUSED(cls), PyObject *args, PyO
{
lt = BKE_mesh_runtime_looptri_ensure(mesh);
- tris_len = (unsigned int)BKE_mesh_runtime_looptri_len(mesh);
- coords_len = (unsigned int)mesh->totvert;
+ tris_len = (uint)BKE_mesh_runtime_looptri_len(mesh);
+ coords_len = (uint)mesh->totvert;
coords = MEM_mallocN(sizeof(*coords) * (size_t)coords_len, __func__);
tris = MEM_mallocN(sizeof(*tris) * (size_t)tris_len, __func__);
@@ -1183,7 +1183,7 @@ static PyObject *C_BVHTree_FromObject(PyObject *UNUSED(cls), PyObject *args, PyO
{
BVHTree *tree;
- unsigned int i;
+ uint i;
int *orig_index = NULL;
float(*orig_normal)[3] = NULL;