[Bf-funboard] subdivide based on face size

Tom Musgrove tommusgrove__ at hotmail.com
Fri Oct 8 23:49:06 CEST 2004

It might be nice to have a subdivide that subdivided faces based on relative 
face size.

Perhaps loop through the mesh and calculate each faces area, find the 
average face area, and then subdivide faces that are larger than the average 
area by a certain percentage.

Perhaps something along the following lines

# face_area based on code from
# http://astronomy.swin.edu.au/~pbourke/geometry/polyarea/source1.c

	area = 0.0
	num_verts = len(f.verts)
	for i in range(0, num_verts):
		j = (i+1) % num_verts
			i_th_vert = f.verts[i]
			j_th_vert = f.verts[j]
			area += i_th_vert[0]*j_th_vert[1]
			area += i_th_vert[1]*j_th_vert[0]
	area *= .5
	if area < 0:
		return (-1*area)
		return area

face_area_dict = {}
average_area = 0.0
for f in faceList:
	this_area = face_area(f)
	face_area_dict[f] = this_area
average_area /= len(faceList)

double_average_area = 2.0*average_area
for f in faceList:
	temp_area = face_area_dict[f]
	if temp_area >= double_average_area:

Tom M.

Don’t just search. Find. Check out the new MSN Search! 

More information about the Bf-funboard mailing list