Blender V2.61 - r43446
|
#include <Python.h>
#include "mathutils_geometry.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_boxpack2d.h"
#include "BKE_displist.h"
#include "BKE_curve.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
Go to the source code of this file.
Defines | |
#define | SWAP_FLOAT(a, b, tmp) tmp = a; a = b; b = tmp |
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_normal_doc,".. function:: normal(v1, v2, v3, v4=None)\n""\n"" Returns the normal of the 3D tri or quad.\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 (optional)\n"" :type v4: :class:`mathutils.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_intersect_line_line_2d_doc,".. function:: intersect_line_line_2d(lineA_p1, lineA_p2, lineB_p1, lineB_p2)\n""\n"" Takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None.\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"" Takes 2 lines (as 4 vectors) and returns a vector for their point of 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"" :arg no_flip: Always return an intersection on the directon defined bt line_a -> line_b\n"" :type no_flip: :boolean\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`\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 lines (as 2 vectors), a sphere as a point and a radius and\n"" returns the intersection\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 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 lines (as 2 vectors), a sphere as a point and a radius and\n"" returns the intersection\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 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_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 v1: :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""\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: Forth 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: First point of the quad\n"" :type plane_co: :class:`mathutils.Vector`\n"" :arg plane_no: Second point of the quad\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_a1: target triangle vertex.\n"" :type tri_a1: :class:`mathutils.Vector`\n"" :arg tri_a2: target triangle vertex.\n"" :type tri_a2: :class:`mathutils.Vector`\n"" :arg tri_a3: target triangle vertex.\n"" :type tri_a3: :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) |
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_tesselate_polygon_doc,".. function:: tesselate_polygon(veclist_list)\n""\n"" Takes a list of polylines (each point a vector) and returns the point indices for a polyline filled with triangles.\n""\n"" :arg veclist_list: list of polylines\n"" :rtype: list\n") | |
static PyObject * | M_Geometry_tesselate_polygon (PyObject *UNUSED(self), PyObject *polyLineSeq) |
static int | boxPack_FromPyObject (PyObject *value, boxPack **boxarray) |
static void | boxPack_ToPyObject (PyObject *value, boxPack **boxarray) |
PyDoc_STRVAR (M_Geometry_box_pack_2d_doc,".. function:: box_pack_2d(boxes)\n""\n"" Returns the normal of the 3D tri or quad.\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) |
PyMODINIT_FUNC | PyInit_mathutils_geometry (void) |
Variables | |
static PyMethodDef | M_Geometry_methods [] |
static struct PyModuleDef | M_Geometry_module_def |
Definition in file mathutils_geometry.c.
#define SWAP_FLOAT | ( | a, | |
b, | |||
tmp | |||
) | tmp = a; a = b; b = tmp |
Definition at line 50 of file mathutils_geometry.c.
static int boxPack_FromPyObject | ( | PyObject * | value, |
boxPack ** | boxarray | ||
) | [static] |
Definition at line 1153 of file mathutils_geometry.c.
References boxPack::h, i, boxPack::index, len(), MEM_freeN(), MEM_mallocN(), and boxPack::w.
Referenced by M_Geometry_box_pack_2d().
static void boxPack_ToPyObject | ( | PyObject * | value, |
boxPack ** | boxarray | ||
) | [static] |
Definition at line 1204 of file mathutils_geometry.c.
References i, boxPack::index, len(), MEM_freeN(), boxPack::x, and boxPack::y.
Referenced by M_Geometry_box_pack_2d().
static PyObject* M_Geometry_area_tri | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 359 of file mathutils_geometry.c.
References area_tri_v2(), area_tri_v3(), BaseMath_ReadCallback, NULL, VectorObject::size, and vector_Type.
static PyObject* M_Geometry_barycentric_transform | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 907 of file mathutils_geometry.c.
References barycentric_transform(), NULL, Py_NEW, VectorObject::size, Vector_CreatePyObject(), and vector_Type.
static PyObject* M_Geometry_box_pack_2d | ( | PyObject * | UNUSEDself, |
PyObject * | boxlist | ||
) | [static] |
Definition at line 1231 of file mathutils_geometry.c.
References boxPack2D(), boxPack_FromPyObject(), boxPack_ToPyObject(), len(), and NULL.
static PyObject* M_Geometry_distance_point_to_plane | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 863 of file mathutils_geometry.c.
References BaseMath_ReadCallback, dist_to_plane_v3(), NULL, and vector_Type.
static PyObject* M_Geometry_interpolate_bezier | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 966 of file mathutils_geometry.c.
References BaseMath_ReadCallback, forward_diff_bezier(), i, MAX4, MEM_callocN(), MEM_freeN(), NULL, Py_NEW, VectorObject::size, Vector_CreatePyObject(), and vector_Type.
static PyObject* M_Geometry_intersect_line_line | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 181 of file mathutils_geometry.c.
References BaseMath_ReadCallback, copy_v3_v3(), isect_line_line_v3(), NULL, Py_NEW, VectorObject::size, Vector_CreatePyObject(), and vector_Type.
static PyObject* M_Geometry_intersect_line_line_2d | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 414 of file mathutils_geometry.c.
References BaseMath_ReadCallback, isect_seg_seg_v2_point(), NULL, Py_NEW, Vector_CreatePyObject(), and vector_Type.
static PyObject* M_Geometry_intersect_line_plane | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 462 of file mathutils_geometry.c.
References BaseMath_ReadCallback, ELEM4, isect_line_plane_v3(), NULL, Py_NEW, VectorObject::size, Vector_CreatePyObject(), and vector_Type.
static PyObject* M_Geometry_intersect_line_sphere | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 577 of file mathutils_geometry.c.
References BaseMath_ReadCallback, ELEM3, FALSE, isect_line_sphere_v3(), line_point_factor_v3(), NULL, Py_NEW, VectorObject::size, TRUE, Vector_CreatePyObject(), and vector_Type.
static PyObject* M_Geometry_intersect_line_sphere_2d | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 657 of file mathutils_geometry.c.
References BaseMath_ReadCallback, FALSE, isect_line_sphere_v2(), line_point_factor_v2(), NULL, Py_NEW, TRUE, Vector_CreatePyObject(), and vector_Type.
static PyObject* M_Geometry_intersect_plane_plane | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 516 of file mathutils_geometry.c.
References BaseMath_ReadCallback, ELEM4, isect_plane_plane_v3(), normalize_v3(), NULL, Py_NEW, VectorObject::size, Vector_CreatePyObject(), and vector_Type.
static PyObject* M_Geometry_intersect_point_line | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 725 of file mathutils_geometry.c.
References BaseMath_ReadCallback, closest_to_line_v3(), copy_v2_v2(), copy_v3_v3(), NULL, Py_NEW, VectorObject::size, Vector_CreatePyObject(), and vector_Type.
static PyObject* M_Geometry_intersect_point_quad_2d | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 823 of file mathutils_geometry.c.
References BaseMath_ReadCallback, isect_point_quad_v2(), NULL, and vector_Type.
static PyObject* M_Geometry_intersect_point_tri_2d | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 781 of file mathutils_geometry.c.
References BaseMath_ReadCallback, isect_point_tri_v2(), NULL, and vector_Type.
static PyObject* M_Geometry_intersect_ray_tri | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 79 of file mathutils_geometry.c.
References add_v3_v3v3(), BaseMath_ReadCallback, copy_v3_v3(), cross_v3_v3v3(), dot_v3v3(), mul_v3_fl(), normalize_v3(), NULL, Py_NEW, VectorObject::size, sub_v3_v3v3(), Vector_CreatePyObject(), and vector_Type.
static PyObject* M_Geometry_normal | ( | PyObject * | UNUSEDself, |
PyObject * | args | ||
) | [static] |
Definition at line 276 of file mathutils_geometry.c.
References BaseMath_ReadCallback, normal_quad_v3(), normal_tri_v3(), NULL, Py_NEW, VectorObject::size, Vector_CreatePyObject(), and vector_Type.
static PyObject* M_Geometry_tesselate_polygon | ( | PyObject * | UNUSEDself, |
PyObject * | polyLineSeq | ||
) | [static] |
Definition at line 1035 of file mathutils_geometry.c.
References BaseMath_ReadCallback, BLI_addtail(), DispList::col, DL_INDEX3, DL_POLY, filldisplist(), ListBase::first, freedisplist(), i, DispList::index, MEM_callocN(), DispList::nr, NULL, DispList::parts, size(), DispList::type, vector_Type, VectorObject_Check, and DispList::verts.
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_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_box_pack_2d_doc | , |
".. function:: box_pack_2d(boxes)\n""\n"" Returns the normal of the 3D tri or quad.\n""\n"" :arg boxes: list of | boxes, | ||
each box is a list where the first 4 items areother 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_intersect_line_sphere_2d_doc | , |
".. function:: | intersect_line_sphere_2dline_a, line_b, sphere_co, sphere_radius, clip=True)\n""\n"" Takes a lines (as 2 vectors, | ||
a sphere as a point and a radius and\n""returns the intersection\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 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`\n" | |||
) |
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_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_a1:target triangle vertex.\n"":type tri_a1::class:`mathutils.Vector`\n"":arg tri_a2:target triangle vertex.\n"":type tri_a2::class:`mathutils.Vector`\n"":arg tri_a3:target triangle vertex.\n"":type tri_a3::class:`mathutils.Vector`\n"":return:The transformed point\n"":rtype::class:`mathutils.Vector`'s\n" | |||
) |
PyDoc_STRVAR | ( | M_Geometry_intersect_line_sphere_doc | , |
".. function:: | intersect_line_sphereline_a, line_b, sphere_co, sphere_radius, clip=True)\n""\n"" Takes a lines (as 2 vectors, | ||
a sphere as a point and a radius and\n""returns the intersection\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 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_line_2d_doc | , |
".. function:: intersect_line_line_2d(lineA_p1, lineA_p2, lineB_p1, lineB_p2)\n""\n"" Takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None.\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_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 v1::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_tesselate_polygon_doc | , |
".. function:: tesselate_polygon(veclist_list)\n""\n"" Takes a list of polylines (each point a vector) and returns the point indices for a polyline filled with triangles.\n""\n"" :arg veclist_list: list of polylines\n"" :rtype: list\n" | |||
) |
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" | |||
) |
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_normal_doc | , |
".. function:: normal(v1, v2, v3, v4=None)\n""\n"" Returns the normal of the 3D tri or quad.\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 (optional)\n"" :type v4: :class:`mathutils.Vector`\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: First point of the quad\n"" :type plane_co: :class:`mathutils.Vector`\n"" :arg plane_no: Second point of the quad\n"" :type plane_no: :class:`mathutils.Vector`\n"" :rtype: 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""\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:Forth point of the quad\n"":type quad_p4::class:`mathutils.Vector`\n"":rtype:int\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"" Takes 2 lines (as 4 vectors) and returns a vector for their point of 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"" :arg no_flip: Always return an intersection on the directon defined bt line_a -> line_b\n"" :type no_flip: :boolean\n"" :return: The point of intersection or None when not found\n"" :rtype: :class:`mathutils.Vector` or None\n" | |||
) |
PyMODINIT_FUNC PyInit_mathutils_geometry | ( | void | ) |
Definition at line 1302 of file mathutils_geometry.c.
Referenced by PyInit_mathutils().
PyMethodDef M_Geometry_methods[] [static] |
{ {"intersect_ray_tri", (PyCFunction) M_Geometry_intersect_ray_tri, METH_VARARGS, M_Geometry_intersect_ray_tri_doc}, {"intersect_point_line", (PyCFunction) M_Geometry_intersect_point_line, METH_VARARGS, M_Geometry_intersect_point_line_doc}, {"intersect_point_tri_2d", (PyCFunction) M_Geometry_intersect_point_tri_2d, METH_VARARGS, M_Geometry_intersect_point_tri_2d_doc}, {"intersect_point_quad_2d", (PyCFunction) M_Geometry_intersect_point_quad_2d, METH_VARARGS, M_Geometry_intersect_point_quad_2d_doc}, {"intersect_line_line", (PyCFunction) M_Geometry_intersect_line_line, METH_VARARGS, M_Geometry_intersect_line_line_doc}, {"intersect_line_line_2d", (PyCFunction) M_Geometry_intersect_line_line_2d, METH_VARARGS, M_Geometry_intersect_line_line_2d_doc}, {"intersect_line_plane", (PyCFunction) M_Geometry_intersect_line_plane, METH_VARARGS, M_Geometry_intersect_line_plane_doc}, {"intersect_plane_plane", (PyCFunction) M_Geometry_intersect_plane_plane, METH_VARARGS, M_Geometry_intersect_plane_plane_doc}, {"intersect_line_sphere", (PyCFunction) M_Geometry_intersect_line_sphere, METH_VARARGS, M_Geometry_intersect_line_sphere_doc}, {"intersect_line_sphere_2d", (PyCFunction) M_Geometry_intersect_line_sphere_2d, METH_VARARGS, M_Geometry_intersect_line_sphere_2d_doc}, {"distance_point_to_plane", (PyCFunction) M_Geometry_distance_point_to_plane, METH_VARARGS, M_Geometry_distance_point_to_plane_doc}, {"area_tri", (PyCFunction) M_Geometry_area_tri, METH_VARARGS, M_Geometry_area_tri_doc}, {"normal", (PyCFunction) M_Geometry_normal, METH_VARARGS, M_Geometry_normal_doc}, {"barycentric_transform", (PyCFunction) M_Geometry_barycentric_transform, METH_VARARGS, M_Geometry_barycentric_transform_doc}, {"interpolate_bezier", (PyCFunction) M_Geometry_interpolate_bezier, METH_VARARGS, M_Geometry_interpolate_bezier_doc}, {"tesselate_polygon", (PyCFunction) M_Geometry_tesselate_polygon, METH_O, M_Geometry_tesselate_polygon_doc}, {"box_pack_2d", (PyCFunction) M_Geometry_box_pack_2d, METH_O, M_Geometry_box_pack_2d_doc}, {NULL, NULL, 0, NULL} }
Definition at line 1266 of file mathutils_geometry.c.
struct PyModuleDef M_Geometry_module_def [static] |
{ PyModuleDef_HEAD_INIT, "mathutils.geometry", M_Geometry_doc, 0, M_Geometry_methods, NULL, NULL, NULL, NULL, }
Definition at line 1289 of file mathutils_geometry.c.