Blender
V3.3
|
#include <Python.h>
#include "mathutils.h"
#include "mathutils_geometry.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
#include "BLI_blenlib.h"
#include "BLI_boxpack_2d.h"
#include "BLI_convexhull_2d.h"
#include "BLI_delaunay_2d.h"
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_utildefines.h"
Go to the source code of this file.
Classes | |
struct | PointsInPlanes_UserData |
Functions | |
PyDoc_STRVAR (M_Geometry_doc, "The Blender geometry module") | |
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: boolean\n" " :return: The point of intersection or None if no intersection is found\n" " :rtype: :class:`mathutils.Vector` or None\n") | |
static PyObject * | M_Geometry_intersect_ray_tri (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_intersect_line_line_doc, ".. function:: intersect_line_line(v1, v2, v3, v4)\n" "\n" " Returns a tuple with the points on each line respectively closest to the other.\n" "\n" " :arg v1: First point of the first line\n" " :type v1: :class:`mathutils.Vector`\n" " :arg v2: Second point of the first line\n" " :type v2: :class:`mathutils.Vector`\n" " :arg v3: First point of the second line\n" " :type v3: :class:`mathutils.Vector`\n" " :arg v4: Second point of the second line\n" " :type v4: :class:`mathutils.Vector`\n" " :rtype: tuple of :class:`mathutils.Vector`'s\n") | |
static PyObject * | M_Geometry_intersect_line_line (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_intersect_sphere_sphere_2d_doc, ".. function:: intersect_sphere_sphere_2d(p_a, radius_a, p_b, radius_b)\n" "\n" " Returns 2 points on between intersecting circles.\n" "\n" " :arg p_a: Center of the first circle\n" " :type p_a: :class:`mathutils.Vector`\n" " :arg radius_a: Radius of the first circle\n" " :type radius_a: float\n" " :arg p_b: Center of the second circle\n" " :type p_b: :class:`mathutils.Vector`\n" " :arg radius_b: Radius of the second circle\n" " :type radius_b: float\n" " :rtype: tuple of :class:`mathutils.Vector`'s or None when there is no intersection\n") | |
static PyObject * | M_Geometry_intersect_sphere_sphere_2d (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_intersect_tri_tri_2d_doc, ".. function:: intersect_tri_tri_2d(tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n" "\n" " Check if two 2D triangles intersect.\n" "\n" " :rtype: bool\n") | |
static PyObject * | M_Geometry_intersect_tri_tri_2d (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_normal_doc, ".. function:: normal(vectors)\n" "\n" " Returns the normal of a 3D polygon.\n" "\n" " :arg vectors: Vectors to calculate normals with\n" " :type vectors: sequence of 3 or more 3d vector\n" " :rtype: :class:`mathutils.Vector`\n") | |
static PyObject * | M_Geometry_normal (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_area_tri_doc, ".. function:: area_tri(v1, v2, v3)\n" "\n" " Returns the area size of the 2D or 3D triangle defined.\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" " :rtype: float\n") | |
static PyObject * | M_Geometry_area_tri (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_volume_tetrahedron_doc, ".. function:: volume_tetrahedron(v1, v2, v3, v4)\n" "\n" " Return the volume formed by a tetrahedron (points can be in any order).\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 v4: Point4\n" " :type v4: :class:`mathutils.Vector`\n" " :rtype: float\n") | |
static PyObject * | M_Geometry_volume_tetrahedron (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_intersect_line_line_2d_doc, ".. function:: intersect_line_line_2d(lineA_p1, lineA_p2, lineB_p1, lineB_p2)\n" "\n" " Takes 2 segments (defined by 4 vectors) and returns a vector for their point of " "intersection or None.\n" "\n" " .. warning:: Despite its name, this function works on segments, and not on lines.\n" "\n" " :arg lineA_p1: First point of the first line\n" " :type lineA_p1: :class:`mathutils.Vector`\n" " :arg lineA_p2: Second point of the first line\n" " :type lineA_p2: :class:`mathutils.Vector`\n" " :arg lineB_p1: First point of the second line\n" " :type lineB_p1: :class:`mathutils.Vector`\n" " :arg lineB_p2: Second point of the second line\n" " :type lineB_p2: :class:`mathutils.Vector`\n" " :return: The point of intersection or None when not found\n" " :rtype: :class:`mathutils.Vector` or None\n") | |
static PyObject * | M_Geometry_intersect_line_line_2d (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_intersect_line_plane_doc, ".. function:: intersect_line_plane(line_a, line_b, plane_co, plane_no, no_flip=False)\n" "\n" " Calculate the intersection between a line (as 2 vectors) and a plane.\n" " Returns a vector for the intersection or None.\n" "\n" " :arg line_a: First point of the first line\n" " :type line_a: :class:`mathutils.Vector`\n" " :arg line_b: Second point of the first line\n" " :type line_b: :class:`mathutils.Vector`\n" " :arg plane_co: A point on the plane\n" " :type plane_co: :class:`mathutils.Vector`\n" " :arg plane_no: The direction the plane is facing\n" " :type plane_no: :class:`mathutils.Vector`\n" " :return: The point of intersection or None when not found\n" " :rtype: :class:`mathutils.Vector` or None\n") | |
static PyObject * | M_Geometry_intersect_line_plane (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_intersect_plane_plane_doc, ".. function:: intersect_plane_plane(plane_a_co, plane_a_no, plane_b_co, plane_b_no)\n" "\n" " Return the intersection between two planes\n" "\n" " :arg plane_a_co: Point on the first plane\n" " :type plane_a_co: :class:`mathutils.Vector`\n" " :arg plane_a_no: Normal of the first plane\n" " :type plane_a_no: :class:`mathutils.Vector`\n" " :arg plane_b_co: Point on the second plane\n" " :type plane_b_co: :class:`mathutils.Vector`\n" " :arg plane_b_no: Normal of the second plane\n" " :type plane_b_no: :class:`mathutils.Vector`\n" " :return: The line of the intersection represented as a point and a vector\n" " :rtype: tuple pair of :class:`mathutils.Vector` or None if the intersection can't be " "calculated\n") | |
static PyObject * | M_Geometry_intersect_plane_plane (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_intersect_line_sphere_doc, ".. function:: intersect_line_sphere(line_a, line_b, sphere_co, sphere_radius, clip=True)\n" "\n" " Takes a line (as 2 points) and a sphere (as a point and a radius) and\n" " returns the intersection\n" "\n" " :arg line_a: First point of the line\n" " :type line_a: :class:`mathutils.Vector`\n" " :arg line_b: Second point of the line\n" " :type line_b: :class:`mathutils.Vector`\n" " :arg sphere_co: The center of the sphere\n" " :type sphere_co: :class:`mathutils.Vector`\n" " :arg sphere_radius: Radius of the sphere\n" " :type sphere_radius: sphere_radius\n" " :return: The intersection points as a pair of vectors or None when there is no " "intersection\n" " :rtype: A tuple pair containing :class:`mathutils.Vector` or None\n") | |
static PyObject * | M_Geometry_intersect_line_sphere (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_intersect_line_sphere_2d_doc, ".. function:: intersect_line_sphere_2d(line_a, line_b, sphere_co, sphere_radius, clip=True)\n" "\n" " Takes a line (as 2 points) and a sphere (as a point and a radius) and\n" " returns the intersection\n" "\n" " :arg line_a: First point of the line\n" " :type line_a: :class:`mathutils.Vector`\n" " :arg line_b: Second point of the line\n" " :type line_b: :class:`mathutils.Vector`\n" " :arg sphere_co: The center of the sphere\n" " :type sphere_co: :class:`mathutils.Vector`\n" " :arg sphere_radius: Radius of the sphere\n" " :type sphere_radius: sphere_radius\n" " :return: The intersection points as a pair of vectors or None when there is no " "intersection\n" " :rtype: A tuple pair containing :class:`mathutils.Vector` or None\n") | |
static PyObject * | M_Geometry_intersect_line_sphere_2d (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_intersect_point_line_doc, ".. function:: intersect_point_line(pt, line_p1, line_p2)\n" "\n" " Takes a point and a line and returns a tuple with the closest point on the line and its " "distance from the first point of the line as a percentage of the length of the line.\n" "\n" " :arg pt: Point\n" " :type pt: :class:`mathutils.Vector`\n" " :arg line_p1: First point of the line\n" " :type line_p1: :class:`mathutils.Vector`\n" " :arg line_p1: Second point of the line\n" " :type line_p1: :class:`mathutils.Vector`\n" " :rtype: (:class:`mathutils.Vector`, float)\n") | |
static PyObject * | M_Geometry_intersect_point_line (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_intersect_point_tri_doc, ".. function:: intersect_point_tri(pt, tri_p1, tri_p2, tri_p3)\n" "\n" " Takes 4 vectors: one is the point and the next 3 define the triangle. Projects " "the point onto the triangle plane and checks if it is within the triangle.\n" "\n" " :arg pt: Point\n" " :type pt: :class:`mathutils.Vector`\n" " :arg tri_p1: First point of the triangle\n" " :type tri_p1: :class:`mathutils.Vector`\n" " :arg tri_p2: Second point of the triangle\n" " :type tri_p2: :class:`mathutils.Vector`\n" " :arg tri_p3: Third point of the triangle\n" " :type tri_p3: :class:`mathutils.Vector`\n" " :return: Point on the triangles plane or None if its outside the triangle\n" " :rtype: :class:`mathutils.Vector` or None\n") | |
static PyObject * | M_Geometry_intersect_point_tri (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_closest_point_on_tri_doc, ".. function:: closest_point_on_tri(pt, tri_p1, tri_p2, tri_p3)\n" "\n" " Takes 4 vectors: one is the point and the next 3 define the triangle.\n" "\n" " :arg pt: Point\n" " :type pt: :class:`mathutils.Vector`\n" " :arg tri_p1: First point of the triangle\n" " :type tri_p1: :class:`mathutils.Vector`\n" " :arg tri_p2: Second point of the triangle\n" " :type tri_p2: :class:`mathutils.Vector`\n" " :arg tri_p3: Third point of the triangle\n" " :type tri_p3: :class:`mathutils.Vector`\n" " :return: The closest point of the triangle.\n" " :rtype: :class:`mathutils.Vector`\n") | |
static PyObject * | M_Geometry_closest_point_on_tri (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_intersect_point_tri_2d_doc, ".. function:: intersect_point_tri_2d(pt, tri_p1, tri_p2, tri_p3)\n" "\n" " Takes 4 vectors (using only the x and y coordinates): one is the point and the next 3 " "define the triangle. Returns 1 if the point is within the triangle, otherwise 0.\n" "\n" " :arg pt: Point\n" " :type pt: :class:`mathutils.Vector`\n" " :arg tri_p1: First point of the triangle\n" " :type tri_p1: :class:`mathutils.Vector`\n" " :arg tri_p2: Second point of the triangle\n" " :type tri_p2: :class:`mathutils.Vector`\n" " :arg tri_p3: Third point of the triangle\n" " :type tri_p3: :class:`mathutils.Vector`\n" " :rtype: int\n") | |
static PyObject * | M_Geometry_intersect_point_tri_2d (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_intersect_point_quad_2d_doc, ".. function:: intersect_point_quad_2d(pt, quad_p1, quad_p2, quad_p3, quad_p4)\n" "\n" " Takes 5 vectors (using only the x and y coordinates): one is the point and the " "next 4 define the quad,\n" " only the x and y are used from the vectors. Returns 1 if the point is within the " "quad, otherwise 0.\n" " Works only with convex quads without singular edges.\n" "\n" " :arg pt: Point\n" " :type pt: :class:`mathutils.Vector`\n" " :arg quad_p1: First point of the quad\n" " :type quad_p1: :class:`mathutils.Vector`\n" " :arg quad_p2: Second point of the quad\n" " :type quad_p2: :class:`mathutils.Vector`\n" " :arg quad_p3: Third point of the quad\n" " :type quad_p3: :class:`mathutils.Vector`\n" " :arg quad_p4: Fourth point of the quad\n" " :type quad_p4: :class:`mathutils.Vector`\n" " :rtype: int\n") | |
static PyObject * | M_Geometry_intersect_point_quad_2d (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_distance_point_to_plane_doc, ".. function:: distance_point_to_plane(pt, plane_co, plane_no)\n" "\n" " Returns the signed distance between a point and a plane " " (negative when below the normal).\n" "\n" " :arg pt: Point\n" " :type pt: :class:`mathutils.Vector`\n" " :arg plane_co: A point on the plane\n" " :type plane_co: :class:`mathutils.Vector`\n" " :arg plane_no: The direction the plane is facing\n" " :type plane_no: :class:`mathutils.Vector`\n" " :rtype: float\n") | |
static PyObject * | M_Geometry_distance_point_to_plane (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_barycentric_transform_doc, ".. function:: barycentric_transform(point, tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n" "\n" " Return a transformed point, the transformation is defined by 2 triangles.\n" "\n" " :arg point: The point to transform.\n" " :type point: :class:`mathutils.Vector`\n" " :arg tri_a1: source triangle vertex.\n" " :type tri_a1: :class:`mathutils.Vector`\n" " :arg tri_a2: source triangle vertex.\n" " :type tri_a2: :class:`mathutils.Vector`\n" " :arg tri_a3: source triangle vertex.\n" " :type tri_a3: :class:`mathutils.Vector`\n" " :arg tri_b1: target triangle vertex.\n" " :type tri_b1: :class:`mathutils.Vector`\n" " :arg tri_b2: target triangle vertex.\n" " :type tri_b2: :class:`mathutils.Vector`\n" " :arg tri_b3: target triangle vertex.\n" " :type tri_b3: :class:`mathutils.Vector`\n" " :return: The transformed point\n" " :rtype: :class:`mathutils.Vector`'s\n") | |
static PyObject * | M_Geometry_barycentric_transform (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) |
PyDoc_STRVAR (M_Geometry_points_in_planes_doc, ".. function:: points_in_planes(planes)\n" "\n" " Returns a list of points inside all planes given and a list of index values for " "the planes used.\n" "\n" " :arg planes: List of planes (4D vectors).\n" " :type planes: list of :class:`mathutils.Vector`\n" " :return: two lists, once containing the vertices inside the planes, another " "containing the plane indices used\n" " :rtype: pair of lists\n") | |
static PyObject * | M_Geometry_points_in_planes (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_interpolate_bezier_doc, ".. function:: interpolate_bezier(knot1, handle1, handle2, knot2, resolution)\n" "\n" " Interpolate a bezier spline segment.\n" "\n" " :arg knot1: First bezier spline point.\n" " :type knot1: :class:`mathutils.Vector`\n" " :arg handle1: First bezier spline handle.\n" " :type handle1: :class:`mathutils.Vector`\n" " :arg handle2: Second bezier spline handle.\n" " :type handle2: :class:`mathutils.Vector`\n" " :arg knot2: Second bezier spline point.\n" " :type knot2: :class:`mathutils.Vector`\n" " :arg resolution: Number of points to return.\n" " :type resolution: int\n" " :return: The interpolated points\n" " :rtype: list of :class:`mathutils.Vector`'s\n") | |
static PyObject * | M_Geometry_interpolate_bezier (PyObject *UNUSED(self), PyObject *args) |
PyDoc_STRVAR (M_Geometry_tessellate_polygon_doc, ".. function:: tessellate_polygon(veclist_list)\n" "\n" " Takes a list of polylines (each point a pair or triplet of numbers) and returns " "the point indices for a polyline filled with triangles. Does not handle degenerate " "geometry (such as zero-length lines due to consecutive identical points).\n" "\n" " :arg veclist_list: list of polylines\n" " :rtype: list\n") | |
static PyObject * | M_Geometry_tessellate_polygon (PyObject *UNUSED(self), PyObject *polyLineSeq) |
static int | boxPack_FromPyObject (PyObject *value, BoxPack **r_boxarray) |
static void | boxPack_ToPyObject (PyObject *value, const BoxPack *boxarray) |
PyDoc_STRVAR (M_Geometry_box_pack_2d_doc, ".. function:: box_pack_2d(boxes)\n" "\n" " Returns a tuple with the width and height of the packed bounding box.\n" "\n" " :arg boxes: list of boxes, each box is a list where the first 4 items are [x, y, " "width, height, ...] other items are ignored.\n" " :type boxes: list\n" " :return: the width and height of the packed bounding box\n" " :rtype: tuple, pair of floats\n") | |
static PyObject * | M_Geometry_box_pack_2d (PyObject *UNUSED(self), PyObject *boxlist) |
|
static |
Definition at line 1314 of file mathutils_geometry.c.
References float(), BoxPack::h, BoxPack::index, len, MEM_freeN, MEM_mallocN, and BoxPack::w.
Referenced by M_Geometry_box_pack_2d().
Definition at line 1363 of file mathutils_geometry.c.
References BoxPack::index, len, BoxPack::x, and BoxPack::y.
Referenced by M_Geometry_box_pack_2d().
|
static |
Definition at line 374 of file mathutils_geometry.c.
References area_tri_v2(), area_tri_v3(), len, mathutils_array_parse(), NULL, UNPACK3, and UNPACK3_EX.
|
static |
Definition at line 1033 of file mathutils_geometry.c.
References ARRAY_SIZE, mathutils_array_parse(), MU_ARRAY_SPILL, NULL, transform_point_by_tri_v3(), UNPACK3, UNPACK3_EX, and Vector_CreatePyObject().
|
static |
Definition at line 1388 of file mathutils_geometry.c.
References BLI_box_pack_2d(), boxPack_FromPyObject(), boxPack_ToPyObject(), len, MEM_freeN, NULL, PyTuple_SET_ITEMS, and ret.
|
static |
Definition at line 866 of file mathutils_geometry.c.
References ARRAY_SIZE, closest_on_tri_to_point_v3(), mathutils_array_parse(), MU_ARRAY_SPILL, MU_ARRAY_ZERO, NULL, UNPACK3, UNPACK3_EX, and Vector_CreatePyObject().
|
static |
Definition at line 989 of file mathutils_geometry.c.
References dist_signed_to_plane_v3(), mathutils_array_parse(), MU_ARRAY_SPILL, NULL, and plane_from_point_normal_v3().
|
static |
Definition at line 1160 of file mathutils_geometry.c.
References BKE_curve_forward_diff_bezier(), data, mathutils_array_parse(), max_ii(), MEM_callocN, MEM_freeN, MU_ARRAY_SPILL, MU_ARRAY_ZERO, NULL, UNPACK4_EX, and Vector_CreatePyObject().
|
static |
Definition at line 155 of file mathutils_geometry.c.
References closest_to_line_v3(), i1, isect_line_line_v3(), mathutils_array_parse(), MU_ARRAY_SPILL, MU_ARRAY_ZERO, NULL, PyTuple_SET_ITEMS, result, UNPACK4, UNPACK4_EX, and Vector_CreatePyObject().
|
static |
Definition at line 447 of file mathutils_geometry.c.
References ARRAY_SIZE, isect_seg_seg_v2_point(), mathutils_array_parse(), MU_ARRAY_SPILL, NULL, UNPACK4, UNPACK4_EX, and Vector_CreatePyObject().
|
static |
Definition at line 489 of file mathutils_geometry.c.
References isect_line_plane_v3(), mathutils_array_parse(), MU_ARRAY_SPILL, NULL, PyC_ParseBool(), and Vector_CreatePyObject().
|
static |
Definition at line 609 of file mathutils_geometry.c.
References isect_line_sphere_v3(), line_point_factor_v3(), mathutils_array_parse(), MU_ARRAY_SPILL, NULL, PyC_ParseBool(), PyTuple_SET_ITEMS, ret, and Vector_CreatePyObject().
|
static |
Definition at line 694 of file mathutils_geometry.c.
References isect_line_sphere_v2(), line_point_factor_v2(), mathutils_array_parse(), MU_ARRAY_SPILL, NULL, PyC_ParseBool(), PyTuple_SET_ITEMS, ret, and Vector_CreatePyObject().
|
static |
Definition at line 541 of file mathutils_geometry.c.
References isect_plane_plane_v3(), mathutils_array_parse(), MU_ARRAY_SPILL, normalize_v3(), NULL, plane_from_point_normal_v3(), PyTuple_SET_ITEMS, ret, and Vector_CreatePyObject().
|
static |
Definition at line 774 of file mathutils_geometry.c.
References closest_to_line_v3(), mathutils_array_parse(), MU_ARRAY_SPILL, MU_ARRAY_ZERO, NULL, PyTuple_SET_ITEMS, ret, and Vector_CreatePyObject().
|
static |
Definition at line 953 of file mathutils_geometry.c.
References ARRAY_SIZE, isect_point_quad_v2(), mathutils_array_parse(), MU_ARRAY_SPILL, NULL, quad, UNPACK4, and UNPACK4_EX.
|
static |
Definition at line 821 of file mathutils_geometry.c.
References ARRAY_SIZE, isect_point_tri_v3(), mathutils_array_parse(), MU_ARRAY_SPILL, MU_ARRAY_ZERO, NULL, UNPACK3, UNPACK3_EX, and Vector_CreatePyObject().
|
static |
Definition at line 910 of file mathutils_geometry.c.
References ARRAY_SIZE, isect_point_tri_v2(), mathutils_array_parse(), MU_ARRAY_SPILL, NULL, UNPACK3, and UNPACK3_EX.
|
static |
Definition at line 55 of file mathutils_geometry.c.
References add_v3_v3v3(), ARRAY_SIZE, cross_v3_v3v3(), dot_v3v3(), mathutils_array_parse(), MU_ARRAY_SPILL, MU_ARRAY_ZERO, mul_v3_fl(), normalize_v3(), NULL, PyC_ParseBool(), sub_v3_v3v3(), t, UNPACK3_EX, v, and Vector_CreatePyObject().
|
static |
Definition at line 231 of file mathutils_geometry.c.
References fabsf, i1, len_v2(), mathutils_array_parse(), NULL, powf, PyTuple_SET_ITEMS, ret, sub_v2_v2v2(), and Vector_CreatePyObject().
|
static |
Definition at line 292 of file mathutils_geometry.c.
References isect_tri_tri_v2(), mathutils_array_parse(), MU_ARRAY_SPILL, NULL, ret, and UNPACK3.
|
static |
Definition at line 330 of file mathutils_geometry.c.
References float(), mathutils_array_parse_alloc_v(), MU_ARRAY_SPILL, normal_poly_v3(), NULL, ret, and Vector_CreatePyObject().
|
static |
Definition at line 1090 of file mathutils_geometry.c.
References float(), isect_planes_v3_fn(), mathutils_array_parse_alloc_v(), NULL, points_in_planes_fn(), PyTuple_SET_ITEMS, ret, and user_data.
|
static |
Definition at line 1214 of file mathutils_geometry.c.
References BKE_displist_fill(), BKE_displist_free(), BLI_addtail(), DispList::col, DL_INDEX3, DL_POLY, ListBase::first, DispList::index, mathutils_array_parse(), MEM_callocN, MEM_mallocN, MU_ARRAY_SPILL, DispList::nr, NULL, DispList::parts, PyC_Tuple_Pack_I32, DispList::type, UNLIKELY, and DispList::verts.
|
static |
Definition at line 408 of file mathutils_geometry.c.
References ARRAY_SIZE, mathutils_array_parse(), MU_ARRAY_SPILL, NULL, UNPACK4, UNPACK4_EX, and volume_tetrahedron_v3().
|
static |
Definition at line 1070 of file mathutils_geometry.c.
References NULL, user_data, and Vector_CreatePyObject().
Referenced by M_Geometry_points_in_planes().
PyDoc_STRVAR | ( | M_Geometry_area_tri_doc | , |
".. function:: area_tri(v1, v2, v3)\n" "\n" " Returns the area size of the 2D or 3D triangle defined.\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" " :rtype: float\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_barycentric_transform_doc | , |
".. function:: barycentric_transform(point, tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n" "\n" " Return a transformed | point, | ||
the transformation is defined by 2 triangles.\n" "\n" " :arg point:The point to transform.\n" " :type point::class:`mathutils.Vector`\n" " :arg tri_a1:source triangle vertex.\n" " :type tri_a1::class:`mathutils.Vector`\n" " :arg tri_a2:source triangle vertex.\n" " :type tri_a2::class:`mathutils.Vector`\n" " :arg tri_a3:source triangle vertex.\n" " :type tri_a3::class:`mathutils.Vector`\n" " :arg tri_b1:target triangle vertex.\n" " :type tri_b1::class:`mathutils.Vector`\n" " :arg tri_b2:target triangle vertex.\n" " :type tri_b2::class:`mathutils.Vector`\n" " :arg tri_b3:target triangle vertex.\n" " :type tri_b3::class:`mathutils.Vector`\n" " :return:The transformed point\n" " :rtype::class:`mathutils.Vector` 's\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_box_pack_2d_doc | , |
".. function:: box_pack_2d(boxes)\n" "\n" " Returns a tuple with the width and height of the packed bounding box.\n" "\n" " :arg boxes: list of | boxes, | ||
each box is a list where the first 4 items are other items are ignored.\n" " :type boxes:list\n" " :return:the width and height of the packed bounding box\n" " :rtype:tuple | [x, y, " "width, height,...], | ||
pair of floats\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_closest_point_on_tri_doc | , |
".. function:: closest_point_on_tri(pt, tri_p1, tri_p2, tri_p3)\n" "\n" " Takes 4 vectors: one is the point and the next 3 define the triangle.\n" "\n" " :arg pt: Point\n" " :type pt: :class:`mathutils.Vector`\n" " :arg tri_p1: First point of the triangle\n" " :type tri_p1: :class:`mathutils.Vector`\n" " :arg tri_p2: Second point of the triangle\n" " :type tri_p2: :class:`mathutils.Vector`\n" " :arg tri_p3: Third point of the triangle\n" " :type tri_p3: :class:`mathutils.Vector`\n" " :return: The closest point of the triangle.\n" " :rtype: :class:`mathutils.Vector`\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_distance_point_to_plane_doc | , |
".. function:: distance_point_to_plane(pt, plane_co, plane_no)\n" "\n" " Returns the signed distance between a point and a plane " " (negative when below the normal).\n" "\n" " :arg pt: Point\n" " :type pt: :class:`mathutils.Vector`\n" " :arg plane_co: A point on the plane\n" " :type plane_co: :class:`mathutils.Vector`\n" " :arg plane_no: The direction the plane is facing\n" " :type plane_no: :class:`mathutils.Vector`\n" " :rtype: float\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_doc | , |
"The Blender geometry module" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_interpolate_bezier_doc | , |
".. function:: interpolate_bezier(knot1, handle1, handle2, knot2, resolution)\n" "\n" " Interpolate a bezier spline segment.\n" "\n" " :arg knot1: First bezier spline point.\n" " :type knot1: :class:`mathutils.Vector`\n" " :arg handle1: First bezier spline handle.\n" " :type handle1: :class:`mathutils.Vector`\n" " :arg handle2: Second bezier spline handle.\n" " :type handle2: :class:`mathutils.Vector`\n" " :arg knot2: Second bezier spline point.\n" " :type knot2: :class:`mathutils.Vector`\n" " :arg resolution: Number of points to return.\n" " :type resolution: int\n" " :return: The interpolated points\n" " :rtype: list of :class:`mathutils.Vector`'s\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_intersect_line_line_2d_doc | , |
".. function:: intersect_line_line_2d(lineA_p1, lineA_p2, lineB_p1, lineB_p2)\n" "\n" " Takes 2 segments (defined by 4 vectors) and returns a vector for their point of " "intersection or None.\n" "\n" " .. warning:: Despite its | name, | ||
this function works on | segments, | ||
and not on lines.\n" "\n" " :arg lineA_p1:First point of the first line\n" " :type lineA_p1::class:`mathutils.Vector`\n" " :arg lineA_p2:Second point of the first line\n" " :type lineA_p2::class:`mathutils.Vector`\n" " :arg lineB_p1:First point of the second line\n" " :type lineB_p1::class:`mathutils.Vector`\n" " :arg lineB_p2:Second point of the second line\n" " :type lineB_p2::class:`mathutils.Vector`\n" " :return:The point of intersection or None when not found\n" " :rtype::class:`mathutils.Vector` or None\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_intersect_line_line_doc | , |
".. function:: intersect_line_line(v1, v2, v3, v4)\n" "\n" " Returns a tuple with the points on each line respectively closest to the other.\n" "\n" " :arg v1: First point of the first line\n" " :type v1: :class:`mathutils.Vector`\n" " :arg v2: Second point of the first line\n" " :type v2: :class:`mathutils.Vector`\n" " :arg v3: First point of the second line\n" " :type v3: :class:`mathutils.Vector`\n" " :arg v4: Second point of the second line\n" " :type v4: :class:`mathutils.Vector`\n" " :rtype: tuple of :class:`mathutils.Vector`'s\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_intersect_line_plane_doc | , |
".. function:: intersect_line_plane(line_a, line_b, plane_co, plane_no, no_flip=False)\n" "\n" " Calculate the intersection between a line (as 2 vectors) and a plane.\n" " Returns a vector for the intersection or None.\n" "\n" " :arg line_a: First point of the first line\n" " :type line_a: :class:`mathutils.Vector`\n" " :arg line_b: Second point of the first line\n" " :type line_b: :class:`mathutils.Vector`\n" " :arg plane_co: A point on the plane\n" " :type plane_co: :class:`mathutils.Vector`\n" " :arg plane_no: The direction the plane is facing\n" " :type plane_no: :class:`mathutils.Vector`\n" " :return: The point of intersection or None when not found\n" " :rtype: :class:`mathutils.Vector` or None\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_intersect_line_sphere_2d_doc | , |
".. function:: intersect_line_sphere_2d(line_a, line_b, sphere_co, sphere_radius, clip=True)\n" "\n" " Takes a line (as 2 points) and a sphere (as a point and a radius) and\n" " returns the intersection\n" "\n" " :arg line_a: First point of the line\n" " :type line_a: :class:`mathutils.Vector`\n" " :arg line_b: Second point of the line\n" " :type line_b: :class:`mathutils.Vector`\n" " :arg sphere_co: The center of the sphere\n" " :type sphere_co: :class:`mathutils.Vector`\n" " :arg sphere_radius: Radius of the sphere\n" " :type sphere_radius: sphere_radius\n" " :return: The intersection points as a pair of vectors or None when there is no " "intersection\n" " :rtype: A tuple pair containing :class:`mathutils.Vector` or None\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_intersect_line_sphere_doc | , |
".. function:: intersect_line_sphere(line_a, line_b, sphere_co, sphere_radius, clip=True)\n" "\n" " Takes a line (as 2 points) and a sphere (as a point and a radius) and\n" " returns the intersection\n" "\n" " :arg line_a: First point of the line\n" " :type line_a: :class:`mathutils.Vector`\n" " :arg line_b: Second point of the line\n" " :type line_b: :class:`mathutils.Vector`\n" " :arg sphere_co: The center of the sphere\n" " :type sphere_co: :class:`mathutils.Vector`\n" " :arg sphere_radius: Radius of the sphere\n" " :type sphere_radius: sphere_radius\n" " :return: The intersection points as a pair of vectors or None when there is no " "intersection\n" " :rtype: A tuple pair containing :class:`mathutils.Vector` or None\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_intersect_plane_plane_doc | , |
".. function:: intersect_plane_plane(plane_a_co, plane_a_no, plane_b_co, plane_b_no)\n" "\n" " Return the intersection between two planes\n" "\n" " :arg plane_a_co: Point on the first plane\n" " :type plane_a_co: :class:`mathutils.Vector`\n" " :arg plane_a_no: Normal of the first plane\n" " :type plane_a_no: :class:`mathutils.Vector`\n" " :arg plane_b_co: Point on the second plane\n" " :type plane_b_co: :class:`mathutils.Vector`\n" " :arg plane_b_no: Normal of the second plane\n" " :type plane_b_no: :class:`mathutils.Vector`\n" " :return: The line of the intersection represented as a point and a vector\n" " :rtype: tuple pair of :class:`mathutils.Vector` or None if the intersection can't be " "calculated\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_intersect_point_line_doc | , |
".. function:: intersect_point_line(pt, line_p1, line_p2)\n" "\n" " Takes a point and a line and returns a tuple with the closest point on the line and its " "distance from the first point of the line as a percentage of the length of the line.\n" "\n" " :arg pt: Point\n" " :type pt: :class:`mathutils.Vector`\n" " :arg line_p1: First point of the line\n" " :type line_p1: :class:`mathutils.Vector`\n" " :arg line_p1: Second point of the line\n" " :type line_p1: :class:`mathutils.Vector`\n" " :rtype: (:class:`mathutils.Vector`, float)\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_intersect_point_quad_2d_doc | , |
".. function:: intersect_point_quad_2d(pt, quad_p1, quad_p2, quad_p3, quad_p4)\n" "\n" " Takes 5 vectors (using only the x and y coordinates): one is the point and the " "next 4 define the | quad, | ||
\n" " only the x and y are used from the vectors. Returns 1 if the point is within the " " | quad, | ||
otherwise 0.\n" " Works only with convex quads without singular edges.\n" "\n" " :arg pt:Point\n" " :type pt::class:`mathutils.Vector`\n" " :arg quad_p1:First point of the quad\n" " :type quad_p1::class:`mathutils.Vector`\n" " :arg quad_p2:Second point of the quad\n" " :type quad_p2::class:`mathutils.Vector`\n" " :arg quad_p3:Third point of the quad\n" " :type quad_p3::class:`mathutils.Vector`\n" " :arg quad_p4:Fourth point of the quad\n" " :type quad_p4::class:`mathutils.Vector`\n" " :rtype:int\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_intersect_point_tri_2d_doc | , |
".. function:: intersect_point_tri_2d(pt, tri_p1, tri_p2, tri_p3)\n" "\n" " Takes 4 vectors (using only the x and y coordinates): one is the point and the next 3 " "define the triangle. Returns 1 if the point is within the | triangle, | ||
otherwise 0.\n" "\n" " :arg pt:Point\n" " :type pt::class:`mathutils.Vector`\n" " :arg tri_p1:First point of the triangle\n" " :type tri_p1::class:`mathutils.Vector`\n" " :arg tri_p2:Second point of the triangle\n" " :type tri_p2::class:`mathutils.Vector`\n" " :arg tri_p3:Third point of the triangle\n" " :type tri_p3::class:`mathutils.Vector`\n" " :rtype:int\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_intersect_point_tri_doc | , |
".. function:: intersect_point_tri(pt, tri_p1, tri_p2, tri_p3)\n" "\n" " Takes 4 vectors: one is the point and the next 3 define the triangle. Projects " "the point onto the triangle plane and checks if it is within the triangle.\n" "\n" " :arg pt: Point\n" " :type pt: :class:`mathutils.Vector`\n" " :arg tri_p1: First point of the triangle\n" " :type tri_p1: :class:`mathutils.Vector`\n" " :arg tri_p2: Second point of the triangle\n" " :type tri_p2: :class:`mathutils.Vector`\n" " :arg tri_p3: Third point of the triangle\n" " :type tri_p3: :class:`mathutils.Vector`\n" " :return: Point on the triangles plane or None if its outside the triangle\n" " :rtype: :class:`mathutils.Vector` or None\n" | |||
) |
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:boolean\n" " :return:The point of intersection or None if no intersection is found\n" " :rtype::class:`mathutils.Vector` or None\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_intersect_sphere_sphere_2d_doc | , |
".. function:: intersect_sphere_sphere_2d(p_a, radius_a, p_b, radius_b)\n" "\n" " Returns 2 points on between intersecting circles.\n" "\n" " :arg p_a: Center of the first circle\n" " :type p_a: :class:`mathutils.Vector`\n" " :arg radius_a: Radius of the first circle\n" " :type radius_a: float\n" " :arg p_b: Center of the second circle\n" " :type p_b: :class:`mathutils.Vector`\n" " :arg radius_b: Radius of the second circle\n" " :type radius_b: float\n" " :rtype: tuple of :class:`mathutils.Vector`'s or None when there is no intersection\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_intersect_tri_tri_2d_doc | , |
".. function:: intersect_tri_tri_2d(tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n" "\n" " Check if two 2D triangles intersect.\n" "\n" " :rtype: bool\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_normal_doc | , |
".. function:: normal(vectors)\n" "\n" " Returns the normal of a 3D polygon.\n" "\n" " :arg vectors: Vectors to calculate normals with\n" " :type vectors: sequence of 3 or more 3d vector\n" " :rtype: :class:`mathutils.Vector`\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_points_in_planes_doc | , |
".. function:: points_in_planes(planes)\n" "\n" " Returns a list of points inside all planes given and a list of index values for " "the planes used.\n" "\n" " :arg planes: List of planes (4D vectors).\n" " :type planes: list of :class:`mathutils.Vector`\n" " :return: two | lists, | ||
once containing the vertices inside the | planes, | ||
another " "containing the plane indices used\n" " :rtype:pair of lists\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_tessellate_polygon_doc | , |
".. function:: tessellate_polygon(veclist_list)\n" "\n" " Takes a list of polylines (each point a pair or triplet of numbers) and returns " "the point indices for a polyline filled with triangles. Does not handle degenerate " "geometry (such as zero-length lines due to consecutive identical points).\n" "\n" " :arg veclist_list: list of polylines\n" " :rtype: list\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_volume_tetrahedron_doc | , |
".. function:: volume_tetrahedron(v1, v2, v3, v4)\n" "\n" " Return the volume formed by a tetrahedron (points can be in any order).\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 v4: Point4\n" " :type v4: :class:`mathutils.Vector`\n" " :rtype: float\n" | |||
) |