traltixxx

06 June 2012, 02:54 AM

Hi,

I'm not sure if this has been done before or not but I'm trying to fix faces with more than 5 sides with the following algorithm in python (assuming that the neighbouring faces are all ok):

1. for a n-sided face, pick a vert with ID x (vert x) and a vert that is floor(n/2) neighbors away (vert y) and create an edge between them (polysplit)

1.a. If n is odd and n>5 then add another edge between the vert y and the vert 2 neighbors away that will create a face with 3 sides which is alright.

2. do a loop for b times where b=floor(n/2)-3 . for each loop iteration, do the following:

2.a. start at the verts that is 2 neighbours away (left and right) from vert x and create an edge that intersect the edge that was created in step 1; and keep on doing it for every vert that is 1 neighbour away (left and right) from the previous iteration (if any)

I've attached the image as an example of some n-sided faces with the sequence the edges are added.

My question is if there is something out there that already does something like this? Also, every time I do a polySplit, the ID of the verts and edges keep changing, if there a way to make sure that the variables keep track of the changing ID? Is there a better way to create the edges for this other than polySplits since I have to keep track of the edges that are connected to the verts

http://i.imgur.com/Z1V5W.png

I'm not sure if this has been done before or not but I'm trying to fix faces with more than 5 sides with the following algorithm in python (assuming that the neighbouring faces are all ok):

1. for a n-sided face, pick a vert with ID x (vert x) and a vert that is floor(n/2) neighbors away (vert y) and create an edge between them (polysplit)

1.a. If n is odd and n>5 then add another edge between the vert y and the vert 2 neighbors away that will create a face with 3 sides which is alright.

2. do a loop for b times where b=floor(n/2)-3 . for each loop iteration, do the following:

2.a. start at the verts that is 2 neighbours away (left and right) from vert x and create an edge that intersect the edge that was created in step 1; and keep on doing it for every vert that is 1 neighbour away (left and right) from the previous iteration (if any)

I've attached the image as an example of some n-sided faces with the sequence the edges are added.

My question is if there is something out there that already does something like this? Also, every time I do a polySplit, the ID of the verts and edges keep changing, if there a way to make sure that the variables keep track of the changing ID? Is there a better way to create the edges for this other than polySplits since I have to keep track of the edges that are connected to the verts

http://i.imgur.com/Z1V5W.png