Geometry.c - rewrote my python box-packer algo in C,

packing 2400 rectanges is about 38x faster.

Use the C implimentation in uvcalc_lightmap and uvcalc_smart_project

Blender.c - filename returning None raises errors with existing scripts, just return "" so string functions on the filename dont raise an error.
This commit is contained in:
2007-03-20 07:23:09 +00:00
parent 1ebc28bead
commit a51477093b
6 changed files with 507 additions and 22 deletions

View File

@@ -46,4 +46,16 @@ def LineIntersect2D(vec1, vec2, vec3, vec4):
Takes 2 lines vec1, vec2 for the 2 points of the first line and vec2, vec3 for the 2 points of the second line.
@rtype: Vector
@return: a 2D Vector for the intersection or None where there is no intersection.
"""
"""
def BoxPack2D(boxlist):
"""
Takes a list of 2D boxes and packs them into a square.
Each box in boxlist must be a list of at least 4 items - [x,y,w,h], after running this script,
the X and Y values in each box will be moved to packed, non overlapping locations.
@rtype: tuple
@return: a tuple pair - (width, height) of all the packed boxes.
"""