15#ifndef MATH_STANDALONE
39 M_Geometry_intersect_ray_tri_doc,
40 ".. function:: intersect_ray_tri(v1, v2, v3, ray, orig, clip=True, /)\n"
42 " Returns the intersection between a ray and a triangle, if possible, returns None "
46 " :type v1: :class:`mathutils.Vector`\n"
48 " :type v2: :class:`mathutils.Vector`\n"
50 " :type v3: :class:`mathutils.Vector`\n"
51 " :arg ray: Direction of the projection\n"
52 " :type ray: :class:`mathutils.Vector`\n"
53 " :arg orig: Origin\n"
54 " :type orig: :class:`mathutils.Vector`\n"
55 " :arg clip: When False, don't restrict the intersection to the area of the "
56 "triangle, use the infinite plane defined by the triangle.\n"
58 " :return: The point of intersection or None if no intersection is found\n"
59 " :rtype: :class:`mathutils.Vector` | None\n");
62 const char *error_prefix =
"intersect_ray_tri";
63 PyObject *py_ray, *py_ray_off, *py_tri[3];
64 float dir[3], orig[3], tri[3][3], e1[3], e2[3], pvec[3], tvec[3], qvec[3];
65 float det, inv_det, u,
v, t;
69 if (!PyArg_ParseTuple(args,
70 "OOOOO|O&:intersect_ray_tri",
108 if (det > -0.000001f && det < 0.000001f) {
112 inv_det = 1.0f / det;
119 if (clip && (u < 0.0f || u > 1.0f)) {
151 M_Geometry_intersect_line_line_doc,
152 ".. function:: intersect_line_line(v1, v2, v3, v4, /)\n"
154 " Returns a tuple with the points on each line respectively closest to the other.\n"
156 " :arg v1: First point of the first line\n"
157 " :type v1: :class:`mathutils.Vector`\n"
158 " :arg v2: Second point of the first line\n"
159 " :type v2: :class:`mathutils.Vector`\n"
160 " :arg v3: First point of the second line\n"
161 " :type v3: :class:`mathutils.Vector`\n"
162 " :arg v4: Second point of the second line\n"
163 " :type v4: :class:`mathutils.Vector`\n"
164 " :return: The intersection on each line or None when the lines are co-linear.\n"
165 " :rtype: tuple[:class:`mathutils.Vector`, :class:`mathutils.Vector`] | None\n");
168 const char *error_prefix =
"intersect_line_line";
170 PyObject *py_lines[4];
171 float lines[4][3], i1[3], i2[3];
175 if (!PyArg_ParseTuple(args,
"OOOO:intersect_line_line",
UNPACK4_EX(&, py_lines, ))) {
185 error_prefix) != -1) &&
190 error_prefix) != -1) &&
195 error_prefix) != -1)) == 0)
201 if (ix_vec_num == 2) {
219 tuple = PyTuple_New(2);
230 M_Geometry_intersect_sphere_sphere_2d_doc,
231 ".. function:: intersect_sphere_sphere_2d(p_a, radius_a, p_b, radius_b, /)\n"
233 " Returns 2 points on between intersecting circles.\n"
235 " :arg p_a: Center of the first circle\n"
236 " :type p_a: :class:`mathutils.Vector`\n"
237 " :arg radius_a: Radius of the first circle\n"
238 " :type radius_a: float\n"
239 " :arg p_b: Center of the second circle\n"
240 " :type p_b: :class:`mathutils.Vector`\n"
241 " :arg radius_b: Radius of the second circle\n"
242 " :type radius_b: float\n"
243 " :return: 2 points on between intersecting circles or None when there is no intersection.\n"
244 " :rtype: tuple[:class:`mathutils.Vector`, :class:`mathutils.Vector`] | "
245 "tuple[None, None]\n");
248 const char *error_prefix =
"intersect_sphere_sphere_2d";
250 PyObject *py_v_a, *py_v_b;
251 float v_a[2], v_b[2];
256 if (!PyArg_ParseTuple(args,
"OfOf:intersect_sphere_sphere_2d", &py_v_a, &rad_a, &py_v_b, &rad_b))
267 ret = PyTuple_New(2);
273 (dist > rad_a + rad_b) ||
275 (dist <
fabsf(rad_a - rad_b)) ||
277 (dist < FLT_EPSILON))
283 const float dist_delta = ((rad_a * rad_a) - (rad_b * rad_b) + (dist * dist)) / (2.0f * dist);
284 const float h =
powf(
fabsf((rad_a * rad_a) - (dist_delta * dist_delta)), 0.5f);
288 i_cent[0] = v_a[0] + ((v_ab[0] * dist_delta) / dist);
289 i_cent[1] = v_a[1] + ((v_ab[1] * dist_delta) / dist);
291 i1[0] = i_cent[0] + h * v_ab[1] / dist;
292 i1[1] = i_cent[1] - h * v_ab[0] / dist;
294 i2[0] = i_cent[0] - h * v_ab[1] / dist;
295 i2[1] = i_cent[1] + h * v_ab[0] / dist;
306 M_Geometry_intersect_tri_tri_2d_doc,
307 ".. function:: intersect_tri_tri_2d(tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3, /)\n"
309 " Check if two 2D triangles intersect.\n"
314 const char *error_prefix =
"intersect_tri_tri_2d";
315 PyObject *tri_pair_py[2][3];
316 float tri_pair[2][3][2];
318 if (!PyArg_ParseTuple(args,
319 "OOOOOO:intersect_tri_tri_2d",
330 for (
int i = 0;
i < 2;
i++) {
331 for (
int j = 0; j < 3; j++) {
333 tri_pair[
i][j], 2, 2 |
MU_ARRAY_SPILL, tri_pair_py[
i][j], error_prefix) == -1)
341 return PyBool_FromLong(
ret);
346 M_Geometry_normal_doc,
347 ".. function:: normal(*vectors)\n"
349 " Returns the normal of a 3D polygon.\n"
351 " :arg vectors: 3 or more vectors to calculate normals.\n"
352 " :type vectors: Sequence[Sequence[float]]\n"
353 " :rtype: :class:`mathutils.Vector`\n");
359 PyObject *
ret =
nullptr;
362 if (PyTuple_GET_SIZE(args) == 1) {
363 args = PyTuple_GET_ITEM(args, 0);
372 if (coords_len < 3) {
373 PyErr_SetString(PyExc_ValueError,
"Expected 3 or more vectors");
389 M_Geometry_area_tri_doc,
390 ".. function:: area_tri(v1, v2, v3, /)\n"
392 " Returns the area size of the 2D or 3D triangle defined.\n"
395 " :type v1: :class:`mathutils.Vector`\n"
397 " :type v2: :class:`mathutils.Vector`\n"
399 " :type v3: :class:`mathutils.Vector`\n"
403 const char *error_prefix =
"area_tri";
408 if (!PyArg_ParseTuple(args,
"OOO:area_tri",
UNPACK3_EX(&, py_tri, ))) {
424 M_Geometry_volume_tetrahedron_doc,
425 ".. function:: volume_tetrahedron(v1, v2, v3, v4, /)\n"
427 " Return the volume formed by a tetrahedron (points can be in any order).\n"
430 " :type v1: :class:`mathutils.Vector`\n"
432 " :type v2: :class:`mathutils.Vector`\n"
434 " :type v3: :class:`mathutils.Vector`\n"
436 " :type v4: :class:`mathutils.Vector`\n"
440 const char *error_prefix =
"volume_tetrahedron";
445 if (!PyArg_ParseTuple(args,
"OOOO:volume_tetrahedron",
UNPACK4_EX(&, py_tet, ))) {
460 M_Geometry_intersect_line_line_2d_doc,
461 ".. function:: intersect_line_line_2d(lineA_p1, lineA_p2, lineB_p1, lineB_p2, /)\n"
463 " Takes 2 segments (defined by 4 vectors) and returns a vector for their point of "
464 "intersection or None.\n"
466 " .. warning:: Despite its name, this function works on segments, and not on lines.\n"
468 " :arg lineA_p1: First point of the first line\n"
469 " :type lineA_p1: :class:`mathutils.Vector`\n"
470 " :arg lineA_p2: Second point of the first line\n"
471 " :type lineA_p2: :class:`mathutils.Vector`\n"
472 " :arg lineB_p1: First point of the second line\n"
473 " :type lineB_p1: :class:`mathutils.Vector`\n"
474 " :arg lineB_p2: Second point of the second line\n"
475 " :type lineB_p2: :class:`mathutils.Vector`\n"
476 " :return: The point of intersection or None when not found\n"
477 " :rtype: :class:`mathutils.Vector` | None\n");
480 const char *error_prefix =
"intersect_line_line_2d";
481 PyObject *py_lines[4];
486 if (!PyArg_ParseTuple(args,
"OOOO:intersect_line_line_2d",
UNPACK4_EX(&, py_lines, ))) {
505 M_Geometry_intersect_line_plane_doc,
506 ".. function:: intersect_line_plane(line_a, line_b, plane_co, plane_no, no_flip=False, /)\n"
508 " Calculate the intersection between a line (as 2 vectors) and a plane.\n"
509 " Returns a vector for the intersection or None.\n"
511 " :arg line_a: First point of the first line\n"
512 " :type line_a: :class:`mathutils.Vector`\n"
513 " :arg line_b: Second point of the first line\n"
514 " :type line_b: :class:`mathutils.Vector`\n"
515 " :arg plane_co: A point on the plane\n"
516 " :type plane_co: :class:`mathutils.Vector`\n"
517 " :arg plane_no: The direction the plane is facing\n"
518 " :type plane_no: :class:`mathutils.Vector`\n"
519 " :arg no_flip: Not implemented\n"
520 " :type no_flip: bool\n"
521 " :return: The point of intersection or None when not found\n"
522 " :rtype: :class:`mathutils.Vector` | None\n");
525 const char *error_prefix =
"intersect_line_plane";
526 PyObject *py_line_a, *py_line_b, *py_plane_co, *py_plane_no;
527 float line_a[3], line_b[3], plane_co[3], plane_no[3];
529 const bool no_flip =
false;
531 if (!PyArg_ParseTuple(args,
532 "OOOO|O&:intersect_line_plane",
562 M_Geometry_intersect_plane_plane_doc,
563 ".. function:: intersect_plane_plane(plane_a_co, plane_a_no, plane_b_co, plane_b_no, /)\n"
565 " Return the intersection between two planes\n"
567 " :arg plane_a_co: Point on the first plane\n"
568 " :type plane_a_co: :class:`mathutils.Vector`\n"
569 " :arg plane_a_no: Normal of the first plane\n"
570 " :type plane_a_no: :class:`mathutils.Vector`\n"
571 " :arg plane_b_co: Point on the second plane\n"
572 " :type plane_b_co: :class:`mathutils.Vector`\n"
573 " :arg plane_b_no: Normal of the second plane\n"
574 " :type plane_b_no: :class:`mathutils.Vector`\n"
575 " :return: The line of the intersection represented as a point and a vector or None if the "
576 "intersection can't be calculated\n"
577 " :rtype: tuple[:class:`mathutils.Vector`, :class:`mathutils.Vector`] | "
578 "tuple[None, None]\n");
581 const char *error_prefix =
"intersect_plane_plane";
582 PyObject *
ret, *ret_co, *ret_no;
583 PyObject *py_plane_a_co, *py_plane_a_no, *py_plane_b_co, *py_plane_b_no;
584 float plane_a_co[3], plane_a_no[3], plane_b_co[3], plane_b_no[3];
585 float plane_a[4], plane_b[4];
590 if (!PyArg_ParseTuple(args,
591 "OOOO:intersect_plane_plane",
622 ret_co = Py_NewRef(Py_None);
623 ret_no = Py_NewRef(Py_None);
626 ret = PyTuple_New(2);
633 M_Geometry_intersect_line_sphere_doc,
634 ".. function:: intersect_line_sphere(line_a, line_b, sphere_co, sphere_radius, clip=True, /)\n"
636 " Takes a line (as 2 points) and a sphere (as a point and a radius) and\n"
637 " returns the intersection\n"
639 " :arg line_a: First point of the line\n"
640 " :type line_a: :class:`mathutils.Vector`\n"
641 " :arg line_b: Second point of the line\n"
642 " :type line_b: :class:`mathutils.Vector`\n"
643 " :arg sphere_co: The center of the sphere\n"
644 " :type sphere_co: :class:`mathutils.Vector`\n"
645 " :arg sphere_radius: Radius of the sphere\n"
646 " :type sphere_radius: float\n"
647 " :arg clip: When False, don't restrict the intersection to the area of the "
649 " :type clip: bool\n"
650 " :return: The intersection points as a pair of vectors or None when there is no "
652 " :rtype: tuple[:class:`mathutils.Vector` | None, :class:`mathutils.Vector` | None]\n");
655 const char *error_prefix =
"intersect_line_sphere";
656 PyObject *py_line_a, *py_line_b, *py_sphere_co;
657 float line_a[3], line_b[3], sphere_co[3];
664 if (!PyArg_ParseTuple(args,
665 "OOOf|O&:intersect_line_sphere",
688 PyObject *
ret = PyTuple_New(2);
727 M_Geometry_intersect_line_sphere_2d_doc,
728 ".. function:: intersect_line_sphere_2d(line_a, line_b, sphere_co, "
729 "sphere_radius, clip=True, /)\n"
731 " Takes a line (as 2 points) and a sphere (as a point and a radius) and\n"
732 " returns the intersection\n"
734 " :arg line_a: First point of the line\n"
735 " :type line_a: :class:`mathutils.Vector`\n"
736 " :arg line_b: Second point of the line\n"
737 " :type line_b: :class:`mathutils.Vector`\n"
738 " :arg sphere_co: The center of the sphere\n"
739 " :type sphere_co: :class:`mathutils.Vector`\n"
740 " :arg sphere_radius: Radius of the sphere\n"
741 " :type sphere_radius: float\n"
742 " :arg clip: When False, don't restrict the intersection to the area of the "
744 " :type clip: bool\n"
745 " :return: The intersection points as a pair of vectors or None when there is no "
747 " :rtype: tuple[:class:`mathutils.Vector` | None, :class:`mathutils.Vector` | None]\n");
750 const char *error_prefix =
"intersect_line_sphere_2d";
751 PyObject *py_line_a, *py_line_b, *py_sphere_co;
752 float line_a[2], line_b[2], sphere_co[2];
759 if (!PyArg_ParseTuple(args,
760 "OOOf|O&:intersect_line_sphere_2d",
783 PyObject *
ret = PyTuple_New(2);
821 M_Geometry_intersect_point_line_doc,
822 ".. function:: intersect_point_line(pt, line_p1, line_p2, /)\n"
824 " Takes a point and a line and returns the closest point on the line and its "
825 "distance from the first point of the line as a percentage of the length of the line.\n"
828 " :type pt: :class:`mathutils.Vector`\n"
829 " :arg line_p1: First point of the line\n"
830 " :type line_p1: :class:`mathutils.Vector`\n"
831 " :arg line_p2: Second point of the line\n"
832 " :type line_p2: :class:`mathutils.Vector`\n"
833 " :rtype: tuple[:class:`mathutils.Vector`, float]\n");
835 PyObject *
const *args,
838 const char *error_prefix =
"intersect_point_line";
839 float pt[3], pt_out[3], line_a[3], line_b[3];
842 if (!_PyArg_CheckPositional(error_prefix, nargs, 3, 3)) {
846 PyObject *py_pt = args[0];
847 PyObject *py_line_a = args[1];
848 PyObject *py_line_b = args[2];
864 PyObject *
ret = PyTuple_New(2);
872 M_Geometry_intersect_point_line_segment_doc,
873 ".. function:: intersect_point_line_segment(pt, seg_p1, seg_p2, /)\n"
875 " Takes a point and a segment and returns the closest point on the segment "
876 "and the distance to the segment.\n"
879 " :type pt: :class:`mathutils.Vector`\n"
880 " :arg seg_p1: First point of the segment\n"
881 " :type seg_p1: :class:`mathutils.Vector`\n"
882 " :arg seg_p2: Second point of the segment\n"
883 " :type seg_p2: :class:`mathutils.Vector`\n"
884 " :rtype: tuple[:class:`mathutils.Vector`, float]\n");
886 PyObject *
const *args,
889 const char *error_prefix =
"intersect_point_line_segment";
890 float pt[3], pt_out[3], seg_a[3], seg_b[3];
893 if (!_PyArg_CheckPositional(error_prefix, nargs, 3, 3)) {
897 PyObject *py_pt = args[0];
898 PyObject *py_seq_a = args[1];
899 PyObject *py_seg_b = args[2];
914 const float lambda =
len_v3v3(pt_out, pt);
916 PyObject *
ret = PyTuple_New(2);
924 M_Geometry_intersect_point_tri_doc,
925 ".. function:: intersect_point_tri(pt, tri_p1, tri_p2, tri_p3, /)\n"
927 " Takes 4 vectors: one is the point and the next 3 define the triangle. Projects "
928 "the point onto the triangle plane and checks if it is within the triangle.\n"
931 " :type pt: :class:`mathutils.Vector`\n"
932 " :arg tri_p1: First point of the triangle\n"
933 " :type tri_p1: :class:`mathutils.Vector`\n"
934 " :arg tri_p2: Second point of the triangle\n"
935 " :type tri_p2: :class:`mathutils.Vector`\n"
936 " :arg tri_p3: Third point of the triangle\n"
937 " :type tri_p3: :class:`mathutils.Vector`\n"
938 " :return: Point on the triangles plane or None if its outside the triangle\n"
939 " :rtype: :class:`mathutils.Vector` | None\n");
942 const char *error_prefix =
"intersect_point_tri";
943 PyObject *py_pt, *py_tri[3];
944 float pt[3], tri[3][3];
948 if (!PyArg_ParseTuple(args,
"OOOO:intersect_point_tri", &py_pt,
UNPACK3_EX(&, py_tri, ))) {
973 M_Geometry_closest_point_on_tri_doc,
974 ".. function:: closest_point_on_tri(pt, tri_p1, tri_p2, tri_p3, /)\n"
976 " Takes 4 vectors: one is the point and the next 3 define the triangle.\n"
979 " :type pt: :class:`mathutils.Vector`\n"
980 " :arg tri_p1: First point of the triangle\n"
981 " :type tri_p1: :class:`mathutils.Vector`\n"
982 " :arg tri_p2: Second point of the triangle\n"
983 " :type tri_p2: :class:`mathutils.Vector`\n"
984 " :arg tri_p3: Third point of the triangle\n"
985 " :type tri_p3: :class:`mathutils.Vector`\n"
986 " :return: The closest point of the triangle.\n"
987 " :rtype: :class:`mathutils.Vector`\n");
990 const char *error_prefix =
"closest_point_on_tri";
991 PyObject *py_pt, *py_tri[3];
992 float pt[3], tri[3][3];
996 if (!PyArg_ParseTuple(args,
"OOOO:closest_point_on_tri", &py_pt,
UNPACK3_EX(&, py_tri, ))) {
1019 M_Geometry_intersect_point_tri_2d_doc,
1020 ".. function:: intersect_point_tri_2d(pt, tri_p1, tri_p2, tri_p3, /)\n"
1022 " Takes 4 vectors (using only the x and y coordinates): one is the point and the next 3 "
1023 "define the triangle. Returns 1 if the point is within the triangle, otherwise 0.\n"
1026 " :type pt: :class:`mathutils.Vector`\n"
1027 " :arg tri_p1: First point of the triangle\n"
1028 " :type tri_p1: :class:`mathutils.Vector`\n"
1029 " :arg tri_p2: Second point of the triangle\n"
1030 " :type tri_p2: :class:`mathutils.Vector`\n"
1031 " :arg tri_p3: Third point of the triangle\n"
1032 " :type tri_p3: :class:`mathutils.Vector`\n"
1036 const char *error_prefix =
"intersect_point_tri_2d";
1037 PyObject *py_pt, *py_tri[3];
1038 float pt[2], tri[3][2];
1041 if (!PyArg_ParseTuple(args,
"OOOO:intersect_point_tri_2d", &py_pt,
UNPACK3_EX(&, py_tri, ))) {
1059 M_Geometry_intersect_point_quad_2d_doc,
1060 ".. function:: intersect_point_quad_2d(pt, quad_p1, quad_p2, quad_p3, quad_p4, /)\n"
1062 " Takes 5 vectors (using only the x and y coordinates): one is the point and the "
1063 "next 4 define the quad,\n"
1064 " only the x and y are used from the vectors. Returns 1 if the point is within the "
1065 "quad, otherwise 0.\n"
1066 " Works only with convex quads without singular edges.\n"
1069 " :type pt: :class:`mathutils.Vector`\n"
1070 " :arg quad_p1: First point of the quad\n"
1071 " :type quad_p1: :class:`mathutils.Vector`\n"
1072 " :arg quad_p2: Second point of the quad\n"
1073 " :type quad_p2: :class:`mathutils.Vector`\n"
1074 " :arg quad_p3: Third point of the quad\n"
1075 " :type quad_p3: :class:`mathutils.Vector`\n"
1076 " :arg quad_p4: Fourth point of the quad\n"
1077 " :type quad_p4: :class:`mathutils.Vector`\n"
1081 const char *error_prefix =
"intersect_point_quad_2d";
1082 PyObject *py_pt, *py_quad[4];
1083 float pt[2],
quad[4][2];
1086 if (!PyArg_ParseTuple(args,
"OOOOO:intersect_point_quad_2d", &py_pt,
UNPACK4_EX(&, py_quad, ))) {
1104 M_Geometry_distance_point_to_plane_doc,
1105 ".. function:: distance_point_to_plane(pt, plane_co, plane_no, /)\n"
1107 " Returns the signed distance between a point and a plane "
1108 " (negative when below the normal).\n"
1111 " :type pt: :class:`mathutils.Vector`\n"
1112 " :arg plane_co: A point on the plane\n"
1113 " :type plane_co: :class:`mathutils.Vector`\n"
1114 " :arg plane_no: The direction the plane is facing\n"
1115 " :type plane_no: :class:`mathutils.Vector`\n"
1116 " :rtype: float\n");
1119 const char *error_prefix =
"distance_point_to_plane";
1120 PyObject *py_pt, *py_plane_co, *py_plane_no;
1121 float pt[3], plane_co[3], plane_no[3];
1124 if (!PyArg_ParseTuple(args,
"OOO:distance_point_to_plane", &py_pt, &py_plane_co, &py_plane_no)) {
1142 M_Geometry_barycentric_transform_doc,
1143 ".. function:: barycentric_transform(point, tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3, "
1146 " Return a transformed point, the transformation is defined by 2 triangles.\n"
1148 " :arg point: The point to transform.\n"
1149 " :type point: :class:`mathutils.Vector`\n"
1150 " :arg tri_a1: source triangle vertex.\n"
1151 " :type tri_a1: :class:`mathutils.Vector`\n"
1152 " :arg tri_a2: source triangle vertex.\n"
1153 " :type tri_a2: :class:`mathutils.Vector`\n"
1154 " :arg tri_a3: source triangle vertex.\n"
1155 " :type tri_a3: :class:`mathutils.Vector`\n"
1156 " :arg tri_b1: target triangle vertex.\n"
1157 " :type tri_b1: :class:`mathutils.Vector`\n"
1158 " :arg tri_b2: target triangle vertex.\n"
1159 " :type tri_b2: :class:`mathutils.Vector`\n"
1160 " :arg tri_b3: target triangle vertex.\n"
1161 " :type tri_b3: :class:`mathutils.Vector`\n"
1162 " :return: The transformed point\n"
1163 " :rtype: :class:`mathutils.Vector`\n");
1166 const char *error_prefix =
"barycentric_transform";
1167 PyObject *py_pt_src, *py_tri_src[3], *py_tri_dst[3];
1168 float pt_src[3], pt_dst[3], tri_src[3][3], tri_dst[3][3];
1171 if (!PyArg_ParseTuple(args,
1172 "OOOOOOO:barycentric_transform",
1214 M_Geometry_points_in_planes_doc,
1215 ".. function:: points_in_planes(planes, epsilon_coplanar=1e-4, epsilon_isect=1e-6, /)\n"
1217 " Returns a list of points inside all planes given and a list of index values for "
1218 "the planes used.\n"
1220 " :arg planes: List of planes (4D vectors).\n"
1221 " :type planes: list[:class:`mathutils.Vector`]\n"
1222 " :arg epsilon_coplanar: Epsilon value for interpreting plane pairs as co-plannar.\n"
1223 " :type epsilon_coplanar: float\n"
1224 " :arg epsilon_isect: Epsilon value for intersection.\n"
1225 " :type epsilon_isect: float\n"
1226 " :return: Two lists, once containing the 3D coordinates inside the planes, "
1227 "another containing the plane indices used.\n"
1228 " :rtype: tuple[list[:class:`mathutils.Vector`], list[int]]\n");
1231 PyObject *py_planes;
1233 float eps_coplanar = 1e-4f;
1234 float eps_isect = 1e-6f;
1237 if (!PyArg_ParseTuple(args,
"O|ff:points_in_planes", &py_planes, &eps_coplanar, &eps_isect)) {
1242 (
float **)&planes, 4, py_planes,
"points_in_planes")) == -1)
1250 user_data.
py_verts = PyList_New(0);
1251 user_data.
planes_used =
static_cast<char *
>(PyMem_Malloc(
sizeof(
char) * planes_len));
1254 PyObject *py_plane_index = PyList_New(0);
1256 memset(user_data.
planes_used, 0,
sizeof(
char) * planes_len);
1264 for (
int i = 0;
i < planes_len;
i++) {
1266 PyList_APPEND(py_plane_index, PyLong_FromLong(
i));
1273 PyObject *
ret = PyTuple_New(2);
1279#ifndef MATH_STANDALONE
1283 M_Geometry_interpolate_bezier_doc,
1284 ".. function:: interpolate_bezier(knot1, handle1, handle2, knot2, resolution, /)\n"
1286 " Interpolate a bezier spline segment.\n"
1288 " :arg knot1: First bezier spline point.\n"
1289 " :type knot1: :class:`mathutils.Vector`\n"
1290 " :arg handle1: First bezier spline handle.\n"
1291 " :type handle1: :class:`mathutils.Vector`\n"
1292 " :arg handle2: Second bezier spline handle.\n"
1293 " :type handle2: :class:`mathutils.Vector`\n"
1294 " :arg knot2: Second bezier spline point.\n"
1295 " :type knot2: :class:`mathutils.Vector`\n"
1296 " :arg resolution: Number of points to return.\n"
1297 " :type resolution: int\n"
1298 " :return: The interpolated points.\n"
1299 " :rtype: list[:class:`mathutils.Vector`]\n");
1302 const char *error_prefix =
"interpolate_bezier";
1303 PyObject *py_data[4];
1304 float data[4][4] = {{0.0f}};
1308 float *coord_array, *fp;
1311 if (!PyArg_ParseTuple(args,
"OOOOi:interpolate_bezier",
UNPACK4_EX(&, py_data, ), &resolu)) {
1315 for (
i = 0;
i < 4;
i++) {
1322 dims =
max_ii(dims, dims_tmp);
1326 PyErr_SetString(PyExc_ValueError,
"resolution must be 2 or over");
1331 for (
i = 0;
i < dims;
i++) {
1333 UNPACK4_EX(,
data, [
i]), coord_array +
i, resolu - 1,
sizeof(
float) * dims);
1336 list = PyList_New(resolu);
1338 for (
i = 0;
i < resolu;
i++, fp = fp + dims) {
1347 M_Geometry_tessellate_polygon_doc,
1348 ".. function:: tessellate_polygon(polylines, /)\n"
1350 " Takes a list of polylines (each point a pair or triplet of numbers) and returns "
1351 "the point indices for a polyline filled with triangles. Does not handle degenerate "
1352 "geometry (such as zero-length lines due to consecutive identical points).\n"
1354 " :arg polylines: Polygons where each polygon is a sequence of 2D or 3D points.\n"
1355 " :type polylines: Sequence[Sequence[Sequence[float]]]"
1356 " :return: A list of triangles.\n"
1357 " :rtype: list[tuple[int, int, int]]\n");
1362 PyObject *polyLine, *polyVec;
1363 int i, len_polylines, len_polypoints;
1364 bool list_parse_error =
false;
1368 ListBase dispbase = {
nullptr,
nullptr};
1373 if (!PySequence_Check(polyLineSeq)) {
1374 PyErr_SetString(PyExc_TypeError,
"expected a sequence of poly lines");
1378 len_polylines = PySequence_Size(polyLineSeq);
1380 for (
i = 0;
i < len_polylines;
i++) {
1381 polyLine = PySequence_GetItem(polyLineSeq,
i);
1382 if (!PySequence_Check(polyLine)) {
1384 Py_XDECREF(polyLine);
1385 PyErr_SetString(PyExc_TypeError,
1386 "One or more of the polylines is not a sequence of mathutils.Vector's");
1390 len_polypoints = PySequence_Size(polyLine);
1391 if (len_polypoints > 0) {
1394 dl->
nr = len_polypoints;
1401 for (
int index = 0; index < len_polypoints; index++, fp += 3) {
1402 polyVec = PySequence_GetItem(polyLine, index);
1404 fp, 2, 3 |
MU_ARRAY_SPILL, polyVec,
"tessellate_polygon: parse coord");
1408 list_parse_error =
true;
1410 else if (polyVec_len == 2) {
1413 else if (polyVec_len == 3) {
1423 if (list_parse_error) {
1429 float down_vec[3] = {0, 0, -1};
1436 tri_list = PyList_New(dl->
parts);
1439 PyErr_SetString(PyExc_RuntimeError,
"failed to make a new list");
1443 int *dl_face = dl->
index;
1444 for (
int index = 0; index < dl->
parts; index++) {
1445 PyList_SET_ITEM(tri_list, index,
PyC_Tuple_Pack_I32({dl_face[0], dl_face[1], dl_face[2]}));
1453 tri_list = PyList_New(0);
1462 PyObject *list_item, *item_1, *item_2;
1466 if (!PyList_Check(value)) {
1467 PyErr_SetString(PyExc_TypeError,
"can only back a list of [x, y, w, h]");
1471 len = PyList_GET_SIZE(value);
1475 for (
i = 0;
i <
len;
i++) {
1476 list_item = PyList_GET_ITEM(value,
i);
1477 if (!PyList_Check(list_item) || PyList_GET_SIZE(list_item) < 4) {
1479 PyErr_SetString(PyExc_TypeError,
"can only pack a list of [x, y, w, h]");
1485 item_1 = PyList_GET_ITEM(list_item, 2);
1486 item_2 = PyList_GET_ITEM(list_item, 3);
1488 box->
w =
float(PyFloat_AsDouble(item_1));
1489 box->
h =
float(PyFloat_AsDouble(item_2));
1493 if (box->
w < 0.0f || box->
h < 0.0f) {
1495 PyErr_SetString(PyExc_TypeError,
1496 "error parsing width and height values from list: "
1497 "[x, y, w, h], not numbers or below zero");
1504 *r_boxarray = boxarray;
1511 PyObject *list_item;
1513 len = PyList_GET_SIZE(value);
1515 for (
i = 0;
i <
len;
i++) {
1517 list_item = PyList_GET_ITEM(value, box->
index);
1518 PyList_SetItem(list_item, 0, PyFloat_FromDouble(box->
x));
1519 PyList_SetItem(list_item, 1, PyFloat_FromDouble(box->
y));
1525 M_Geometry_box_pack_2d_doc,
1526 ".. function:: box_pack_2d(boxes, /)\n"
1528 " Returns a tuple with the width and height of the packed bounding box.\n"
1530 " :arg boxes: list of boxes, each box is a list where the first 4 items are "
1531 "[X, Y, width, height, ...] other items are ignored. "
1532 "The X & Y values in this list are modified to set the packed positions.\n"
1533 " :type boxes: list[list[float]]\n"
1534 " :return: The width and height of the packed bounding box.\n"
1535 " :rtype: tuple[float, float]\n");
1538 float tot_width = 0.0f, tot_height = 0.0f;
1543 if (!PyList_Check(boxlist)) {
1544 PyErr_SetString(PyExc_TypeError,
"expected a list of boxes [[x, y, w, h], ... ]");
1548 len = PyList_GET_SIZE(boxlist);
1555 const bool sort_boxes =
true;
1563 ret = PyTuple_New(2);
1570 M_Geometry_box_fit_2d_doc,
1571 ".. function:: box_fit_2d(points, /)\n"
1573 " Returns an angle that best fits the points to an axis aligned rectangle\n"
1575 " :arg points: Sequence of 2D points.\n"
1576 " :type points: Sequence[Sequence[float]]\n"
1578 " :rtype: float\n");
1598 return PyFloat_FromDouble(
angle);
1603 M_Geometry_convex_hull_2d_doc,
1604 ".. function:: convex_hull_2d(points)\n"
1606 " Returns a list of indices into the list given\n"
1608 " :arg points: Sequence of 2D points.\n"
1609 " :type points: Sequence[Sequence[float]]\n"
1610 " :return: a list of indices\n"
1611 " :rtype: list[int]\n");
1626 Py_ssize_t len_ret,
i;
1633 ret = PyList_New(len_ret);
1634 for (
i = 0;
i < len_ret;
i++) {
1635 PyList_SET_ITEM(
ret,
i, PyLong_FromLong(index_map[
i]));
1643 ret = PyList_New(0);
1655 if (
data.is_empty()) {
1656 return PyList_New(0);
1658 PyObject *
ret = PyList_New(
data.size());
1659 for (
const int i :
data.index_range()) {
1661 PyObject *sublist = PyList_New(group.
size());
1663 PyList_SET_ITEM(sublist, j, PyLong_FromLong(group[j]));
1665 PyList_SET_ITEM(
ret,
i, sublist);
1672 M_Geometry_delaunay_2d_cdt_doc,
1673 ".. function:: delaunay_2d_cdt(vert_coords, edges, faces, output_type, epsilon, "
1674 "need_ids=True, /)\n"
1676 " Computes the Constrained Delaunay Triangulation of a set of vertices,\n"
1677 " with edges and faces that must appear in the triangulation.\n"
1678 " Some triangles may be eaten away, or combined with other triangles,\n"
1679 " according to output type.\n"
1680 " The returned verts may be in a different order from input verts, may be moved\n"
1681 " slightly, and may be merged with other nearby verts.\n"
1682 " The three returned orig lists give, for each of verts, edges, and faces, the list of\n"
1683 " input element indices corresponding to the positionally same output element.\n"
1684 " For edges, the orig indices start with the input edges and then continue\n"
1685 " with the edges implied by each of the faces (n of them for an n-gon).\n"
1686 " If the need_ids argument is supplied, and False, then the code skips the preparation\n"
1687 " of the orig arrays, which may save some time.\n"
1689 " :arg vert_coords: Vertex coordinates (2d)\n"
1690 " :type vert_coords: Sequence[:class:`mathutils.Vector`]\n"
1691 " :arg edges: Edges, as pairs of indices in ``vert_coords``\n"
1692 " :type edges: Sequence[Sequence[int, int]]\n"
1693 " :arg faces: Faces, each sublist is a face, as indices in ``vert_coords`` (CCW oriented).\n"
1694 " :type faces: Sequence[Sequence[int]]\n"
1695 " :arg output_type: What output looks like. 0 => triangles with convex hull. "
1696 "1 => triangles inside constraints. "
1697 "2 => the input constraints, intersected. "
1698 "3 => like 2 but detect holes and omit them from output. "
1699 "4 => like 2 but with extra edges to make valid BMesh faces. "
1700 "5 => like 4 but detect holes and omit them from output.\n"
1701 " :type output_type: int\n"
1702 " :arg epsilon: For nearness tests; should not be zero\n"
1703 " :type epsilon: float\n"
1704 " :arg need_ids: are the orig output arrays needed?\n"
1705 " :type need_ids: bool\n"
1706 " :return: Output tuple, (vert_coords, edges, faces, orig_verts, orig_edges, orig_faces)\n"
1708 "list[:class:`mathutils.Vector`], "
1709 "list[tuple[int, int]], "
1713 "list[list[int]]]\n");
1717 const char *error_prefix =
"delaunay_2d_cdt";
1718 PyObject *vert_coords, *edges, *
faces;
1721 bool need_ids =
true;
1722 float (*in_coords)[2] =
nullptr;
1723 int (*in_edges)[2] =
nullptr;
1724 Py_ssize_t vert_coords_len, edges_len;
1725 PyObject *out_vert_coords =
nullptr;
1726 PyObject *out_edges =
nullptr;
1727 PyObject *out_faces =
nullptr;
1728 PyObject *out_orig_verts =
nullptr;
1729 PyObject *out_orig_edges =
nullptr;
1730 PyObject *out_orig_faces =
nullptr;
1731 PyObject *ret_value =
nullptr;
1733 if (!PyArg_ParseTuple(args,
1734 "OOOif|p:delaunay_2d_cdt",
1746 if (in_coords !=
nullptr) {
1747 PyMem_Free(in_coords);
1749 if (in_edges !=
nullptr) {
1750 PyMem_Free(in_edges);
1755 (
float **)&in_coords, 2, vert_coords, error_prefix);
1756 if (vert_coords_len == -1) {
1761 if (edges_len == -1) {
1771 for (
const int i :
verts.index_range()) {
1772 verts[
i] = {double(in_coords[
i][0]), double(in_coords[
i][1])};
1777 in.edge =
Span(
reinterpret_cast<std::pair<int, int> *
>(in_edges), edges_len);
1778 in.face = std::move(in_faces);
1779 in.epsilon = epsilon;
1780 in.need_ids = need_ids;
1785 ret_value = PyTuple_New(6);
1787 out_vert_coords = PyList_New(res.
vert.size());
1788 for (
const int i : res.
vert.index_range()) {
1791 if (item ==
nullptr) {
1796 PyList_SET_ITEM(out_vert_coords,
i, item);
1798 PyTuple_SET_ITEM(ret_value, 0, out_vert_coords);
1800 out_edges = PyList_New(res.
edge.
size());
1802 PyObject *item = PyTuple_New(2);
1803 PyTuple_SET_ITEM(item, 0, PyLong_FromLong(
long(res.
edge[
i].
first)));
1804 PyTuple_SET_ITEM(item, 1, PyLong_FromLong(
long(res.
edge[
i].second)));
1805 PyList_SET_ITEM(out_edges,
i, item);
1807 PyTuple_SET_ITEM(ret_value, 1, out_edges);
1810 PyTuple_SET_ITEM(ret_value, 2, out_faces);
1813 PyTuple_SET_ITEM(ret_value, 3, out_orig_verts);
1816 PyTuple_SET_ITEM(ret_value, 4, out_orig_edges);
1819 PyTuple_SET_ITEM(ret_value, 5, out_orig_faces);
1828# pragma clang diagnostic push
1829# pragma clang diagnostic ignored "-Wcast-function-type"
1831# pragma GCC diagnostic push
1832# pragma GCC diagnostic ignored "-Wcast-function-type"
1837 {
"intersect_ray_tri",
1840 M_Geometry_intersect_ray_tri_doc},
1841 {
"intersect_point_line",
1844 M_Geometry_intersect_point_line_doc},
1845 {
"intersect_point_line_segment",
1848 M_Geometry_intersect_point_line_segment_doc},
1849 {
"intersect_point_tri",
1852 M_Geometry_intersect_point_tri_doc},
1853 {
"closest_point_on_tri",
1856 M_Geometry_closest_point_on_tri_doc},
1857 {
"intersect_point_tri_2d",
1860 M_Geometry_intersect_point_tri_2d_doc},
1861 {
"intersect_point_quad_2d",
1864 M_Geometry_intersect_point_quad_2d_doc},
1865 {
"intersect_line_line",
1868 M_Geometry_intersect_line_line_doc},
1869 {
"intersect_line_line_2d",
1872 M_Geometry_intersect_line_line_2d_doc},
1873 {
"intersect_line_plane",
1876 M_Geometry_intersect_line_plane_doc},
1877 {
"intersect_plane_plane",
1880 M_Geometry_intersect_plane_plane_doc},
1881 {
"intersect_line_sphere",
1884 M_Geometry_intersect_line_sphere_doc},
1885 {
"intersect_line_sphere_2d",
1888 M_Geometry_intersect_line_sphere_2d_doc},
1889 {
"distance_point_to_plane",
1892 M_Geometry_distance_point_to_plane_doc},
1893 {
"intersect_sphere_sphere_2d",
1896 M_Geometry_intersect_sphere_sphere_2d_doc},
1897 {
"intersect_tri_tri_2d",
1900 M_Geometry_intersect_tri_tri_2d_doc},
1902 {
"volume_tetrahedron",
1905 M_Geometry_volume_tetrahedron_doc},
1906 {
"normal", (PyCFunction)
M_Geometry_normal, METH_VARARGS, M_Geometry_normal_doc},
1907 {
"barycentric_transform",
1910 M_Geometry_barycentric_transform_doc},
1911 {
"points_in_planes",
1914 M_Geometry_points_in_planes_doc},
1915#ifndef MATH_STANDALONE
1916 {
"interpolate_bezier",
1919 M_Geometry_interpolate_bezier_doc},
1920 {
"tessellate_polygon",
1923 M_Geometry_tessellate_polygon_doc},
1927 M_Geometry_convex_hull_2d_doc},
1931 M_Geometry_delaunay_2d_cdt_doc},
1935 {
nullptr,
nullptr, 0,
nullptr},
1940# pragma clang diagnostic pop
1942# pragma GCC diagnostic pop
1949 "The Blender geometry module.");
1952 "mathutils.geometry",
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, bool sort_boxes, float *r_tot_x, float *r_tot_y)
float BLI_convexhull_aabb_fit_points_2d(blender::Span< blender::float2 > points)
int BLI_convexhull_2d(blender::Span< blender::float2 > points, int r_points[])
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE int max_ii(int a, int b)
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
float closest_to_line_segment_v3(float r_close[3], const float p[3], const float l1[3], const float l2[3])
bool isect_tri_tri_v2(const float t_a0[2], const float t_a1[2], const float t_a2[2], const float t_b0[2], const float t_b1[2], const float t_b2[2])
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])
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])
int isect_seg_seg_v2_point(const float v0[2], const float v1[2], const float v2[2], const float v3[2], float r_vi[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 len_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
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 normalize_v3(float n[3])
#define BLI_SCOPED_DEFER(function_to_defer)
#define UNPACK3_EX(pre, a, post)
#define UNPACK4_EX(pre, a, post)
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Read Guarded memory(de)allocation.
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert * v
IndexRange index_range() const
constexpr int64_t size() const
constexpr IndexRange index_range() const
Array< std::pair< int, int > > edge
Array< Vector< int > > face
Array< Vector< int > > vert_orig
Array< Vector< int > > face_orig
Array< VecBase< T, 2 > > vert
Array< Vector< int > > edge_orig
blender::gpu::Batch * quad
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
bool mathutils_array_parse_alloc_viseq(PyObject *value, const char *error_prefix, blender::Array< blender::Vector< int > > &r_data)
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_line_sphere_2d(PyObject *, PyObject *args)
static PyObject * list_of_lists_from_arrays(const blender::Span< blender::Vector< int > > data)
static PyObject * M_Geometry_points_in_planes(PyObject *, PyObject *args)
static PyModuleDef M_Geometry_module_def
static PyObject * M_Geometry_area_tri(PyObject *, PyObject *args)
static PyObject * M_Geometry_distance_point_to_plane(PyObject *, PyObject *args)
static PyObject * M_Geometry_interpolate_bezier(PyObject *, PyObject *args)
static PyObject * M_Geometry_volume_tetrahedron(PyObject *, PyObject *args)
static PyObject * M_Geometry_tessellate_polygon(PyObject *, PyObject *polyLineSeq)
static PyObject * M_Geometry_intersect_point_line(PyObject *, PyObject *const *args, Py_ssize_t nargs)
static PyObject * M_Geometry_normal(PyObject *, PyObject *args)
static PyObject * M_Geometry_intersect_plane_plane(PyObject *, PyObject *args)
static PyObject * M_Geometry_intersect_line_plane(PyObject *, PyObject *args)
static PyObject * M_Geometry_intersect_point_tri(PyObject *, PyObject *args)
static PyObject * M_Geometry_box_fit_2d(PyObject *, PyObject *pointlist)
static PyObject * M_Geometry_intersect_line_line(PyObject *, PyObject *args)
static PyObject * M_Geometry_intersect_ray_tri(PyObject *, PyObject *args)
PyDoc_STRVAR(M_Geometry_intersect_ray_tri_doc, ".. function:: intersect_ray_tri(v1, v2, v3, ray, orig, clip=True, /)\n" "\n" " Returns the intersection between a ray and a triangle, if possible, returns None " "otherwise.\n" "\n" " :arg v1: Point1\n" " :type v1: :class:`mathutils.Vector`\n" " :arg v2: Point2\n" " :type v2: :class:`mathutils.Vector`\n" " :arg v3: Point3\n" " :type v3: :class:`mathutils.Vector`\n" " :arg ray: Direction of the projection\n" " :type ray: :class:`mathutils.Vector`\n" " :arg orig: Origin\n" " :type orig: :class:`mathutils.Vector`\n" " :arg clip: When False, don't restrict the intersection to the area of the " "triangle, use the infinite plane defined by the triangle.\n" " :type clip: bool\n" " :return: The point of intersection or None if no intersection is found\n" " :rtype: :class:`mathutils.Vector` | None\n")
static PyObject * M_Geometry_box_pack_2d(PyObject *, PyObject *boxlist)
static PyObject * M_Geometry_closest_point_on_tri(PyObject *, PyObject *args)
static PyObject * M_Geometry_intersect_line_line_2d(PyObject *, PyObject *args)
static PyObject * M_Geometry_intersect_tri_tri_2d(PyObject *, PyObject *args)
static PyObject * M_Geometry_intersect_line_sphere(PyObject *, PyObject *args)
static int boxPack_FromPyObject(PyObject *value, BoxPack **r_boxarray)
static PyObject * M_Geometry_intersect_point_line_segment(PyObject *, PyObject *const *args, Py_ssize_t nargs)
static PyObject * M_Geometry_intersect_point_quad_2d(PyObject *, PyObject *args)
static void points_in_planes_fn(const float co[3], int i, int j, int k, void *user_data_p)
PyMODINIT_FUNC PyInit_mathutils_geometry()
static PyObject * M_Geometry_convex_hull_2d(PyObject *, PyObject *pointlist)
static PyObject * M_Geometry_intersect_sphere_sphere_2d(PyObject *, PyObject *args)
static PyObject * M_Geometry_barycentric_transform(PyObject *, PyObject *args)
static void boxPack_ToPyObject(PyObject *value, const BoxPack *boxarray)
static PyMethodDef M_Geometry_methods[]
static PyObject * M_Geometry_delaunay_2d_cdt(PyObject *, PyObject *args)
static PyObject * M_Geometry_intersect_point_tri_2d(PyObject *, PyObject *args)
CDT_result< double > delaunay_2d_calc(const CDT_input< double > &input, CDT_output_type output_type)
VecBase< float, 2 > float2
int PyC_ParseBool(PyObject *o, void *p)
PyObject * PyC_Tuple_Pack_I32(const blender::Span< int > values)
header-only compatibility defines.
#define PyTuple_SET_ITEMS(op_arg,...)