[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33992] trunk/blender: geometry module
Campbell Barton
ideasman42 at gmail.com
Sun Jan 2 03:11:38 CET 2011
Revision: 33992
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33992
Author: campbellbarton
Date: 2011-01-02 03:11:38 +0100 (Sun, 02 Jan 2011)
Log Message:
-----------
geometry module
- rename functions from camel case.
- added docs for undocumented methods.
- minor functional changes with exceptions and accepting 3d/4d vectors where it makes no difference.
Renamed:
- geometry.Intersect -> intersect_ray_tri
- geometry.ClosestPointOnLine -> intersect_point_line
- geometry.PointInTriangle2D -> intersect_point_tri_2d
- geometry.PointInQuad2D -> intersect_point_quad_2d
- geometry.LineIntersect -> intersect_line_line
- geometry.LineIntersect2D -> intersect_line_line_2d
- geometry.BezierInterp -> interpolate_bezier
- geometry.TriangleArea -> area_tri
- geometry.QuadNormal, TriangleNormal -> normal
- geometry.PolyFill -> tesselate_polygon
- geometry.BoxPack2D -> box_pack_2d
- geometry.BarycentricTransform -> barycentric_transform
Modified Paths:
--------------
trunk/blender/release/scripts/op/io_scene_obj/import_obj.py
trunk/blender/release/scripts/op/object.py
trunk/blender/release/scripts/op/uvcalc_smart_project.py
trunk/blender/source/blender/python/generic/mathutils.c
trunk/blender/source/blender/python/generic/mathutils_geometry.c
Modified: trunk/blender/release/scripts/op/io_scene_obj/import_obj.py
===================================================================
--- trunk/blender/release/scripts/op/io_scene_obj/import_obj.py 2011-01-01 23:53:48 UTC (rev 33991)
+++ trunk/blender/release/scripts/op/io_scene_obj/import_obj.py 2011-01-02 02:11:38 UTC (rev 33992)
@@ -35,7 +35,7 @@
import time
import bpy
import mathutils
-from mathutils.geometry import PolyFill
+from mathutils.geometry import tesselate_polygon
from io_utils import load_image, unpack_list, unpack_face_list
@@ -84,7 +84,7 @@
if verts[i][1]==verts[i-1][0]:
verts.pop(i-1)
- fill= PolyFill([verts])
+ fill= fill_polygon([verts])
else:
'''
@@ -192,7 +192,7 @@
vert_map[i+ii]= vert[2]
ii+=len(verts)
- fill= PolyFill([ [v[0] for v in loop] for loop in loop_list ])
+ fill= tesselate_polygon([ [v[0] for v in loop] for loop in loop_list ])
#draw_loops(loop_list)
#raise 'done loop'
# map to original indicies
Modified: trunk/blender/release/scripts/op/object.py
===================================================================
--- trunk/blender/release/scripts/op/object.py 2011-01-01 23:53:48 UTC (rev 33991)
+++ trunk/blender/release/scripts/op/object.py 2011-01-02 02:11:38 UTC (rev 33992)
@@ -257,7 +257,7 @@
ob.active_shape_key_index = len(me.shape_keys.keys) - 1
ob.show_only_shape_key = True
- from mathutils.geometry import BarycentricTransform
+ from mathutils.geometry import barycentric_transform
from mathutils import Vector
if use_clamp and mode == 'OFFSET':
@@ -300,38 +300,38 @@
for face in me.faces:
i1, i2, i3, i4 = face.vertices_raw
if i4 != 0:
- pt = BarycentricTransform(orig_shape_coords[i1],
+ pt = barycentric_transform(orig_shape_coords[i1],
orig_coords[i4], orig_coords[i1], orig_coords[i2],
target_coords[i4], target_coords[i1], target_coords[i2])
median_coords[i1].append(pt)
- pt = BarycentricTransform(orig_shape_coords[i2],
+ pt = barycentric_transform(orig_shape_coords[i2],
orig_coords[i1], orig_coords[i2], orig_coords[i3],
target_coords[i1], target_coords[i2], target_coords[i3])
median_coords[i2].append(pt)
- pt = BarycentricTransform(orig_shape_coords[i3],
+ pt = barycentric_transform(orig_shape_coords[i3],
orig_coords[i2], orig_coords[i3], orig_coords[i4],
target_coords[i2], target_coords[i3], target_coords[i4])
median_coords[i3].append(pt)
- pt = BarycentricTransform(orig_shape_coords[i4],
+ pt = barycentric_transform(orig_shape_coords[i4],
orig_coords[i3], orig_coords[i4], orig_coords[i1],
target_coords[i3], target_coords[i4], target_coords[i1])
median_coords[i4].append(pt)
else:
- pt = BarycentricTransform(orig_shape_coords[i1],
+ pt = barycentric_transform(orig_shape_coords[i1],
orig_coords[i3], orig_coords[i1], orig_coords[i2],
target_coords[i3], target_coords[i1], target_coords[i2])
median_coords[i1].append(pt)
- pt = BarycentricTransform(orig_shape_coords[i2],
+ pt = barycentric_transform(orig_shape_coords[i2],
orig_coords[i1], orig_coords[i2], orig_coords[i3],
target_coords[i1], target_coords[i2], target_coords[i3])
median_coords[i2].append(pt)
- pt = BarycentricTransform(orig_shape_coords[i3],
+ pt = barycentric_transform(orig_shape_coords[i3],
orig_coords[i2], orig_coords[i3], orig_coords[i1],
target_coords[i2], target_coords[i3], target_coords[i1])
median_coords[i3].append(pt)
@@ -350,12 +350,12 @@
n1loc_to = v1_to + target_normals[i1] * edlen_to
n2loc_to = v2_to + target_normals[i2] * edlen_to
- pt = BarycentricTransform(orig_shape_coords[i1],
+ pt = barycentric_transform(orig_shape_coords[i1],
v2, v1, n1loc,
v2_to, v1_to, n1loc_to)
median_coords[i1].append(pt)
- pt = BarycentricTransform(orig_shape_coords[i2],
+ pt = barycentric_transform(orig_shape_coords[i2],
v1, v2, n2loc,
v1_to, v2_to, n2loc_to)
median_coords[i2].append(pt)
Modified: trunk/blender/release/scripts/op/uvcalc_smart_project.py
===================================================================
--- trunk/blender/release/scripts/op/uvcalc_smart_project.py 2011-01-01 23:53:48 UTC (rev 33991)
+++ trunk/blender/release/scripts/op/uvcalc_smart_project.py 2011-01-02 02:11:38 UTC (rev 33992)
@@ -225,7 +225,7 @@
# Edge intersect test
for ed in edgeLoopsSource:
for seg in edgeLoopsTarget:
- i = geometry.LineIntersect2D(\
+ i = geometry.intersect_line_line_2d(\
seg[0], seg[1], SourceOffset+ed[0], SourceOffset+ed[1])
if i:
return 1 # LINE INTERSECTION
@@ -739,7 +739,7 @@
#XXX Window.DrawProgressBar(0.7, 'Packing %i UV Islands...' % len(packBoxes) )
time1 = time.time()
- packWidth, packHeight = geometry.BoxPack2D(packBoxes)
+ packWidth, packHeight = geometry.box_pack_2d(packBoxes)
# print 'Box Packing Time:', time.time() - time1
Modified: trunk/blender/source/blender/python/generic/mathutils.c
===================================================================
--- trunk/blender/source/blender/python/generic/mathutils.c 2011-01-01 23:53:48 UTC (rev 33991)
+++ trunk/blender/source/blender/python/generic/mathutils.c 2011-01-02 02:11:38 UTC (rev 33992)
@@ -55,6 +55,18 @@
* - Mathutils.OrthoProjectionMatrix -> mathutils.Matrix.OrthoProjection
*
* Moved to Geometry module: Intersect, TriangleArea, TriangleNormal, QuadNormal, LineIntersect
+ * - geometry.Intersect -> intersect_ray_tri
+ * - geometry.ClosestPointOnLine -> intersect_point_line
+ * - geometry.PointInTriangle2D -> intersect_point_tri_2d
+ * - geometry.PointInQuad2D -> intersect_point_quad_2d
+ * - geometry.LineIntersect -> intersect_line_line
+ * - geometry.LineIntersect2D -> intersect_line_line_2d
+ * - geometry.BezierInterp -> interpolate_bezier
+ * - geometry.TriangleArea -> area_tri
+ * - geometry.QuadNormal, TriangleNormal -> normal
+ * - geometry.PolyFill -> tesselate_polygon
+ * - geometry.BoxPack2D -> box_pack_2d
+ * - geometry.BarycentricTransform -> barycentric_transform
*/
#include "mathutils.h"
Modified: trunk/blender/source/blender/python/generic/mathutils_geometry.c
===================================================================
--- trunk/blender/source/blender/python/generic/mathutils_geometry.c 2011-01-01 23:53:48 UTC (rev 33991)
+++ trunk/blender/source/blender/python/generic/mathutils_geometry.c 2011-01-02 02:11:38 UTC (rev 33992)
@@ -44,13 +44,15 @@
/*-------------------------DOC STRINGS ---------------------------*/
-static char M_Geometry_doc[] = "The Blender geometry module\n\n";
-static char M_Geometry_Intersect_doc[] =
-".. function:: Intersect(v1, v2, v3, ray, orig, clip=True)\n"
+static char M_Geometry_doc[]= "The Blender geometry module\n\n";
+
+//---------------------------------INTERSECTION FUNCTIONS--------------------
+
+static char 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"
-" :rtype: boolean\n"
" :arg v1: Point1\n"
" :type v1: :class:`mathutils.Vector`\n"
" :arg v2: Point2\n"
@@ -62,147 +64,18 @@
" :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"
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list