THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/10/2012 at 17:01, xxxxxxxx wrote:
Let us say that I have a list of CPolygon values and I want to remove from the list all the elements that produce similar faces.
As it is now, my listing is:
**
auxiliary method
def is_in(p1,p2) :
a1=p1.a
b1=p1.b
c1=p1.c
d1=p1.d
a2=p2.a
b2=p2.b
c2=p2.c
d2=p2.d
a1=(a1==a2 or a1==b2 or a1==c2 or a1==d2)
b1=(b1==a2 or b1==b2 or b1==c2 or b1==d2)
c1=(c1==a2 or c1==b2 or c1==c2 or c1==d2)
d1=(d1==a2 or d1==b2 or d1==c2 or d1==d2)
return (a1 and b1 and c1 and d1)
the code that does the deletion
i=0
while(i<len(pol_list)) :
delete=False
p1=pol_list _
j=i+1
while(j<len(pol_list)) :
p2=pol_list[j]
if is_in(p1,p2) :
delete=True
pol_list.pop(j)
j=j+1
if delete:
pol_list.pop(i)
else:
i=i+1
**
It works, but it is way too slow.
Is there a faster method?