Blender  V3.3
Classes | Functions
mathutils_geometry.c File Reference
#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)
 

Function Documentation

◆ boxPack_FromPyObject()

static int boxPack_FromPyObject ( PyObject *  value,
BoxPack **  r_boxarray 
)
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().

◆ boxPack_ToPyObject()

static void boxPack_ToPyObject ( PyObject *  value,
const BoxPack boxarray 
)
static

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().

◆ M_Geometry_area_tri()

static PyObject* M_Geometry_area_tri ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_barycentric_transform()

static PyObject* M_Geometry_barycentric_transform ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_box_pack_2d()

static PyObject* M_Geometry_box_pack_2d ( PyObject *  UNUSEDself,
PyObject *  boxlist 
)
static

◆ M_Geometry_closest_point_on_tri()

static PyObject* M_Geometry_closest_point_on_tri ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_distance_point_to_plane()

static PyObject* M_Geometry_distance_point_to_plane ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_interpolate_bezier()

static PyObject* M_Geometry_interpolate_bezier ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_intersect_line_line()

static PyObject* M_Geometry_intersect_line_line ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_intersect_line_line_2d()

static PyObject* M_Geometry_intersect_line_line_2d ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_intersect_line_plane()

static PyObject* M_Geometry_intersect_line_plane ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_intersect_line_sphere()

static PyObject* M_Geometry_intersect_line_sphere ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_intersect_line_sphere_2d()

static PyObject* M_Geometry_intersect_line_sphere_2d ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_intersect_plane_plane()

static PyObject* M_Geometry_intersect_plane_plane ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_intersect_point_line()

static PyObject* M_Geometry_intersect_point_line ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_intersect_point_quad_2d()

static PyObject* M_Geometry_intersect_point_quad_2d ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_intersect_point_tri()

static PyObject* M_Geometry_intersect_point_tri ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_intersect_point_tri_2d()

static PyObject* M_Geometry_intersect_point_tri_2d ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_intersect_ray_tri()

static PyObject* M_Geometry_intersect_ray_tri ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_intersect_sphere_sphere_2d()

static PyObject* M_Geometry_intersect_sphere_sphere_2d ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_intersect_tri_tri_2d()

static PyObject* M_Geometry_intersect_tri_tri_2d ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_normal()

static PyObject* M_Geometry_normal ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_points_in_planes()

static PyObject* M_Geometry_points_in_planes ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ M_Geometry_tessellate_polygon()

static PyObject* M_Geometry_tessellate_polygon ( PyObject *  UNUSEDself,
PyObject *  polyLineSeq 
)
static

◆ M_Geometry_volume_tetrahedron()

static PyObject* M_Geometry_volume_tetrahedron ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

◆ points_in_planes_fn()

static void points_in_planes_fn ( const float  co[3],
int  i,
int  j,
int  k,
void user_data_p 
)
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() [1/24]

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() [2/24]

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() [3/24]

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() [4/24]

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() [5/24]

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() [6/24]

PyDoc_STRVAR ( M_Geometry_doc  ,
"The Blender geometry module  
)

◆ PyDoc_STRVAR() [7/24]

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() [8/24]

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() [9/24]

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() [10/24]

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() [11/24]

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() [12/24]

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() [13/24]

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() [14/24]

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() [15/24]

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() [16/24]

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() [17/24]

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() [18/24]

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() [19/24]

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() [20/24]

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() [21/24]

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() [22/24]

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() [23/24]

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() [24/24]

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"   
)