Ok this one has me stumped…
I am creating a mesh by defining eight points rotated around around the x axis (for reasons I won’t get into I am manually doing the math for an affine transformation), imagine an octagon. I then move along the x axis and make another, then another, to create an eight sided cylinder, N segements long.
Works fine, I can see all my vertices drawn as mesh points in the 3d window. However… when I started trying to make the faces things got wonky.
I started by fishing out the indices of the mesh and packing them into a list, then iterating over the list to make faces… but CHECK THIS… every time I run my script the faces are drawn from different indices!! huh?
Curious what might be going on I started packing a list of the indicies of each octagon as I made them, to get something like this (just the first two):
[5, 7, 0, 1, 2, 3, 4, 6]
[9, 10, 12, 13, 15, 16, 17, 18]
ok fine…
but if I run my script again I get this:
[4, 6, 0, 1, 2, 3, 5, 7]
[9, 10, 12, 13, 15, 16, 17, 18]
What the hey??? My indices are moving!!
Not to mention, some are missing…
Can anyone explain this?
And here’s the other rub: when I iterate through the indices of the mesh with
for i in mesh.verts: v.index
I get this [11, 14, 5, 7, 0, 1, 2, 3, 4, 6, 8, 9, 10, 12, 13, 15, 16, 17]
(which goes with the the first two lists above), but, no surprise, when I run it again I get this [11, 14, 4, 6, 0, 1, 2, 3, 5, 7, 8, 9, 10, 12, 13, 15, 16, 17]!
And even if I just work with the list of returned indices I can’t make sense of it’s order… because to my thinking the first face would be [4,9,10,6]… so I must be missing somethig. (BTW wherethe hell did index 11 go?! and why am I getting an 18?.. when it’s an N-1 array?!)
The whole thing smells of a -1 problem… but for the life of me I can’t figure it out.
Any ideas anyone?