Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-12-10 03:20:32 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-10 03:20:32 +0300
commitb4081bfc7beecf45d58137885c6abac81e3fb27b (patch)
tree493d7521006bafbe90f8da21454c8d6440c3b199 /source/blender/python
parent2ed82275b5738255f3830b25c5a7375501246911 (diff)
patch [#25027] formatting mathutils.geometry module docs for sphinx
from Luka Bonavita See: http://www.blender.org/documentation/250PythonDoc/mathutils.geometry.html
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/generic/blf_py_api.c2
-rw-r--r--source/blender/python/generic/mathutils_geometry.c156
2 files changed, 146 insertions, 12 deletions
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index bd8512ff2d7..380f2e456bd 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -367,7 +367,7 @@ struct PyMethodDef BLF_methods[] = {
{"dimensions", (PyCFunction) py_blf_dimensions, METH_VARARGS, py_blf_dimensions_doc},
{"draw", (PyCFunction) py_blf_draw, METH_VARARGS, py_blf_draw_doc},
{"enable", (PyCFunction) py_blf_enable, METH_VARARGS, py_blf_enable_doc},
- {"position", (PyCFunction)py_blf_position, METH_VARARGS, py_blf_position_doc},
+ {"position", (PyCFunction) py_blf_position, METH_VARARGS, py_blf_position_doc},
{"rotation", (PyCFunction) py_blf_rotation, METH_VARARGS, py_blf_rotation_doc},
{"shadow", (PyCFunction) py_blf_shadow, METH_VARARGS, py_blf_shadow_doc},
{"shadow_offset", (PyCFunction) py_blf_shadow_offset, METH_VARARGS, py_blf_shadow_offset_doc},
diff --git a/source/blender/python/generic/mathutils_geometry.c b/source/blender/python/generic/mathutils_geometry.c
index 4a98a421650..673ce87d9ce 100644
--- a/source/blender/python/generic/mathutils_geometry.c
+++ b/source/blender/python/generic/mathutils_geometry.c
@@ -45,18 +45,152 @@
/*-------------------------DOC STRINGS ---------------------------*/
static char M_Geometry_doc[] = "The Blender geometry module\n\n";
-static char M_Geometry_Intersect_doc[] = "(v1, v2, v3, ray, orig, clip=1) - returns the intersection between a ray and a triangle, if possible, returns None otherwise";
-static char M_Geometry_TriangleArea_doc[] = "(v1, v2, v3) - returns the area size of the 2D or 3D triangle defined";
-static char M_Geometry_TriangleNormal_doc[] = "(v1, v2, v3) - returns the normal of the 3D triangle defined";
-static char M_Geometry_QuadNormal_doc[] = "(v1, v2, v3, v4) - returns the normal of the 3D quad defined";
-static char M_Geometry_LineIntersect_doc[] = "(v1, v2, v3, v4) - returns a tuple with the points on each line respectively closest to the other";
-static char M_Geometry_PolyFill_doc[] = "(veclist_list) - takes a list of polylines (each point a vector) and returns the point indicies for a polyline filled with triangles";
-static char M_Geometry_LineIntersect2D_doc[] = "(lineA_p1, lineA_p2, lineB_p1, lineB_p2) - takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None";
-static char M_Geometry_ClosestPointOnLine_doc[] = "(pt, line_p1, line_p2) - takes a point and a line and returns a (Vector, float) for the point on the line, and the bool so you can know if the point was between the 2 points";
-static char M_Geometry_PointInTriangle2D_doc[] = "(pt, tri_p1, tri_p2, tri_p3) - takes 4 vectors, one is the point and the next 3 define the triangle, only the x and y are used from the vectors";
-static char M_Geometry_PointInQuad2D_doc[] = "(pt, quad_p1, quad_p2, quad_p3, quad_p4) - takes 5 vectors, one is the point and the next 4 define the quad, only the x and y are used from the vectors";
+static char M_Geometry_Intersect_doc[] =
+".. function:: Intersect(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"
+" :rtype: boolean\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: Clip by the ray length\n"
+" :type clip: boolean\n";
+
+static char M_Geometry_TriangleArea_doc[] =
+".. function:: TriangleArea(v1, v2, v3)\n"
+"\n"
+" Returns the area size of the 2D or 3D triangle defined.\n"
+"\n"
+" :rtype: float\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";
+
+static char M_Geometry_TriangleNormal_doc[] =
+".. function:: TriangleNormal(v1, v2, v3)\n"
+"\n"
+" Returns the normal of the 3D triangle defined.\n"
+"\n"
+" :rtype: :class:`mathutils.Vector`\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";
+
+static char M_Geometry_QuadNormal_doc[] =
+".. function:: QuadNormal(v1, v2, v3, v4)\n"
+"\n"
+" Returns the normal of the 3D quad defined.\n"
+"\n"
+" :rtype: :class:`mathutils.Vector`\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";
+
+static char M_Geometry_LineIntersect_doc[] =
+".. function:: LineIntersect(v1, v2, v3, v4)\n"
+"\n"
+" Returns a tuple with the points on each line respectively closest to the other.\n"
+"\n"
+" :rtype: tuple with elements being of type :class:`mathutils.Vector`\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";
+
+static char M_Geometry_PolyFill_doc[] =
+".. function:: PolyFill(veclist_list)\n"
+"\n"
+" Takes a list of polylines (each point a vector) and returns the point indicies for a polyline filled with triangles.\n"
+"\n"
+" :rtype: list\n"
+" :arg veclist_list: list of polylines\n";
+
+static char M_Geometry_LineIntersect2D_doc[] =
+".. function:: LineIntersect2D(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"
+" :rtype: :class:`mathutils.Vector`\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";
+
+static char M_Geometry_ClosestPointOnLine_doc[] =
+".. function:: ClosestPointOnLine(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"
+" :rtype: (:class:`mathutils.Vector`, float)\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";
+
+static char M_Geometry_PointInTriangle2D_doc[] =
+".. function:: PointInTriangle2D(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"
+" :rtype: int\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";
+
+static char M_Geometry_PointInQuad2D_doc[] =
+".. function:: PointInQuad2D(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, only the x and y are used from the vectors. Returns 1 if the point is within the quad, otherwise 0.\n"
+"\n"
+" :rtype: int\n"
+" :arg pt: Point\n"
+" :type v1: :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";
+
static char M_Geometry_BoxPack2D_doc[] = "";
static char M_Geometry_BezierInterp_doc[] = "";
+static char M_Geometry_BarycentricTransform_doc[] = "";
//---------------------------------INTERSECTION FUNCTIONS--------------------
//----------------------------------geometry.Intersect() -------------------
@@ -813,7 +947,7 @@ struct PyMethodDef M_Geometry_methods[] = {
{"PointInQuad2D", ( PyCFunction ) M_Geometry_PointInQuad2D, METH_VARARGS, M_Geometry_PointInQuad2D_doc},
{"BoxPack2D", ( PyCFunction ) M_Geometry_BoxPack2D, METH_O, M_Geometry_BoxPack2D_doc},
{"BezierInterp", ( PyCFunction ) M_Geometry_BezierInterp, METH_VARARGS, M_Geometry_BezierInterp_doc},
- {"BarycentricTransform", ( PyCFunction ) M_Geometry_BarycentricTransform, METH_VARARGS, NULL},
+ {"BarycentricTransform", ( PyCFunction ) M_Geometry_BarycentricTransform, METH_VARARGS, M_Geometry_BarycentricTransform_doc},
{NULL, NULL, 0, NULL}
};