[Bf-python] Most efficient way to copy faces
lynx.abraxas at freenet.de
lynx.abraxas at freenet.de
Sun May 24 20:41:28 CEST 2009
Hello,
Next question: What is the most efficient way to copy faces from another mesh?
I have now the verts that lie within an ellipsoid and now I'd like to copy the
faces that belong to these verts. I'm doing it currently like this:
if len(vin.verts) > 2: # we need at least one face => three verts minimum
#find inside faces in potato to copy
for i in range(0, len(potmesh.faces)): #check all potato faces
nvi= 0
f= []
for j in range(0, len(potmesh.faces[i].verts)): #if all verts of a face
for k in vin.verts: #are in the list of the inside verts
if k.co == potmesh.faces[i].verts[j].co:
#if k in potmesh.faces[i].verts:#this does not work! why?
nvi+= 1
f.append(k)#create face with vin.verts indices!
if nvi == len(potmesh.faces[i].verts): #if all verts of a potato face are in the inside verts list
vin.faces.extend(f) #add it to the list of insede faces
elif nvi > len(potmesh.faces[i].verts):
print "Potato mesh contains double verts!"
#vin.faces.extend(f) #only possible for 2 to 4 verts!
#else:
# print "Face not completly inside ellipsoid."
This is taking a long time for my big "potato" (3 million verts, 1 million
faces). Is there a better way to do this?
Many thanks for any help or hints
Lynx
More information about the Bf-python
mailing list