13 #ifndef MATH_STANDALONE
26 #include "../generic/py_capi_utils.h"
27 #include "../generic/python_utildefines.h"
35 ".. function:: intersect_ray_tri(v1, v2, v3, ray, orig, clip=True)\n"
37 " Returns the intersection between a ray and a triangle, if possible, returns None "
41 " :type v1: :class:`mathutils.Vector`\n"
43 " :type v2: :class:`mathutils.Vector`\n"
45 " :type v3: :class:`mathutils.Vector`\n"
46 " :arg ray: Direction of the projection\n"
47 " :type ray: :class:`mathutils.Vector`\n"
48 " :arg orig: Origin\n"
49 " :type orig: :class:`mathutils.Vector`\n"
50 " :arg clip: When False, don't restrict the intersection to the area of the "
51 "triangle, use the infinite plane defined by the triangle.\n"
52 " :type clip: boolean\n"
53 " :return: The point of intersection or None if no intersection is found\n"
54 " :rtype: :class:`mathutils.Vector` or None\n");
57 const char *error_prefix =
"intersect_ray_tri";
58 PyObject *py_ray, *py_ray_off, *py_tri[3];
59 float dir[3], orig[3], tri[3][3], e1[3], e2[3], pvec[3], tvec[3], qvec[3];
60 float det, inv_det, u,
v,
t;
64 if (!PyArg_ParseTuple(args,
65 "OOOOO|O&:intersect_ray_tri",
100 if (det > -0.000001f && det < 0.000001f) {
104 inv_det = 1.0f / det;
111 if (clip && (u < 0.0f || u > 1.0f)) {
121 if (clip && (v < 0.0f || u + v > 1.0f)) {
142 ".. function:: intersect_line_line(v1, v2, v3, v4)\n"
144 " Returns a tuple with the points on each line respectively closest to the other.\n"
146 " :arg v1: First point of the first line\n"
147 " :type v1: :class:`mathutils.Vector`\n"
148 " :arg v2: Second point of the first line\n"
149 " :type v2: :class:`mathutils.Vector`\n"
150 " :arg v3: First point of the second line\n"
151 " :type v3: :class:`mathutils.Vector`\n"
152 " :arg v4: Second point of the second line\n"
153 " :type v4: :class:`mathutils.Vector`\n"
154 " :rtype: tuple of :class:`mathutils.Vector`'s\n");
157 const char *error_prefix =
"intersect_line_line";
159 PyObject *py_lines[4];
160 float lines[4][3],
i1[3], i2[3];
164 if (!PyArg_ParseTuple(args,
"OOOO:intersect_line_line",
UNPACK4_EX(&, py_lines, ))) {
174 error_prefix) != -1) &&
179 error_prefix) != -1) &&
184 error_prefix) != -1)) == 0) {
189 if (ix_vec_num == 2) {
207 tuple = PyTuple_New(2);
217 M_Geometry_intersect_sphere_sphere_2d_doc,
218 ".. function:: intersect_sphere_sphere_2d(p_a, radius_a, p_b, radius_b)\n"
220 " Returns 2 points on between intersecting circles.\n"
222 " :arg p_a: Center of the first circle\n"
223 " :type p_a: :class:`mathutils.Vector`\n"
224 " :arg radius_a: Radius of the first circle\n"
225 " :type radius_a: float\n"
226 " :arg p_b: Center of the second circle\n"
227 " :type p_b: :class:`mathutils.Vector`\n"
228 " :arg radius_b: Radius of the second circle\n"
229 " :type radius_b: float\n"
230 " :rtype: tuple of :class:`mathutils.Vector`'s or None when there is no intersection\n");
233 const char *error_prefix =
"intersect_sphere_sphere_2d";
235 PyObject *py_v_a, *py_v_b;
236 float v_a[2], v_b[2];
241 if (!PyArg_ParseTuple(
242 args,
"OfOf:intersect_sphere_sphere_2d", &py_v_a, &rad_a, &py_v_b, &rad_b)) {
251 ret = PyTuple_New(2);
257 (dist > rad_a + rad_b) ||
259 (dist <
fabsf(rad_a - rad_b)) ||
261 (dist < FLT_EPSILON)) {
266 const float dist_delta = ((rad_a * rad_a) - (rad_b * rad_b) + (dist * dist)) / (2.0f * dist);
267 const float h =
powf(
fabsf((rad_a * rad_a) - (dist_delta * dist_delta)), 0.5f);
271 i_cent[0] = v_a[0] + ((v_ab[0] * dist_delta) / dist);
272 i_cent[1] = v_a[1] + ((v_ab[1] * dist_delta) / dist);
274 i1[0] = i_cent[0] + h * v_ab[1] / dist;
275 i1[1] = i_cent[1] - h * v_ab[0] / dist;
277 i2[0] = i_cent[0] - h * v_ab[1] / dist;
278 i2[1] = i_cent[1] + h * v_ab[0] / dist;
287 ".. function:: intersect_tri_tri_2d(tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n"
289 " Check if two 2D triangles intersect.\n"
294 const char *error_prefix =
"intersect_tri_tri_2d";
295 PyObject *tri_pair_py[2][3];
296 float tri_pair[2][3][2];
298 if (!PyArg_ParseTuple(args,
299 "OOOOOO:intersect_tri_tri_2d",
305 &tri_pair_py[1][2])) {
309 for (
int i = 0; i < 2; i++) {
310 for (
int j = 0; j < 3; j++) {
312 tri_pair[i][j], 2, 2 |
MU_ARRAY_SPILL, tri_pair_py[i][j], error_prefix) == -1) {
319 return PyBool_FromLong(
ret);
323 ".. function:: normal(vectors)\n"
325 " Returns the normal of a 3D polygon.\n"
327 " :arg vectors: Vectors to calculate normals with\n"
328 " :type vectors: sequence of 3 or more 3d vector\n"
329 " :rtype: :class:`mathutils.Vector`\n");
338 if (PyTuple_GET_SIZE(args) == 1) {
339 args = PyTuple_GET_ITEM(args, 0);
347 if (coords_len < 3) {
348 PyErr_SetString(PyExc_ValueError,
"Expected 3 or more vectors");
363 ".. function:: area_tri(v1, v2, v3)\n"
365 " Returns the area size of the 2D or 3D triangle defined.\n"
368 " :type v1: :class:`mathutils.Vector`\n"
370 " :type v2: :class:`mathutils.Vector`\n"
372 " :type v3: :class:`mathutils.Vector`\n"
376 const char *error_prefix =
"area_tri";
381 if (!PyArg_ParseTuple(args,
"OOO:area_tri",
UNPACK3_EX(&, py_tri, ))) {
395 ".. function:: volume_tetrahedron(v1, v2, v3, v4)\n"
397 " Return the volume formed by a tetrahedron (points can be in any order).\n"
400 " :type v1: :class:`mathutils.Vector`\n"
402 " :type v2: :class:`mathutils.Vector`\n"
404 " :type v3: :class:`mathutils.Vector`\n"
406 " :type v4: :class:`mathutils.Vector`\n"
410 const char *error_prefix =
"volume_tetrahedron";
415 if (!PyArg_ParseTuple(args,
"OOOO:volume_tetrahedron",
UNPACK4_EX(&, py_tet, ))) {
429 M_Geometry_intersect_line_line_2d_doc,
430 ".. function:: intersect_line_line_2d(lineA_p1, lineA_p2, lineB_p1, lineB_p2)\n"
432 " Takes 2 segments (defined by 4 vectors) and returns a vector for their point of "
433 "intersection or None.\n"
435 " .. warning:: Despite its name, this function works on segments, and not on lines.\n"
437 " :arg lineA_p1: First point of the first line\n"
438 " :type lineA_p1: :class:`mathutils.Vector`\n"
439 " :arg lineA_p2: Second point of the first line\n"
440 " :type lineA_p2: :class:`mathutils.Vector`\n"
441 " :arg lineB_p1: First point of the second line\n"
442 " :type lineB_p1: :class:`mathutils.Vector`\n"
443 " :arg lineB_p2: Second point of the second line\n"
444 " :type lineB_p2: :class:`mathutils.Vector`\n"
445 " :return: The point of intersection or None when not found\n"
446 " :rtype: :class:`mathutils.Vector` or None\n");
449 const char *error_prefix =
"intersect_line_line_2d";
450 PyObject *py_lines[4];
455 if (!PyArg_ParseTuple(args,
"OOOO:intersect_line_line_2d",
UNPACK4_EX(&, py_lines, ))) {
473 M_Geometry_intersect_line_plane_doc,
474 ".. function:: intersect_line_plane(line_a, line_b, plane_co, plane_no, no_flip=False)\n"
476 " Calculate the intersection between a line (as 2 vectors) and a plane.\n"
477 " Returns a vector for the intersection or None.\n"
479 " :arg line_a: First point of the first line\n"
480 " :type line_a: :class:`mathutils.Vector`\n"
481 " :arg line_b: Second point of the first line\n"
482 " :type line_b: :class:`mathutils.Vector`\n"
483 " :arg plane_co: A point on the plane\n"
484 " :type plane_co: :class:`mathutils.Vector`\n"
485 " :arg plane_no: The direction the plane is facing\n"
486 " :type plane_no: :class:`mathutils.Vector`\n"
487 " :return: The point of intersection or None when not found\n"
488 " :rtype: :class:`mathutils.Vector` or None\n");
491 const char *error_prefix =
"intersect_line_plane";
492 PyObject *py_line_a, *py_line_b, *py_plane_co, *py_plane_no;
493 float line_a[3], line_b[3], plane_co[3], plane_no[3];
495 const bool no_flip =
false;
497 if (!PyArg_ParseTuple(args,
498 "OOOO|O&:intersect_line_plane",
525 M_Geometry_intersect_plane_plane_doc,
526 ".. function:: intersect_plane_plane(plane_a_co, plane_a_no, plane_b_co, plane_b_no)\n"
528 " Return the intersection between two planes\n"
530 " :arg plane_a_co: Point on the first plane\n"
531 " :type plane_a_co: :class:`mathutils.Vector`\n"
532 " :arg plane_a_no: Normal of the first plane\n"
533 " :type plane_a_no: :class:`mathutils.Vector`\n"
534 " :arg plane_b_co: Point on the second plane\n"
535 " :type plane_b_co: :class:`mathutils.Vector`\n"
536 " :arg plane_b_no: Normal of the second plane\n"
537 " :type plane_b_no: :class:`mathutils.Vector`\n"
538 " :return: The line of the intersection represented as a point and a vector\n"
539 " :rtype: tuple pair of :class:`mathutils.Vector` or None if the intersection can't be "
543 const char *error_prefix =
"intersect_plane_plane";
544 PyObject *
ret, *ret_co, *ret_no;
545 PyObject *py_plane_a_co, *py_plane_a_no, *py_plane_b_co, *py_plane_b_no;
546 float plane_a_co[3], plane_a_no[3], plane_b_co[3], plane_b_no[3];
547 float plane_a[4], plane_b[4];
552 if (!PyArg_ParseTuple(args,
553 "OOOO:intersect_plane_plane",
582 ret_co = Py_INCREF_RET(Py_None);
583 ret_no = Py_INCREF_RET(Py_None);
586 ret = PyTuple_New(2);
592 M_Geometry_intersect_line_sphere_doc,
593 ".. function:: intersect_line_sphere(line_a, line_b, sphere_co, sphere_radius, clip=True)\n"
595 " Takes a line (as 2 points) and a sphere (as a point and a radius) and\n"
596 " returns the intersection\n"
598 " :arg line_a: First point of the line\n"
599 " :type line_a: :class:`mathutils.Vector`\n"
600 " :arg line_b: Second point of the line\n"
601 " :type line_b: :class:`mathutils.Vector`\n"
602 " :arg sphere_co: The center of the sphere\n"
603 " :type sphere_co: :class:`mathutils.Vector`\n"
604 " :arg sphere_radius: Radius of the sphere\n"
605 " :type sphere_radius: sphere_radius\n"
606 " :return: The intersection points as a pair of vectors or None when there is no "
608 " :rtype: A tuple pair containing :class:`mathutils.Vector` or None\n");
611 const char *error_prefix =
"intersect_line_sphere";
612 PyObject *py_line_a, *py_line_b, *py_sphere_co;
613 float line_a[3], line_b[3], sphere_co[3];
620 if (!PyArg_ParseTuple(args,
621 "OOOf|O&:intersect_line_sphere",
642 PyObject *
ret = PyTuple_New(2);
647 (lambda <= 1.0f)))) {
654 (lambda <= 1.0f)))) {
658 (lambda <= 1.0f)))) {
677 M_Geometry_intersect_line_sphere_2d_doc,
678 ".. function:: intersect_line_sphere_2d(line_a, line_b, sphere_co, sphere_radius, clip=True)\n"
680 " Takes a line (as 2 points) and a sphere (as a point and a radius) and\n"
681 " returns the intersection\n"
683 " :arg line_a: First point of the line\n"
684 " :type line_a: :class:`mathutils.Vector`\n"
685 " :arg line_b: Second point of the line\n"
686 " :type line_b: :class:`mathutils.Vector`\n"
687 " :arg sphere_co: The center of the sphere\n"
688 " :type sphere_co: :class:`mathutils.Vector`\n"
689 " :arg sphere_radius: Radius of the sphere\n"
690 " :type sphere_radius: sphere_radius\n"
691 " :return: The intersection points as a pair of vectors or None when there is no "
693 " :rtype: A tuple pair containing :class:`mathutils.Vector` or None\n");
696 const char *error_prefix =
"intersect_line_sphere_2d";
697 PyObject *py_line_a, *py_line_b, *py_sphere_co;
698 float line_a[2], line_b[2], sphere_co[2];
705 if (!PyArg_ParseTuple(args,
706 "OOOf|O&:intersect_line_sphere_2d",
727 PyObject *
ret = PyTuple_New(2);
732 (lambda <= 1.0f)))) {
739 (lambda <= 1.0f)))) {
743 (lambda <= 1.0f)))) {
761 M_Geometry_intersect_point_line_doc,
762 ".. function:: intersect_point_line(pt, line_p1, line_p2)\n"
764 " Takes a point and a line and returns a tuple with the closest point on the line and its "
765 "distance from the first point of the line as a percentage of the length of the line.\n"
768 " :type pt: :class:`mathutils.Vector`\n"
769 " :arg line_p1: First point of the line\n"
770 " :type line_p1: :class:`mathutils.Vector`\n"
771 " :arg line_p1: Second point of the line\n"
772 " :type line_p1: :class:`mathutils.Vector`\n"
773 " :rtype: (:class:`mathutils.Vector`, float)\n");
776 const char *error_prefix =
"intersect_point_line";
777 PyObject *py_pt, *py_line_a, *py_line_b;
778 float pt[3], pt_out[3], line_a[3], line_b[3];
783 if (!PyArg_ParseTuple(args,
"OOO:intersect_point_line", &py_pt, &py_line_a, &py_line_b)) {
800 ret = PyTuple_New(2);
806 ".. function:: intersect_point_tri(pt, tri_p1, tri_p2, tri_p3)\n"
808 " Takes 4 vectors: one is the point and the next 3 define the triangle. Projects "
809 "the point onto the triangle plane and checks if it is within the triangle.\n"
812 " :type pt: :class:`mathutils.Vector`\n"
813 " :arg tri_p1: First point of the triangle\n"
814 " :type tri_p1: :class:`mathutils.Vector`\n"
815 " :arg tri_p2: Second point of the triangle\n"
816 " :type tri_p2: :class:`mathutils.Vector`\n"
817 " :arg tri_p3: Third point of the triangle\n"
818 " :type tri_p3: :class:`mathutils.Vector`\n"
819 " :return: Point on the triangles plane or None if its outside the triangle\n"
820 " :rtype: :class:`mathutils.Vector` or None\n");
823 const char *error_prefix =
"intersect_point_tri";
824 PyObject *py_pt, *py_tri[3];
825 float pt[3], tri[3][3];
829 if (!PyArg_ParseTuple(args,
"OOOO:intersect_point_tri", &py_pt,
UNPACK3_EX(&, py_tri, ))) {
852 ".. function:: closest_point_on_tri(pt, tri_p1, tri_p2, tri_p3)\n"
854 " Takes 4 vectors: one is the point and the next 3 define the triangle.\n"
857 " :type pt: :class:`mathutils.Vector`\n"
858 " :arg tri_p1: First point of the triangle\n"
859 " :type tri_p1: :class:`mathutils.Vector`\n"
860 " :arg tri_p2: Second point of the triangle\n"
861 " :type tri_p2: :class:`mathutils.Vector`\n"
862 " :arg tri_p3: Third point of the triangle\n"
863 " :type tri_p3: :class:`mathutils.Vector`\n"
864 " :return: The closest point of the triangle.\n"
865 " :rtype: :class:`mathutils.Vector`\n");
868 const char *error_prefix =
"closest_point_on_tri";
869 PyObject *py_pt, *py_tri[3];
870 float pt[3], tri[3][3];
874 if (!PyArg_ParseTuple(args,
"OOOO:closest_point_on_tri", &py_pt,
UNPACK3_EX(&, py_tri, ))) {
895 M_Geometry_intersect_point_tri_2d_doc,
896 ".. function:: intersect_point_tri_2d(pt, tri_p1, tri_p2, tri_p3)\n"
898 " Takes 4 vectors (using only the x and y coordinates): one is the point and the next 3 "
899 "define the triangle. Returns 1 if the point is within the triangle, otherwise 0.\n"
902 " :type pt: :class:`mathutils.Vector`\n"
903 " :arg tri_p1: First point of the triangle\n"
904 " :type tri_p1: :class:`mathutils.Vector`\n"
905 " :arg tri_p2: Second point of the triangle\n"
906 " :type tri_p2: :class:`mathutils.Vector`\n"
907 " :arg tri_p3: Third point of the triangle\n"
908 " :type tri_p3: :class:`mathutils.Vector`\n"
912 const char *error_prefix =
"intersect_point_tri_2d";
913 PyObject *py_pt, *py_tri[3];
914 float pt[2], tri[3][2];
917 if (!PyArg_ParseTuple(args,
"OOOO:intersect_point_tri_2d", &py_pt,
UNPACK3_EX(&, py_tri, ))) {
934 ".. function:: intersect_point_quad_2d(pt, quad_p1, quad_p2, quad_p3, quad_p4)\n"
936 " Takes 5 vectors (using only the x and y coordinates): one is the point and the "
937 "next 4 define the quad,\n"
938 " only the x and y are used from the vectors. Returns 1 if the point is within the "
939 "quad, otherwise 0.\n"
940 " Works only with convex quads without singular edges.\n"
943 " :type pt: :class:`mathutils.Vector`\n"
944 " :arg quad_p1: First point of the quad\n"
945 " :type quad_p1: :class:`mathutils.Vector`\n"
946 " :arg quad_p2: Second point of the quad\n"
947 " :type quad_p2: :class:`mathutils.Vector`\n"
948 " :arg quad_p3: Third point of the quad\n"
949 " :type quad_p3: :class:`mathutils.Vector`\n"
950 " :arg quad_p4: Fourth point of the quad\n"
951 " :type quad_p4: :class:`mathutils.Vector`\n"
955 const char *error_prefix =
"intersect_point_quad_2d";
956 PyObject *py_pt, *py_quad[4];
957 float pt[2],
quad[4][2];
960 if (!PyArg_ParseTuple(args,
"OOOOO:intersect_point_quad_2d", &py_pt,
UNPACK4_EX(&, py_quad, ))) {
977 ".. function:: distance_point_to_plane(pt, plane_co, plane_no)\n"
979 " Returns the signed distance between a point and a plane "
980 " (negative when below the normal).\n"
983 " :type pt: :class:`mathutils.Vector`\n"
984 " :arg plane_co: A point on the plane\n"
985 " :type plane_co: :class:`mathutils.Vector`\n"
986 " :arg plane_no: The direction the plane is facing\n"
987 " :type plane_no: :class:`mathutils.Vector`\n"
991 const char *error_prefix =
"distance_point_to_plane";
992 PyObject *py_pt, *py_plane_co, *py_plane_no;
993 float pt[3], plane_co[3], plane_no[3];
996 if (!PyArg_ParseTuple(args,
"OOO:distance_point_to_plane", &py_pt, &py_plane_co, &py_plane_no)) {
1012 M_Geometry_barycentric_transform_doc,
1013 ".. function:: barycentric_transform(point, tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n"
1015 " Return a transformed point, the transformation is defined by 2 triangles.\n"
1017 " :arg point: The point to transform.\n"
1018 " :type point: :class:`mathutils.Vector`\n"
1019 " :arg tri_a1: source triangle vertex.\n"
1020 " :type tri_a1: :class:`mathutils.Vector`\n"
1021 " :arg tri_a2: source triangle vertex.\n"
1022 " :type tri_a2: :class:`mathutils.Vector`\n"
1023 " :arg tri_a3: source triangle vertex.\n"
1024 " :type tri_a3: :class:`mathutils.Vector`\n"
1025 " :arg tri_b1: target triangle vertex.\n"
1026 " :type tri_b1: :class:`mathutils.Vector`\n"
1027 " :arg tri_b2: target triangle vertex.\n"
1028 " :type tri_b2: :class:`mathutils.Vector`\n"
1029 " :arg tri_b3: target triangle vertex.\n"
1030 " :type tri_b3: :class:`mathutils.Vector`\n"
1031 " :return: The transformed point\n"
1032 " :rtype: :class:`mathutils.Vector`'s\n");
1035 const char *error_prefix =
"barycentric_transform";
1036 PyObject *py_pt_src, *py_tri_src[3], *py_tri_dst[3];
1037 float pt_src[3], pt_dst[3], tri_src[3][3], tri_dst[3][3];
1040 if (!PyArg_ParseTuple(args,
1041 "OOOOOOO:barycentric_transform",
1080 ".. function:: points_in_planes(planes)\n"
1082 " Returns a list of points inside all planes given and a list of index values for "
1083 "the planes used.\n"
1085 " :arg planes: List of planes (4D vectors).\n"
1086 " :type planes: list of :class:`mathutils.Vector`\n"
1087 " :return: two lists, once containing the vertices inside the planes, another "
1088 "containing the plane indices used\n"
1089 " :rtype: pair of lists\n");
1092 PyObject *py_planes;
1096 if (!PyArg_ParseTuple(args,
"O:points_in_planes", &py_planes)) {
1101 (
float **)&planes, 4, py_planes,
"points_in_planes")) == -1) {
1108 .py_verts = PyList_New(0),
1109 .planes_used = PyMem_Malloc(
sizeof(
char) * planes_len),
1113 PyObject *py_plane_index = PyList_New(0);
1115 memset(
user_data.planes_used, 0,
sizeof(
char) * planes_len);
1117 const float eps_coplanar = 1e-4f;
1118 const float eps_isect = 1e-6f;
1126 for (
int i = 0; i < planes_len; i++) {
1128 PyList_APPEND(py_plane_index, PyLong_FromLong(i));
1135 PyObject *
ret = PyTuple_New(2);
1141 #ifndef MATH_STANDALONE
1144 ".. function:: interpolate_bezier(knot1, handle1, handle2, knot2, resolution)\n"
1146 " Interpolate a bezier spline segment.\n"
1148 " :arg knot1: First bezier spline point.\n"
1149 " :type knot1: :class:`mathutils.Vector`\n"
1150 " :arg handle1: First bezier spline handle.\n"
1151 " :type handle1: :class:`mathutils.Vector`\n"
1152 " :arg handle2: Second bezier spline handle.\n"
1153 " :type handle2: :class:`mathutils.Vector`\n"
1154 " :arg knot2: Second bezier spline point.\n"
1155 " :type knot2: :class:`mathutils.Vector`\n"
1156 " :arg resolution: Number of points to return.\n"
1157 " :type resolution: int\n"
1158 " :return: The interpolated points\n"
1159 " :rtype: list of :class:`mathutils.Vector`'s\n");
1162 const char *error_prefix =
"interpolate_bezier";
1163 PyObject *py_data[4];
1164 float data[4][4] = {{0.0f}};
1168 float *coord_array, *fp;
1171 if (!PyArg_ParseTuple(args,
"OOOOi:interpolate_bezier",
UNPACK4_EX(&, py_data, ), &resolu)) {
1175 for (i = 0; i < 4; i++) {
1181 dims =
max_ii(dims, dims_tmp);
1185 PyErr_SetString(PyExc_ValueError,
"resolution must be 2 or over");
1189 coord_array =
MEM_callocN(dims * (resolu) *
sizeof(
float), error_prefix);
1190 for (i = 0; i < dims; i++) {
1192 UNPACK4_EX(,
data, [i]), coord_array + i, resolu - 1,
sizeof(
float) * dims);
1195 list = PyList_New(resolu);
1197 for (i = 0; i < resolu; i++, fp = fp + dims) {
1205 ".. function:: tessellate_polygon(veclist_list)\n"
1207 " Takes a list of polylines (each point a pair or triplet of numbers) and returns "
1208 "the point indices for a polyline filled with triangles. Does not handle degenerate "
1209 "geometry (such as zero-length lines due to consecutive identical points).\n"
1211 " :arg veclist_list: list of polylines\n"
1217 PyObject *polyLine, *polyVec;
1218 int i, len_polylines, len_polypoints;
1219 bool list_parse_error =
false;
1228 if (!PySequence_Check(polyLineSeq)) {
1229 PyErr_SetString(PyExc_TypeError,
"expected a sequence of poly lines");
1233 len_polylines = PySequence_Size(polyLineSeq);
1235 for (i = 0; i < len_polylines; i++) {
1236 polyLine = PySequence_GetItem(polyLineSeq, i);
1237 if (!PySequence_Check(polyLine)) {
1239 Py_XDECREF(polyLine);
1240 PyErr_SetString(PyExc_TypeError,
1241 "One or more of the polylines is not a sequence of mathutils.Vector's");
1245 len_polypoints = PySequence_Size(polyLine);
1246 if (len_polypoints > 0) {
1250 dl->
nr = len_polypoints;
1254 dl->
verts = fp =
MEM_mallocN(
sizeof(
float[3]) * len_polypoints,
"dl verts");
1257 for (
int index = 0; index < len_polypoints; index++, fp += 3) {
1258 polyVec = PySequence_GetItem(polyLine, index);
1260 fp, 2, 3 |
MU_ARRAY_SPILL, polyVec,
"tessellate_polygon: parse coord");
1264 list_parse_error =
true;
1266 else if (polyVec_len == 2) {
1269 else if (polyVec_len == 3) {
1276 Py_DECREF(polyLine);
1279 if (list_parse_error) {
1289 dl = dispbase.
first;
1291 tri_list = PyList_New(dl->
parts);
1294 PyErr_SetString(PyExc_RuntimeError,
"failed to make a new list");
1298 int *dl_face = dl->
index;
1299 for (
int index = 0; index < dl->
parts; index++) {
1300 PyList_SET_ITEM(tri_list, index,
PyC_Tuple_Pack_I32(dl_face[0], dl_face[1], dl_face[2]));
1308 tri_list = PyList_New(0);
1317 PyObject *list_item, *item_1, *item_2;
1321 if (!PyList_Check(value)) {
1322 PyErr_SetString(PyExc_TypeError,
"can only back a list of [x, y, w, h]");
1326 len = PyList_GET_SIZE(value);
1330 for (i = 0; i <
len; i++) {
1331 list_item = PyList_GET_ITEM(value, i);
1332 if (!PyList_Check(list_item) || PyList_GET_SIZE(list_item) < 4) {
1334 PyErr_SetString(PyExc_TypeError,
"can only pack a list of [x, y, w, h]");
1340 item_1 = PyList_GET_ITEM(list_item, 2);
1341 item_2 = PyList_GET_ITEM(list_item, 3);
1343 box->
w = (
float)PyFloat_AsDouble(item_1);
1344 box->
h = (
float)PyFloat_AsDouble(item_2);
1348 if (box->
w < 0.0f || box->
h < 0.0f) {
1350 PyErr_SetString(PyExc_TypeError,
1351 "error parsing width and height values from list: "
1352 "[x, y, w, h], not numbers or below zero");
1359 *r_boxarray = boxarray;
1366 PyObject *list_item;
1368 len = PyList_GET_SIZE(value);
1370 for (i = 0; i <
len; i++) {
1371 const BoxPack *box = &boxarray[i];
1372 list_item = PyList_GET_ITEM(value, box->
index);
1373 PyList_SET_ITEM(list_item, 0, PyFloat_FromDouble(box->
x));
1374 PyList_SET_ITEM(list_item, 1, PyFloat_FromDouble(box->
y));
1379 ".. function:: box_pack_2d(boxes)\n"
1381 " Returns a tuple with the width and height of the packed bounding box.\n"
1383 " :arg boxes: list of boxes, each box is a list where the first 4 items are [x, y, "
1384 "width, height, ...] other items are ignored.\n"
1385 " :type boxes: list\n"
1386 " :return: the width and height of the packed bounding box\n"
1387 " :rtype: tuple, pair of floats\n");
1390 float tot_width = 0.0f, tot_height = 0.0f;
1395 if (!PyList_Check(boxlist)) {
1396 PyErr_SetString(PyExc_TypeError,
"expected a list of boxes [[x, y, w, h], ... ]");
1400 len = PyList_GET_SIZE(boxlist);
1414 ret = PyTuple_New(2);
1420 ".. function:: box_fit_2d(points)\n"
1422 " Returns an angle that best fits the points to an axis aligned rectangle\n"
1424 " :arg points: list of 2d points.\n"
1425 " :type points: list\n"
1427 " :rtype: float\n");
1428 static PyObject *M_Geometry_box_fit_2d(PyObject *
UNUSED(
self), PyObject *pointlist)
1447 return PyFloat_FromDouble(
angle);
1451 ".. function:: convex_hull_2d(points)\n"
1453 " Returns a list of indices into the list given\n"
1455 " :arg points: list of 2d points.\n"
1456 " :type points: list\n"
1457 " :return: a list of indices\n"
1458 " :rtype: list of ints\n");
1459 static PyObject *M_Geometry_convex_hull_2d(PyObject *
UNUSED(
self), PyObject *pointlist)
1473 Py_ssize_t len_ret, i;
1480 ret = PyList_New(len_ret);
1481 for (i = 0; i < len_ret; i++) {
1482 PyList_SET_ITEM(
ret, i, PyLong_FromLong(index_map[i]));
1490 ret = PyList_New(0);
1500 static PyObject *list_of_lists_from_arrays(
const int *
array,
1501 const int *start_table,
1502 const int *len_table,
1505 PyObject *
ret, *sublist;
1506 int i, j, sublist_len, sublist_start, val;
1509 return PyList_New(0);
1511 ret = PyList_New(toplevel_len);
1512 for (i = 0; i < toplevel_len; i++) {
1513 sublist_len = len_table[i];
1514 sublist = PyList_New(sublist_len);
1515 sublist_start = start_table[i];
1516 for (j = 0; j < sublist_len; j++) {
1517 val =
array[sublist_start + j];
1518 PyList_SET_ITEM(sublist, j, PyLong_FromLong(val));
1520 PyList_SET_ITEM(
ret, i, sublist);
1526 M_Geometry_delaunay_2d_cdt_doc,
1527 ".. function:: delaunay_2d_cdt(vert_coords, edges, faces, output_type, epsilon, "
1530 " Computes the Constrained Delaunay Triangulation of a set of vertices,\n"
1531 " with edges and faces that must appear in the triangulation.\n"
1532 " Some triangles may be eaten away, or combined with other triangles,\n"
1533 " according to output type.\n"
1534 " The returned verts may be in a different order from input verts, may be moved\n"
1535 " slightly, and may be merged with other nearby verts.\n"
1536 " The three returned orig lists give, for each of verts, edges, and faces, the list of\n"
1537 " input element indices corresponding to the positionally same output element.\n"
1538 " For edges, the orig indices start with the input edges and then continue\n"
1539 " with the edges implied by each of the faces (n of them for an n-gon).\n"
1540 " If the need_ids argument is supplied, and False, then the code skips the preparation\n"
1541 " of the orig arrays, which may save some time."
1543 " :arg vert_coords: Vertex coordinates (2d)\n"
1544 " :type vert_coords: list of :class:`mathutils.Vector`\n"
1545 " :arg edges: Edges, as pairs of indices in `vert_coords`\n"
1546 " :type edges: list of (int, int)\n"
1547 " :arg faces: Faces, each sublist is a face, as indices in `vert_coords` (CCW oriented)\n"
1548 " :type faces: list of list of int\n"
1549 " :arg output_type: What output looks like. 0 => triangles with convex hull. "
1550 "1 => triangles inside constraints. "
1551 "2 => the input constraints, intersected. "
1552 "3 => like 2 but detect holes and omit them from output. "
1553 "4 => like 2 but with extra edges to make valid BMesh faces. "
1554 "5 => like 4 but detect holes and omit them from output.\n"
1555 " :type output_type: int\\n"
1556 " :arg epsilon: For nearness tests; should not be zero\n"
1557 " :type epsilon: float\n"
1558 " :arg need_ids: are the orig output arrays needed?\n"
1559 " :type need_args: bool\n"
1560 " :return: Output tuple, (vert_coords, edges, faces, orig_verts, orig_edges, orig_faces)\n"
1561 " :rtype: (list of `mathutils.Vector`, "
1562 "list of (int, int), "
1563 "list of list of int, "
1564 "list of list of int, "
1565 "list of list of int, "
1566 "list of list of int)\n"
1568 static PyObject *M_Geometry_delaunay_2d_cdt(PyObject *
UNUSED(
self), PyObject *args)
1570 const char *error_prefix =
"delaunay_2d_cdt";
1571 PyObject *vert_coords, *edges, *
faces, *item;
1574 bool need_ids =
true;
1576 int(*in_edges)[2] =
NULL;
1577 int *in_faces =
NULL;
1578 int *in_faces_start_table =
NULL;
1579 int *in_faces_len_table =
NULL;
1580 Py_ssize_t vert_coords_len, edges_len, faces_len;
1583 PyObject *out_vert_coords =
NULL;
1584 PyObject *out_edges =
NULL;
1585 PyObject *out_faces =
NULL;
1586 PyObject *out_orig_verts =
NULL;
1587 PyObject *out_orig_edges =
NULL;
1588 PyObject *out_orig_faces =
NULL;
1589 PyObject *ret_value =
NULL;
1592 if (!PyArg_ParseTuple(args,
1593 "OOOif|p:delaunay_2d_cdt",
1604 (
float **)&in_coords, 2, vert_coords, error_prefix);
1605 if (vert_coords_len == -1) {
1610 if (edges_len == -1) {
1615 &in_faces, &in_faces_start_table, &in_faces_len_table,
faces, error_prefix);
1616 if (faces_len == -1) {
1624 in.
edges = in_edges;
1625 in.
faces = in_faces;
1633 ret_value = PyTuple_New(6);
1635 out_vert_coords = PyList_New(res->
verts_len);
1639 Py_DECREF(ret_value);
1640 Py_DECREF(out_vert_coords);
1643 PyList_SET_ITEM(out_vert_coords, i, item);
1645 PyTuple_SET_ITEM(ret_value, 0, out_vert_coords);
1649 item = PyTuple_New(2);
1650 PyTuple_SET_ITEM(item, 0, PyLong_FromLong((
long)res->
edges[i][0]));
1651 PyTuple_SET_ITEM(item, 1, PyLong_FromLong((
long)res->
edges[i][1]));
1652 PyList_SET_ITEM(out_edges, i, item);
1654 PyTuple_SET_ITEM(ret_value, 1, out_edges);
1656 out_faces = list_of_lists_from_arrays(
1658 PyTuple_SET_ITEM(ret_value, 2, out_faces);
1660 out_orig_verts = list_of_lists_from_arrays(
1662 PyTuple_SET_ITEM(ret_value, 3, out_orig_verts);
1664 out_orig_edges = list_of_lists_from_arrays(
1666 PyTuple_SET_ITEM(ret_value, 4, out_orig_edges);
1668 out_orig_faces = list_of_lists_from_arrays(
1670 PyTuple_SET_ITEM(ret_value, 5, out_orig_faces);
1673 if (in_coords !=
NULL) {
1674 PyMem_Free(in_coords);
1676 if (in_edges !=
NULL) {
1677 PyMem_Free(in_edges);
1679 if (in_faces !=
NULL) {
1680 PyMem_Free(in_faces);
1682 if (in_faces_start_table !=
NULL) {
1683 PyMem_Free(in_faces_start_table);
1685 if (in_faces_len_table !=
NULL) {
1686 PyMem_Free(in_faces_len_table);
1696 static PyMethodDef M_Geometry_methods[] = {
1697 {
"intersect_ray_tri",
1700 M_Geometry_intersect_ray_tri_doc},
1701 {
"intersect_point_line",
1704 M_Geometry_intersect_point_line_doc},
1705 {
"intersect_point_tri",
1708 M_Geometry_intersect_point_tri_doc},
1709 {
"closest_point_on_tri",
1712 M_Geometry_closest_point_on_tri_doc},
1713 {
"intersect_point_tri_2d",
1716 M_Geometry_intersect_point_tri_2d_doc},
1717 {
"intersect_point_quad_2d",
1720 M_Geometry_intersect_point_quad_2d_doc},
1721 {
"intersect_line_line",
1724 M_Geometry_intersect_line_line_doc},
1725 {
"intersect_line_line_2d",
1728 M_Geometry_intersect_line_line_2d_doc},
1729 {
"intersect_line_plane",
1732 M_Geometry_intersect_line_plane_doc},
1733 {
"intersect_plane_plane",
1736 M_Geometry_intersect_plane_plane_doc},
1737 {
"intersect_line_sphere",
1740 M_Geometry_intersect_line_sphere_doc},
1741 {
"intersect_line_sphere_2d",
1744 M_Geometry_intersect_line_sphere_2d_doc},
1745 {
"distance_point_to_plane",
1748 M_Geometry_distance_point_to_plane_doc},
1749 {
"intersect_sphere_sphere_2d",
1752 M_Geometry_intersect_sphere_sphere_2d_doc},
1753 {
"intersect_tri_tri_2d",
1756 M_Geometry_intersect_tri_tri_2d_doc},
1758 {
"volume_tetrahedron",
1761 M_Geometry_volume_tetrahedron_doc},
1762 {
"normal", (PyCFunction)
M_Geometry_normal, METH_VARARGS, M_Geometry_normal_doc},
1763 {
"barycentric_transform",
1766 M_Geometry_barycentric_transform_doc},
1767 {
"points_in_planes",
1770 M_Geometry_points_in_planes_doc},
1771 #ifndef MATH_STANDALONE
1772 {
"interpolate_bezier",
1775 M_Geometry_interpolate_bezier_doc},
1776 {
"tessellate_polygon",
1779 M_Geometry_tessellate_polygon_doc},
1781 (PyCFunction)M_Geometry_convex_hull_2d,
1783 M_Geometry_convex_hull_2d_doc},
1785 (PyCFunction)M_Geometry_delaunay_2d_cdt,
1787 M_Geometry_delaunay_2d_cdt_doc},
1788 {
"box_fit_2d", (PyCFunction)M_Geometry_box_fit_2d, METH_O, M_Geometry_box_fit_2d_doc},
1794 static struct PyModuleDef M_Geometry_module_def = {
1795 PyModuleDef_HEAD_INIT,
1796 "mathutils.geometry",
1809 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], bool flip_normal)
void BLI_box_pack_2d(BoxPack *boxarray, unsigned int len, float *r_tot_x, float *r_tot_y)
int BLI_convexhull_2d(const float(*points)[2], int n, int r_points[])
float BLI_convexhull_aabb_fit_points_2d(const float(*points)[2], unsigned int n)
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])
int isect_line_sphere_v3(const float l1[3], const float l2[3], const float sp[3], float r, float r_p1[3], float r_p2[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])
int isect_line_sphere_v2(const float l1[2], const float l2[2], const float sp[2], float r, float r_p1[2], float r_p2[2])
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_seg_seg_v2_point(const float v0[2], const float v1[2], const float v2[2], const float v3[2], float vi[2])
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])
bool isect_planes_v3_fn(const float planes[][4], int planes_len, float eps_coplanar, float eps_isect, void(*callback_fn)(const float co[3], int i, int j, int k, void *user_data), void *user_data)
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
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(float *array, int array_num_min, int array_num_max, 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)
PyObject * Vector_CreatePyObject(const float *vec, const int vec_num, 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