27 #ifndef MATH_STANDALONE
40 #include "../generic/py_capi_utils.h"
41 #include "../generic/python_utildefines.h"
49 ".. function:: intersect_ray_tri(v1, v2, v3, ray, orig, clip=True)\n"
51 " Returns the intersection between a ray and a triangle, if possible, returns None "
55 " :type v1: :class:`mathutils.Vector`\n"
57 " :type v2: :class:`mathutils.Vector`\n"
59 " :type v3: :class:`mathutils.Vector`\n"
60 " :arg ray: Direction of the projection\n"
61 " :type ray: :class:`mathutils.Vector`\n"
62 " :arg orig: Origin\n"
63 " :type orig: :class:`mathutils.Vector`\n"
64 " :arg clip: When False, don't restrict the intersection to the area of the "
65 "triangle, use the infinite plane defined by the triangle.\n"
66 " :type clip: boolean\n"
67 " :return: The point of intersection or None if no intersection is found\n"
68 " :rtype: :class:`mathutils.Vector` or None\n");
71 const char *error_prefix =
"intersect_ray_tri";
72 PyObject *py_ray, *py_ray_off, *py_tri[3];
73 float dir[3], orig[3], tri[3][3], e1[3], e2[3], pvec[3], tvec[3], qvec[3];
74 float det, inv_det, u,
v,
t;
78 if (!PyArg_ParseTuple(args,
79 "OOOOO|O&:intersect_ray_tri",
114 if (det > -0.000001f && det < 0.000001f) {
118 inv_det = 1.0f / det;
125 if (clip && (u < 0.0f || u > 1.0f)) {
135 if (clip && (v < 0.0f || u + v > 1.0f)) {
156 ".. function:: intersect_line_line(v1, v2, v3, v4)\n"
158 " Returns a tuple with the points on each line respectively closest to the other.\n"
160 " :arg v1: First point of the first line\n"
161 " :type v1: :class:`mathutils.Vector`\n"
162 " :arg v2: Second point of the first line\n"
163 " :type v2: :class:`mathutils.Vector`\n"
164 " :arg v3: First point of the second line\n"
165 " :type v3: :class:`mathutils.Vector`\n"
166 " :arg v4: Second point of the second line\n"
167 " :type v4: :class:`mathutils.Vector`\n"
168 " :rtype: tuple of :class:`mathutils.Vector`'s\n");
171 const char *error_prefix =
"intersect_line_line";
173 PyObject *py_lines[4];
174 float lines[4][3],
i1[3], i2[3];
178 if (!PyArg_ParseTuple(args,
"OOOO:intersect_line_line",
UNPACK4_EX(&, py_lines, ))) {
215 tuple = PyTuple_New(2);
224 M_Geometry_intersect_sphere_sphere_2d_doc,
225 ".. function:: intersect_sphere_sphere_2d(p_a, radius_a, p_b, radius_b)\n"
227 " Returns 2 points on between intersecting circles.\n"
229 " :arg p_a: Center of the first circle\n"
230 " :type p_a: :class:`mathutils.Vector`\n"
231 " :arg radius_a: Radius of the first circle\n"
232 " :type radius_a: float\n"
233 " :arg p_b: Center of the second circle\n"
234 " :type p_b: :class:`mathutils.Vector`\n"
235 " :arg radius_b: Radius of the second circle\n"
236 " :type radius_b: float\n"
237 " :rtype: tuple of :class:`mathutils.Vector`'s or None when there is no intersection\n");
240 const char *error_prefix =
"intersect_sphere_sphere_2d";
242 PyObject *py_v_a, *py_v_b;
243 float v_a[2], v_b[2];
248 if (!PyArg_ParseTuple(
249 args,
"OfOf:intersect_sphere_sphere_2d", &py_v_a, &rad_a, &py_v_b, &rad_b)) {
258 ret = PyTuple_New(2);
264 (dist > rad_a + rad_b) ||
266 (dist <
fabsf(rad_a - rad_b)) ||
268 (dist < FLT_EPSILON)) {
273 const float dist_delta = ((rad_a * rad_a) - (rad_b * rad_b) + (dist * dist)) / (2.0f * dist);
274 const float h =
powf(
fabsf((rad_a * rad_a) - (dist_delta * dist_delta)), 0.5f);
278 i_cent[0] = v_a[0] + ((v_ab[0] * dist_delta) / dist);
279 i_cent[1] = v_a[1] + ((v_ab[1] * dist_delta) / dist);
281 i1[0] = i_cent[0] + h * v_ab[1] / dist;
282 i1[1] = i_cent[1] - h * v_ab[0] / dist;
284 i2[0] = i_cent[0] - h * v_ab[1] / dist;
285 i2[1] = i_cent[1] + h * v_ab[0] / dist;
294 ".. function:: intersect_tri_tri_2d(tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n"
296 " Check if two 2D triangles intersect.\n"
301 const char *error_prefix =
"intersect_tri_tri_2d";
302 PyObject *tri_pair_py[2][3];
303 float tri_pair[2][3][2];
305 if (!PyArg_ParseTuple(args,
306 "OOOOOO:intersect_tri_tri_2d",
312 &tri_pair_py[1][2])) {
316 for (
int i = 0; i < 2; i++) {
317 for (
int j = 0; j < 3; j++) {
319 tri_pair[i][j], 2, 2 |
MU_ARRAY_SPILL, tri_pair_py[i][j], error_prefix) == -1) {
326 return PyBool_FromLong(
ret);
330 ".. function:: normal(vectors)\n"
332 " Returns the normal of a 3D polygon.\n"
334 " :arg vectors: Vectors to calculate normals with\n"
335 " :type vectors: sequence of 3 or more 3d vector\n"
336 " :rtype: :class:`mathutils.Vector`\n");
345 if (PyTuple_GET_SIZE(args) == 1) {
346 args = PyTuple_GET_ITEM(args, 0);
354 if (coords_len < 3) {
355 PyErr_SetString(PyExc_ValueError,
"Expected 3 or more vectors");
370 ".. function:: area_tri(v1, v2, v3)\n"
372 " Returns the area size of the 2D or 3D triangle defined.\n"
375 " :type v1: :class:`mathutils.Vector`\n"
377 " :type v2: :class:`mathutils.Vector`\n"
379 " :type v3: :class:`mathutils.Vector`\n"
383 const char *error_prefix =
"area_tri";
388 if (!PyArg_ParseTuple(args,
"OOO:area_tri",
UNPACK3_EX(&, py_tri, ))) {
402 ".. function:: volume_tetrahedron(v1, v2, v3, v4)\n"
404 " Return the volume formed by a tetrahedron (points can be in any order).\n"
407 " :type v1: :class:`mathutils.Vector`\n"
409 " :type v2: :class:`mathutils.Vector`\n"
411 " :type v3: :class:`mathutils.Vector`\n"
413 " :type v4: :class:`mathutils.Vector`\n"
417 const char *error_prefix =
"volume_tetrahedron";
422 if (!PyArg_ParseTuple(args,
"OOOO:volume_tetrahedron",
UNPACK4_EX(&, py_tet, ))) {
436 M_Geometry_intersect_line_line_2d_doc,
437 ".. function:: intersect_line_line_2d(lineA_p1, lineA_p2, lineB_p1, lineB_p2)\n"
439 " Takes 2 segments (defined by 4 vectors) and returns a vector for their point of "
440 "intersection or None.\n"
442 " .. warning:: Despite its name, this function works on segments, and not on lines.\n"
444 " :arg lineA_p1: First point of the first line\n"
445 " :type lineA_p1: :class:`mathutils.Vector`\n"
446 " :arg lineA_p2: Second point of the first line\n"
447 " :type lineA_p2: :class:`mathutils.Vector`\n"
448 " :arg lineB_p1: First point of the second line\n"
449 " :type lineB_p1: :class:`mathutils.Vector`\n"
450 " :arg lineB_p2: Second point of the second line\n"
451 " :type lineB_p2: :class:`mathutils.Vector`\n"
452 " :return: The point of intersection or None when not found\n"
453 " :rtype: :class:`mathutils.Vector` or None\n");
456 const char *error_prefix =
"intersect_line_line_2d";
457 PyObject *py_lines[4];
462 if (!PyArg_ParseTuple(args,
"OOOO:intersect_line_line_2d",
UNPACK4_EX(&, py_lines, ))) {
480 M_Geometry_intersect_line_plane_doc,
481 ".. function:: intersect_line_plane(line_a, line_b, plane_co, plane_no, no_flip=False)\n"
483 " Calculate the intersection between a line (as 2 vectors) and a plane.\n"
484 " Returns a vector for the intersection or None.\n"
486 " :arg line_a: First point of the first line\n"
487 " :type line_a: :class:`mathutils.Vector`\n"
488 " :arg line_b: Second point of the first line\n"
489 " :type line_b: :class:`mathutils.Vector`\n"
490 " :arg plane_co: A point on the plane\n"
491 " :type plane_co: :class:`mathutils.Vector`\n"
492 " :arg plane_no: The direction the plane is facing\n"
493 " :type plane_no: :class:`mathutils.Vector`\n"
494 " :return: The point of intersection or None when not found\n"
495 " :rtype: :class:`mathutils.Vector` or None\n");
498 const char *error_prefix =
"intersect_line_plane";
499 PyObject *py_line_a, *py_line_b, *py_plane_co, *py_plane_no;
500 float line_a[3], line_b[3], plane_co[3], plane_no[3];
502 const bool no_flip =
false;
504 if (!PyArg_ParseTuple(args,
505 "OOOO|O&:intersect_line_plane",
532 M_Geometry_intersect_plane_plane_doc,
533 ".. function:: intersect_plane_plane(plane_a_co, plane_a_no, plane_b_co, plane_b_no)\n"
535 " Return the intersection between two planes\n"
537 " :arg plane_a_co: Point on the first plane\n"
538 " :type plane_a_co: :class:`mathutils.Vector`\n"
539 " :arg plane_a_no: Normal of the first plane\n"
540 " :type plane_a_no: :class:`mathutils.Vector`\n"
541 " :arg plane_b_co: Point on the second plane\n"
542 " :type plane_b_co: :class:`mathutils.Vector`\n"
543 " :arg plane_b_no: Normal of the second plane\n"
544 " :type plane_b_no: :class:`mathutils.Vector`\n"
545 " :return: The line of the intersection represented as a point and a vector\n"
546 " :rtype: tuple pair of :class:`mathutils.Vector` or None if the intersection can't be "
550 const char *error_prefix =
"intersect_plane_plane";
551 PyObject *
ret, *ret_co, *ret_no;
552 PyObject *py_plane_a_co, *py_plane_a_no, *py_plane_b_co, *py_plane_b_no;
553 float plane_a_co[3], plane_a_no[3], plane_b_co[3], plane_b_no[3];
554 float plane_a[4], plane_b[4];
559 if (!PyArg_ParseTuple(args,
560 "OOOO:intersect_plane_plane",
589 ret_co = Py_INCREF_RET(Py_None);
590 ret_no = Py_INCREF_RET(Py_None);
593 ret = PyTuple_New(2);
599 M_Geometry_intersect_line_sphere_doc,
600 ".. function:: intersect_line_sphere(line_a, line_b, sphere_co, sphere_radius, clip=True)\n"
602 " Takes a line (as 2 points) and a sphere (as a point and a radius) and\n"
603 " returns the intersection\n"
605 " :arg line_a: First point of the line\n"
606 " :type line_a: :class:`mathutils.Vector`\n"
607 " :arg line_b: Second point of the line\n"
608 " :type line_b: :class:`mathutils.Vector`\n"
609 " :arg sphere_co: The center of the sphere\n"
610 " :type sphere_co: :class:`mathutils.Vector`\n"
611 " :arg sphere_radius: Radius of the sphere\n"
612 " :type sphere_radius: sphere_radius\n"
613 " :return: The intersection points as a pair of vectors or None when there is no "
615 " :rtype: A tuple pair containing :class:`mathutils.Vector` or None\n");
618 const char *error_prefix =
"intersect_line_sphere";
619 PyObject *py_line_a, *py_line_b, *py_sphere_co;
620 float line_a[3], line_b[3], sphere_co[3];
627 if (!PyArg_ParseTuple(args,
628 "OOOf|O&:intersect_line_sphere",
649 PyObject *
ret = PyTuple_New(2);
654 (lambda <= 1.0f)))) {
661 (lambda <= 1.0f)))) {
665 (lambda <= 1.0f)))) {
684 M_Geometry_intersect_line_sphere_2d_doc,
685 ".. function:: intersect_line_sphere_2d(line_a, line_b, sphere_co, sphere_radius, clip=True)\n"
687 " Takes a line (as 2 points) and a sphere (as a point and a radius) and\n"
688 " returns the intersection\n"
690 " :arg line_a: First point of the line\n"
691 " :type line_a: :class:`mathutils.Vector`\n"
692 " :arg line_b: Second point of the line\n"
693 " :type line_b: :class:`mathutils.Vector`\n"
694 " :arg sphere_co: The center of the sphere\n"
695 " :type sphere_co: :class:`mathutils.Vector`\n"
696 " :arg sphere_radius: Radius of the sphere\n"
697 " :type sphere_radius: sphere_radius\n"
698 " :return: The intersection points as a pair of vectors or None when there is no "
700 " :rtype: A tuple pair containing :class:`mathutils.Vector` or None\n");
703 const char *error_prefix =
"intersect_line_sphere_2d";
704 PyObject *py_line_a, *py_line_b, *py_sphere_co;
705 float line_a[2], line_b[2], sphere_co[2];
712 if (!PyArg_ParseTuple(args,
713 "OOOf|O&:intersect_line_sphere_2d",
734 PyObject *
ret = PyTuple_New(2);
739 (lambda <= 1.0f)))) {
746 (lambda <= 1.0f)))) {
750 (lambda <= 1.0f)))) {
768 M_Geometry_intersect_point_line_doc,
769 ".. function:: intersect_point_line(pt, line_p1, line_p2)\n"
771 " Takes a point and a line and returns a tuple with the closest point on the line and its "
772 "distance from the first point of the line as a percentage of the length of the line.\n"
775 " :type pt: :class:`mathutils.Vector`\n"
776 " :arg line_p1: First point of the line\n"
777 " :type line_p1: :class:`mathutils.Vector`\n"
778 " :arg line_p1: Second point of the line\n"
779 " :type line_p1: :class:`mathutils.Vector`\n"
780 " :rtype: (:class:`mathutils.Vector`, float)\n");
783 const char *error_prefix =
"intersect_point_line";
784 PyObject *py_pt, *py_line_a, *py_line_b;
785 float pt[3], pt_out[3], line_a[3], line_b[3];
790 if (!PyArg_ParseTuple(args,
"OOO:intersect_point_line", &py_pt, &py_line_a, &py_line_b)) {
807 ret = PyTuple_New(2);
813 ".. function:: intersect_point_tri(pt, tri_p1, tri_p2, tri_p3)\n"
815 " Takes 4 vectors: one is the point and the next 3 define the triangle. Projects "
816 "the point onto the triangle plane and checks if it is within the triangle.\n"
819 " :type pt: :class:`mathutils.Vector`\n"
820 " :arg tri_p1: First point of the triangle\n"
821 " :type tri_p1: :class:`mathutils.Vector`\n"
822 " :arg tri_p2: Second point of the triangle\n"
823 " :type tri_p2: :class:`mathutils.Vector`\n"
824 " :arg tri_p3: Third point of the triangle\n"
825 " :type tri_p3: :class:`mathutils.Vector`\n"
826 " :return: Point on the triangles plane or None if its outside the triangle\n"
827 " :rtype: :class:`mathutils.Vector` or None\n");
830 const char *error_prefix =
"intersect_point_tri";
831 PyObject *py_pt, *py_tri[3];
832 float pt[3], tri[3][3];
836 if (!PyArg_ParseTuple(args,
"OOOO:intersect_point_tri", &py_pt,
UNPACK3_EX(&, py_tri, ))) {
859 ".. function:: closest_point_on_tri(pt, tri_p1, tri_p2, tri_p3)\n"
861 " Takes 4 vectors: one is the point and the next 3 define the triangle.\n"
864 " :type pt: :class:`mathutils.Vector`\n"
865 " :arg tri_p1: First point of the triangle\n"
866 " :type tri_p1: :class:`mathutils.Vector`\n"
867 " :arg tri_p2: Second point of the triangle\n"
868 " :type tri_p2: :class:`mathutils.Vector`\n"
869 " :arg tri_p3: Third point of the triangle\n"
870 " :type tri_p3: :class:`mathutils.Vector`\n"
871 " :return: The closest point of the triangle.\n"
872 " :rtype: :class:`mathutils.Vector`\n");
875 const char *error_prefix =
"closest_point_on_tri";
876 PyObject *py_pt, *py_tri[3];
877 float pt[3], tri[3][3];
881 if (!PyArg_ParseTuple(args,
"OOOO:closest_point_on_tri", &py_pt,
UNPACK3_EX(&, py_tri, ))) {
902 M_Geometry_intersect_point_tri_2d_doc,
903 ".. function:: intersect_point_tri_2d(pt, tri_p1, tri_p2, tri_p3)\n"
905 " Takes 4 vectors (using only the x and y coordinates): one is the point and the next 3 "
906 "define the triangle. Returns 1 if the point is within the triangle, otherwise 0.\n"
909 " :type pt: :class:`mathutils.Vector`\n"
910 " :arg tri_p1: First point of the triangle\n"
911 " :type tri_p1: :class:`mathutils.Vector`\n"
912 " :arg tri_p2: Second point of the triangle\n"
913 " :type tri_p2: :class:`mathutils.Vector`\n"
914 " :arg tri_p3: Third point of the triangle\n"
915 " :type tri_p3: :class:`mathutils.Vector`\n"
919 const char *error_prefix =
"intersect_point_tri_2d";
920 PyObject *py_pt, *py_tri[3];
921 float pt[2], tri[3][2];
924 if (!PyArg_ParseTuple(args,
"OOOO:intersect_point_tri_2d", &py_pt,
UNPACK3_EX(&, py_tri, ))) {
941 ".. function:: intersect_point_quad_2d(pt, quad_p1, quad_p2, quad_p3, quad_p4)\n"
943 " Takes 5 vectors (using only the x and y coordinates): one is the point and the "
944 "next 4 define the quad,\n"
945 " only the x and y are used from the vectors. Returns 1 if the point is within the "
946 "quad, otherwise 0.\n"
947 " Works only with convex quads without singular edges.\n"
950 " :type pt: :class:`mathutils.Vector`\n"
951 " :arg quad_p1: First point of the quad\n"
952 " :type quad_p1: :class:`mathutils.Vector`\n"
953 " :arg quad_p2: Second point of the quad\n"
954 " :type quad_p2: :class:`mathutils.Vector`\n"
955 " :arg quad_p3: Third point of the quad\n"
956 " :type quad_p3: :class:`mathutils.Vector`\n"
957 " :arg quad_p4: Fourth point of the quad\n"
958 " :type quad_p4: :class:`mathutils.Vector`\n"
962 const char *error_prefix =
"intersect_point_quad_2d";
963 PyObject *py_pt, *py_quad[4];
964 float pt[2],
quad[4][2];
967 if (!PyArg_ParseTuple(args,
"OOOOO:intersect_point_quad_2d", &py_pt,
UNPACK4_EX(&, py_quad, ))) {
984 ".. function:: distance_point_to_plane(pt, plane_co, plane_no)\n"
986 " Returns the signed distance between a point and a plane "
987 " (negative when below the normal).\n"
990 " :type pt: :class:`mathutils.Vector`\n"
991 " :arg plane_co: A point on the plane\n"
992 " :type plane_co: :class:`mathutils.Vector`\n"
993 " :arg plane_no: The direction the plane is facing\n"
994 " :type plane_no: :class:`mathutils.Vector`\n"
998 const char *error_prefix =
"distance_point_to_plane";
999 PyObject *py_pt, *py_plane_co, *py_plane_no;
1000 float pt[3], plane_co[3], plane_no[3];
1003 if (!PyArg_ParseTuple(args,
"OOO:distance_point_to_plane", &py_pt, &py_plane_co, &py_plane_no)) {
1019 M_Geometry_barycentric_transform_doc,
1020 ".. function:: barycentric_transform(point, tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n"
1022 " Return a transformed point, the transformation is defined by 2 triangles.\n"
1024 " :arg point: The point to transform.\n"
1025 " :type point: :class:`mathutils.Vector`\n"
1026 " :arg tri_a1: source triangle vertex.\n"
1027 " :type tri_a1: :class:`mathutils.Vector`\n"
1028 " :arg tri_a2: source triangle vertex.\n"
1029 " :type tri_a2: :class:`mathutils.Vector`\n"
1030 " :arg tri_a3: source triangle vertex.\n"
1031 " :type tri_a3: :class:`mathutils.Vector`\n"
1032 " :arg tri_b1: target triangle vertex.\n"
1033 " :type tri_b1: :class:`mathutils.Vector`\n"
1034 " :arg tri_b2: target triangle vertex.\n"
1035 " :type tri_b2: :class:`mathutils.Vector`\n"
1036 " :arg tri_b3: target triangle vertex.\n"
1037 " :type tri_b3: :class:`mathutils.Vector`\n"
1038 " :return: The transformed point\n"
1039 " :rtype: :class:`mathutils.Vector`'s\n");
1042 const char *error_prefix =
"barycentric_transform";
1043 PyObject *py_pt_src, *py_tri_src[3], *py_tri_dst[3];
1044 float pt_src[3], pt_dst[3], tri_src[3][3], tri_dst[3][3];
1047 if (!PyArg_ParseTuple(args,
1048 "OOOOOOO:barycentric_transform",
1087 ".. function:: points_in_planes(planes)\n"
1089 " Returns a list of points inside all planes given and a list of index values for "
1090 "the planes used.\n"
1092 " :arg planes: List of planes (4D vectors).\n"
1093 " :type planes: list of :class:`mathutils.Vector`\n"
1094 " :return: two lists, once containing the vertices inside the planes, another "
1095 "containing the plane indices used\n"
1096 " :rtype: pair of lists\n");
1099 PyObject *py_planes;
1103 if (!PyArg_ParseTuple(args,
"O:points_in_planes", &py_planes)) {
1108 (
float **)&planes, 4, py_planes,
"points_in_planes")) == -1) {
1115 .py_verts = PyList_New(0),
1116 .planes_used = PyMem_Malloc(
sizeof(
char) * planes_len),
1120 PyObject *py_plane_index = PyList_New(0);
1122 memset(
user_data.planes_used, 0,
sizeof(
char) * planes_len);
1124 const float eps_coplanar = 1e-4f;
1125 const float eps_isect = 1e-6f;
1133 for (
int i = 0; i < planes_len; i++) {
1135 PyList_APPEND(py_plane_index, PyLong_FromLong(i));
1142 PyObject *
ret = PyTuple_New(2);
1148 #ifndef MATH_STANDALONE
1151 ".. function:: interpolate_bezier(knot1, handle1, handle2, knot2, resolution)\n"
1153 " Interpolate a bezier spline segment.\n"
1155 " :arg knot1: First bezier spline point.\n"
1156 " :type knot1: :class:`mathutils.Vector`\n"
1157 " :arg handle1: First bezier spline handle.\n"
1158 " :type handle1: :class:`mathutils.Vector`\n"
1159 " :arg handle2: Second bezier spline handle.\n"
1160 " :type handle2: :class:`mathutils.Vector`\n"
1161 " :arg knot2: Second bezier spline point.\n"
1162 " :type knot2: :class:`mathutils.Vector`\n"
1163 " :arg resolution: Number of points to return.\n"
1164 " :type resolution: int\n"
1165 " :return: The interpolated points\n"
1166 " :rtype: list of :class:`mathutils.Vector`'s\n");
1169 const char *error_prefix =
"interpolate_bezier";
1170 PyObject *py_data[4];
1171 float data[4][4] = {{0.0f}};
1175 float *coord_array, *fp;
1178 if (!PyArg_ParseTuple(args,
"OOOOi:interpolate_bezier",
UNPACK4_EX(&, py_data, ), &resolu)) {
1182 for (i = 0; i < 4; i++) {
1188 dims =
max_ii(dims, dims_tmp);
1192 PyErr_SetString(PyExc_ValueError,
"resolution must be 2 or over");
1196 coord_array =
MEM_callocN(dims * (resolu) *
sizeof(
float), error_prefix);
1197 for (i = 0; i < dims; i++) {
1199 UNPACK4_EX(,
data, [i]), coord_array + i, resolu - 1,
sizeof(
float) * dims);
1202 list = PyList_New(resolu);
1204 for (i = 0; i < resolu; i++, fp = fp + dims) {
1212 ".. function:: tessellate_polygon(veclist_list)\n"
1214 " Takes a list of polylines (each point a pair or triplet of numbers) and returns "
1215 "the point indices for a polyline filled with triangles. Does not handle degenerate "
1216 "geometry (such as zero-length lines due to consecutive identical points).\n"
1218 " :arg veclist_list: list of polylines\n"
1224 PyObject *polyLine, *polyVec;
1225 int i, len_polylines, len_polypoints;
1226 bool list_parse_error =
false;
1235 if (!PySequence_Check(polyLineSeq)) {
1236 PyErr_SetString(PyExc_TypeError,
"expected a sequence of poly lines");
1240 len_polylines = PySequence_Size(polyLineSeq);
1242 for (i = 0; i < len_polylines; i++) {
1243 polyLine = PySequence_GetItem(polyLineSeq, i);
1244 if (!PySequence_Check(polyLine)) {
1246 Py_XDECREF(polyLine);
1247 PyErr_SetString(PyExc_TypeError,
1248 "One or more of the polylines is not a sequence of mathutils.Vector's");
1252 len_polypoints = PySequence_Size(polyLine);
1253 if (len_polypoints > 0) {
1257 dl->
nr = len_polypoints;
1261 dl->
verts = fp =
MEM_mallocN(
sizeof(
float[3]) * len_polypoints,
"dl verts");
1264 for (
int index = 0; index < len_polypoints; index++, fp += 3) {
1265 polyVec = PySequence_GetItem(polyLine, index);
1267 fp, 2, 3 |
MU_ARRAY_SPILL, polyVec,
"tessellate_polygon: parse coord");
1271 list_parse_error =
true;
1273 else if (polyVec_len == 2) {
1276 else if (polyVec_len == 3) {
1283 Py_DECREF(polyLine);
1286 if (list_parse_error) {
1296 dl = dispbase.
first;
1298 tri_list = PyList_New(dl->
parts);
1301 PyErr_SetString(PyExc_RuntimeError,
"failed to make a new list");
1305 int *dl_face = dl->
index;
1306 for (
int index = 0; index < dl->
parts; index++) {
1307 PyList_SET_ITEM(tri_list, index,
PyC_Tuple_Pack_I32(dl_face[0], dl_face[1], dl_face[2]));
1315 tri_list = PyList_New(0);
1324 PyObject *list_item, *item_1, *item_2;
1328 if (!PyList_Check(value)) {
1329 PyErr_SetString(PyExc_TypeError,
"can only back a list of [x, y, w, h]");
1333 len = PyList_GET_SIZE(value);
1337 for (i = 0; i <
len; i++) {
1338 list_item = PyList_GET_ITEM(value, i);
1339 if (!PyList_Check(list_item) || PyList_GET_SIZE(list_item) < 4) {
1341 PyErr_SetString(PyExc_TypeError,
"can only pack a list of [x, y, w, h]");
1347 item_1 = PyList_GET_ITEM(list_item, 2);
1348 item_2 = PyList_GET_ITEM(list_item, 3);
1350 box->
w = (
float)PyFloat_AsDouble(item_1);
1351 box->
h = (
float)PyFloat_AsDouble(item_2);
1355 if (box->
w < 0.0f || box->
h < 0.0f) {
1357 PyErr_SetString(PyExc_TypeError,
1358 "error parsing width and height values from list: "
1359 "[x, y, w, h], not numbers or below zero");
1366 *r_boxarray = boxarray;
1373 PyObject *list_item;
1375 len = PyList_GET_SIZE(value);
1377 for (i = 0; i <
len; i++) {
1378 const BoxPack *box = &boxarray[i];
1379 list_item = PyList_GET_ITEM(value, box->
index);
1380 PyList_SET_ITEM(list_item, 0, PyFloat_FromDouble(box->
x));
1381 PyList_SET_ITEM(list_item, 1, PyFloat_FromDouble(box->
y));
1386 ".. function:: box_pack_2d(boxes)\n"
1388 " Returns a tuple with the width and height of the packed bounding box.\n"
1390 " :arg boxes: list of boxes, each box is a list where the first 4 items are [x, y, "
1391 "width, height, ...] other items are ignored.\n"
1392 " :type boxes: list\n"
1393 " :return: the width and height of the packed bounding box\n"
1394 " :rtype: tuple, pair of floats\n");
1397 float tot_width = 0.0f, tot_height = 0.0f;
1402 if (!PyList_Check(boxlist)) {
1403 PyErr_SetString(PyExc_TypeError,
"expected a list of boxes [[x, y, w, h], ... ]");
1407 len = PyList_GET_SIZE(boxlist);
1421 ret = PyTuple_New(2);
1427 ".. function:: box_fit_2d(points)\n"
1429 " Returns an angle that best fits the points to an axis aligned rectangle\n"
1431 " :arg points: list of 2d points.\n"
1432 " :type points: list\n"
1434 " :rtype: float\n");
1435 static PyObject *M_Geometry_box_fit_2d(PyObject *
UNUSED(
self), PyObject *pointlist)
1454 return PyFloat_FromDouble(
angle);
1458 ".. function:: convex_hull_2d(points)\n"
1460 " Returns a list of indices into the list given\n"
1462 " :arg points: list of 2d points.\n"
1463 " :type points: list\n"
1464 " :return: a list of indices\n"
1465 " :rtype: list of ints\n");
1466 static PyObject *M_Geometry_convex_hull_2d(PyObject *
UNUSED(
self), PyObject *pointlist)
1480 Py_ssize_t len_ret, i;
1487 ret = PyList_New(len_ret);
1488 for (i = 0; i < len_ret; i++) {
1489 PyList_SET_ITEM(
ret, i, PyLong_FromLong(index_map[i]));
1497 ret = PyList_New(0);
1507 static PyObject *list_of_lists_from_arrays(
const int *
array,
1508 const int *start_table,
1509 const int *len_table,
1512 PyObject *
ret, *sublist;
1513 int i, j, sublist_len, sublist_start, val;
1515 ret = PyList_New(toplevel_len);
1516 for (i = 0; i < toplevel_len; i++) {
1517 sublist_len = len_table[i];
1518 sublist = PyList_New(sublist_len);
1519 sublist_start = start_table[i];
1520 for (j = 0; j < sublist_len; j++) {
1521 val =
array[sublist_start + j];
1522 PyList_SET_ITEM(sublist, j, PyLong_FromLong(val));
1524 PyList_SET_ITEM(
ret, i, sublist);
1530 M_Geometry_delaunay_2d_cdt_doc,
1531 ".. function:: delaunay_2d_cdt(vert_coords, edges, faces, output_type, epsilon)\n"
1533 " Computes the Constrained Delaunay Triangulation of a set of vertices,\n"
1534 " with edges and faces that must appear in the triangulation.\n"
1535 " Some triangles may be eaten away, or combined with other triangles,\n"
1536 " according to output type.\n"
1537 " The returned verts may be in a different order from input verts, may be moved\n"
1538 " slightly, and may be merged with other nearby verts.\n"
1539 " The three returned orig lists give, for each of verts, edges, and faces, the list of\n"
1540 " input element indices corresponding to the positionally same output element.\n"
1541 " For edges, the orig indices start with the input edges and then continue\n"
1542 " with the edges implied by each of the faces (n of them for an n-gon).\n"
1544 " :arg vert_coords: Vertex coordinates (2d)\n"
1545 " :type vert_coords: list of :class:`mathutils.Vector`\n"
1546 " :arg edges: Edges, as pairs of indices in `vert_coords`\n"
1547 " :type edges: list of (int, int)\n"
1548 " :arg faces: Faces, each sublist is a face, as indices in `vert_coords` (CCW oriented)\n"
1549 " :type faces: list of list of int\n"
1550 " :arg output_type: What output looks like. 0 => triangles with convex hull. "
1551 "1 => triangles inside constraints. "
1552 "2 => the input constraints, intersected. "
1553 "3 => like 2 but with extra edges to make valid BMesh faces.\n"
1554 " :type output_type: int\\n"
1555 " :arg epsilon: For nearness tests; should not be zero\n"
1556 " :type epsilon: float\n"
1557 " :return: Output tuple, (vert_coords, edges, faces, orig_verts, orig_edges, orig_faces)\n"
1558 " :rtype: (list of `mathutils.Vector`, "
1559 "list of (int, int), "
1560 "list of list of int, "
1561 "list of list of int, "
1562 "list of list of int, "
1563 "list of list of int)\n"
1565 static PyObject *M_Geometry_delaunay_2d_cdt(PyObject *
UNUSED(
self), PyObject *args)
1567 const char *error_prefix =
"delaunay_2d_cdt";
1568 PyObject *vert_coords, *edges, *
faces, *item;
1572 int(*in_edges)[2] =
NULL;
1573 int *in_faces =
NULL;
1574 int *in_faces_start_table =
NULL;
1575 int *in_faces_len_table =
NULL;
1576 Py_ssize_t vert_coords_len, edges_len, faces_len;
1579 PyObject *out_vert_coords =
NULL;
1580 PyObject *out_edges =
NULL;
1581 PyObject *out_faces =
NULL;
1582 PyObject *out_orig_verts =
NULL;
1583 PyObject *out_orig_edges =
NULL;
1584 PyObject *out_orig_faces =
NULL;
1585 PyObject *ret_value =
NULL;
1588 if (!PyArg_ParseTuple(
1589 args,
"OOOif:delaunay_2d_cdt", &vert_coords, &edges, &
faces, &output_type, &
epsilon)) {
1594 (
float **)&in_coords, 2, vert_coords, error_prefix);
1595 if (vert_coords_len == -1) {
1600 if (edges_len == -1) {
1605 &in_faces, &in_faces_start_table, &in_faces_len_table,
faces, error_prefix);
1606 if (faces_len == -1) {
1614 in.
edges = in_edges;
1615 in.
faces = in_faces;
1622 ret_value = PyTuple_New(6);
1624 out_vert_coords = PyList_New(res->
verts_len);
1628 Py_DECREF(ret_value);
1629 Py_DECREF(out_vert_coords);
1632 PyList_SET_ITEM(out_vert_coords, i, item);
1634 PyTuple_SET_ITEM(ret_value, 0, out_vert_coords);
1638 item = PyTuple_New(2);
1639 PyTuple_SET_ITEM(item, 0, PyLong_FromLong((
long)res->
edges[i][0]));
1640 PyTuple_SET_ITEM(item, 1, PyLong_FromLong((
long)res->
edges[i][1]));
1641 PyList_SET_ITEM(out_edges, i, item);
1643 PyTuple_SET_ITEM(ret_value, 1, out_edges);
1645 out_faces = list_of_lists_from_arrays(
1647 PyTuple_SET_ITEM(ret_value, 2, out_faces);
1649 out_orig_verts = list_of_lists_from_arrays(
1651 PyTuple_SET_ITEM(ret_value, 3, out_orig_verts);
1653 out_orig_edges = list_of_lists_from_arrays(
1655 PyTuple_SET_ITEM(ret_value, 4, out_orig_edges);
1657 out_orig_faces = list_of_lists_from_arrays(
1659 PyTuple_SET_ITEM(ret_value, 5, out_orig_faces);
1662 if (in_coords !=
NULL) {
1663 PyMem_Free(in_coords);
1665 if (in_edges !=
NULL) {
1666 PyMem_Free(in_edges);
1668 if (in_faces !=
NULL) {
1669 PyMem_Free(in_faces);
1671 if (in_faces_start_table !=
NULL) {
1672 PyMem_Free(in_faces_start_table);
1674 if (in_faces_len_table !=
NULL) {
1675 PyMem_Free(in_faces_len_table);
1685 static PyMethodDef M_Geometry_methods[] = {
1686 {
"intersect_ray_tri",
1689 M_Geometry_intersect_ray_tri_doc},
1690 {
"intersect_point_line",
1693 M_Geometry_intersect_point_line_doc},
1694 {
"intersect_point_tri",
1697 M_Geometry_intersect_point_tri_doc},
1698 {
"closest_point_on_tri",
1701 M_Geometry_closest_point_on_tri_doc},
1702 {
"intersect_point_tri_2d",
1705 M_Geometry_intersect_point_tri_2d_doc},
1706 {
"intersect_point_quad_2d",
1709 M_Geometry_intersect_point_quad_2d_doc},
1710 {
"intersect_line_line",
1713 M_Geometry_intersect_line_line_doc},
1714 {
"intersect_line_line_2d",
1717 M_Geometry_intersect_line_line_2d_doc},
1718 {
"intersect_line_plane",
1721 M_Geometry_intersect_line_plane_doc},
1722 {
"intersect_plane_plane",
1725 M_Geometry_intersect_plane_plane_doc},
1726 {
"intersect_line_sphere",
1729 M_Geometry_intersect_line_sphere_doc},
1730 {
"intersect_line_sphere_2d",
1733 M_Geometry_intersect_line_sphere_2d_doc},
1734 {
"distance_point_to_plane",
1737 M_Geometry_distance_point_to_plane_doc},
1738 {
"intersect_sphere_sphere_2d",
1741 M_Geometry_intersect_sphere_sphere_2d_doc},
1742 {
"intersect_tri_tri_2d",
1745 M_Geometry_intersect_tri_tri_2d_doc},
1747 {
"volume_tetrahedron",
1750 M_Geometry_volume_tetrahedron_doc},
1751 {
"normal", (PyCFunction)
M_Geometry_normal, METH_VARARGS, M_Geometry_normal_doc},
1752 {
"barycentric_transform",
1755 M_Geometry_barycentric_transform_doc},
1756 {
"points_in_planes",
1759 M_Geometry_points_in_planes_doc},
1760 #ifndef MATH_STANDALONE
1761 {
"interpolate_bezier",
1764 M_Geometry_interpolate_bezier_doc},
1765 {
"tessellate_polygon",
1768 M_Geometry_tessellate_polygon_doc},
1770 (PyCFunction)M_Geometry_convex_hull_2d,
1772 M_Geometry_convex_hull_2d_doc},
1774 (PyCFunction)M_Geometry_delaunay_2d_cdt,
1776 M_Geometry_delaunay_2d_cdt_doc},
1777 {
"box_fit_2d", (PyCFunction)M_Geometry_box_fit_2d, METH_O, M_Geometry_box_fit_2d_doc},
1783 static struct PyModuleDef M_Geometry_module_def = {
1784 PyModuleDef_HEAD_INIT,
1785 "mathutils.geometry",
1798 PyObject *submodule = PyModule_Create(&M_Geometry_module_def);
typedef float(TangentPoint)[2]
void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride)
display list (or rather multi purpose list) stuff.
void BKE_displist_free(struct ListBase *lb)
void BKE_displist_fill(const struct ListBase *dispbase, struct ListBase *to, const float normal_proj[3], const bool flip_normal)
void BLI_box_pack_2d(BoxPack *boxarray, const unsigned int len, float *r_tot_x, float *r_tot_y)
float BLI_convexhull_aabb_fit_points_2d(const float(*points)[2], unsigned int n)
int BLI_convexhull_2d(const float(*points)[2], const int n, int r_points[])
CDT_result * BLI_delaunay_2d_cdt_calc(const CDT_input *input, const CDT_output_type output_type)
void BLI_delaunay_2d_cdt_free(CDT_result *result)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE int max_ii(int a, int b)
bool isect_tri_tri_v2(const float p1[2], const float q1[2], const float r1[2], const float p2[2], const float q2[2], const float r2[2])
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
int isect_point_quad_v2(const float p[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2])
int isect_line_line_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float r_i1[3], float r_i2[3])
MINLINE float area_tri_v2(const float v1[2], const float v2[2], const float v3[2])
bool isect_plane_plane_v3(const float plane_a[4], const float plane_b[4], float r_isect_co[3], float r_isect_no[3]) ATTR_WARN_UNUSED_RESULT
void transform_point_by_tri_v3(float pt_tar[3], float const pt_src[3], const float tri_tar_p1[3], const float tri_tar_p2[3], const float tri_tar_p3[3], const float tri_src_p1[3], const float tri_src_p2[3], const float tri_src_p3[3])
bool isect_point_tri_v3(const float p[3], const float v1[3], const float v2[3], const float v3[3], float r_isect_co[3])
float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2])
void closest_on_tri_to_point_v3(float r[3], const float p[3], const float v1[3], const float v2[3], const float v3[3])
float dist_signed_to_plane_v3(const float p[3], const float plane[4])
float area_tri_v3(const float v1[3], const float v2[3], const float v3[3])
int isect_line_sphere_v3(const float l1[3], const float l2[3], const float sp[3], const float r, float r_p1[3], float r_p2[3])
int isect_seg_seg_v2_point(const float v0[2], const float v1[2], const float v2[2], const float v3[2], float vi[2])
int isect_line_sphere_v2(const float l1[2], const float l2[2], const float sp[2], const float r, float r_p1[2], float r_p2[2])
bool isect_planes_v3_fn(const float planes[][4], const int planes_len, const float eps_coplanar, const float eps_isect, void(*callback_fn)(const float co[3], int i, int j, int k, void *user_data), void *user_data)
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3])
float closest_to_line_v3(float r_close[3], const float p[3], const float l1[3], const float l2[3])
bool isect_line_plane_v3(float r_isect_co[3], const float l1[3], const float l2[3], const float plane_co[3], const float plane_no[3]) ATTR_WARN_UNUSED_RESULT
float normal_poly_v3(float n[3], const float verts[][3], unsigned int nr)
int isect_point_tri_v2(const float pt[2], const float v1[2], const float v2[2], const float v3[2])
float volume_tetrahedron_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3])
MINLINE float normalize_v3(float r[3])
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 float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
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])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
#define UNPACK3_EX(pre, a, post)
#define UNPACK4_EX(pre, a, post)
_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 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
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
int mathutils_array_parse_alloc_viseq(int **array, int **start_table, int **len_table, PyObject *value, const char *error_prefix)
int mathutils_array_parse_alloc_vi(int **array, int array_dim, PyObject *value, const char *error_prefix)
int mathutils_array_parse_alloc_v(float **array, int array_dim, PyObject *value, const char *error_prefix)
int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix)
PyObject * Vector_CreatePyObject(const float *vec, const int size, PyTypeObject *base_type)
static PyObject * M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject *args)
PyDoc_STRVAR(M_Geometry_doc, "The Blender geometry module")
static PyObject * M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_closest_point_on_tri(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_volume_tetrahedron(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_normal(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_intersect_sphere_sphere_2d(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_distance_point_to_plane(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_intersect_plane_plane(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_intersect_point_tri(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObject *args)
static int boxPack_FromPyObject(PyObject *value, BoxPack **r_boxarray)
static PyObject * M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObject *args)
static void points_in_planes_fn(const float co[3], int i, int j, int k, void *user_data_p)
static PyObject * M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlist)
static PyObject * M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject *args)
static void boxPack_ToPyObject(PyObject *value, const BoxPack *boxarray)
static PyObject * M_Geometry_intersect_tri_tri_2d(PyObject *UNUSED(self), PyObject *args)
static PyObject * M_Geometry_tessellate_polygon(PyObject *UNUSED(self), PyObject *polyLineSeq)
static PyObject * M_Geometry_area_tri(PyObject *UNUSED(self), PyObject *args)
PyMODINIT_FUNC PyInit_mathutils_geometry(void)
int PyC_ParseBool(PyObject *o, void *p)
#define PyC_Tuple_Pack_I32(...)
#define PyTuple_SET_ITEMS(op_arg,...)
int * verts_orig_len_table
int * edges_orig_len_table
int * verts_orig_start_table
int * faces_orig_start_table
int * edges_orig_start_table
int * faces_orig_len_table