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_geometry.c')
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index 88b3bddddf6..c73dea79aac 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -1505,6 +1505,9 @@ static PyObject *list_of_lists_from_arrays(const int *array,
PyObject *ret, *sublist;
int i, j, sublist_len, sublist_start, val;
+ if (array == NULL) {
+ return PyList_New(0);
+ }
ret = PyList_New(toplevel_len);
for (i = 0; i < toplevel_len; i++) {
sublist_len = len_table[i];
@@ -1521,7 +1524,8 @@ static PyObject *list_of_lists_from_arrays(const int *array,
PyDoc_STRVAR(
M_Geometry_delaunay_2d_cdt_doc,
- ".. function:: delaunay_2d_cdt(vert_coords, edges, faces, output_type, epsilon)\n"
+ ".. function:: delaunay_2d_cdt(vert_coords, edges, faces, output_type, epsilon, "
+ "need_ids=True)\n"
"\n"
" Computes the Constrained Delaunay Triangulation of a set of vertices,\n"
" with edges and faces that must appear in the triangulation.\n"
@@ -1533,6 +1537,8 @@ PyDoc_STRVAR(
" input element indices corresponding to the positionally same output element.\n"
" For edges, the orig indices start with the input edges and then continue\n"
" with the edges implied by each of the faces (n of them for an n-gon).\n"
+ " If the need_ids argument is supplied, and False, then the code skips the preparation\n"
+ " of the orig arrays, which may save some time."
"\n"
" :arg vert_coords: Vertex coordinates (2d)\n"
" :type vert_coords: list of :class:`mathutils.Vector`\n"
@@ -1543,10 +1549,14 @@ PyDoc_STRVAR(
" :arg output_type: What output looks like. 0 => triangles with convex hull. "
"1 => triangles inside constraints. "
"2 => the input constraints, intersected. "
- "3 => like 2 but with extra edges to make valid BMesh faces.\n"
+ "3 => like 2 but detect holes and omit them from output. "
+ "4 => like 2 but with extra edges to make valid BMesh faces. "
+ "5 => like 4 but detect holes and omit them from output.\n"
" :type output_type: int\\n"
" :arg epsilon: For nearness tests; should not be zero\n"
" :type epsilon: float\n"
+ " :arg need_ids: are the orig output arrays needed?\n"
+ " :type need_args: bool\n"
" :return: Output tuple, (vert_coords, edges, faces, orig_verts, orig_edges, orig_faces)\n"
" :rtype: (list of `mathutils.Vector`, "
"list of (int, int), "
@@ -1561,6 +1571,7 @@ static PyObject *M_Geometry_delaunay_2d_cdt(PyObject *UNUSED(self), PyObject *ar
PyObject *vert_coords, *edges, *faces, *item;
int output_type;
float epsilon;
+ bool need_ids = true;
float(*in_coords)[2] = NULL;
int(*in_edges)[2] = NULL;
int *in_faces = NULL;
@@ -1578,8 +1589,14 @@ static PyObject *M_Geometry_delaunay_2d_cdt(PyObject *UNUSED(self), PyObject *ar
PyObject *ret_value = NULL;
int i;
- if (!PyArg_ParseTuple(
- args, "OOOif:delaunay_2d_cdt", &vert_coords, &edges, &faces, &output_type, &epsilon)) {
+ if (!PyArg_ParseTuple(args,
+ "OOOif|p:delaunay_2d_cdt",
+ &vert_coords,
+ &edges,
+ &faces,
+ &output_type,
+ &epsilon,
+ &need_ids)) {
return NULL;
}
@@ -1609,6 +1626,7 @@ static PyObject *M_Geometry_delaunay_2d_cdt(PyObject *UNUSED(self), PyObject *ar
in.faces_start_table = in_faces_start_table;
in.faces_len_table = in_faces_len_table;
in.epsilon = epsilon;
+ in.need_ids = need_ids;
res = BLI_delaunay_2d_cdt_calc(&in, output_type);