Forum: Poser Python Scripting


Subject: Would there be interest in a Python function that fixed vertex order?

odf opened this issue on Nov 05, 2021 ยท 47 posts


odf posted Tue, 09 November 2021 at 2:37 AM

So we need a way to drastically reduce the number of vertex number assignments we need to look at. Noticed that I snuck in the word "connected" up there. For a connected mesh, once we pick a vertex to assign the number 1 to, and one of its neighbors to assign the number 2 to, there is in fact a simple algorithm that uniquely assigns all the other numbers. That algorithm is basically just a breadth-first search with some extra rules determining which order the neighbors of a vertex are to be visited in.

So that takes us down from a number of operations that to call astronomical would be a massive understatement to maybe a few billion at worst. There are extra tricks one can apply to reduce that further, for example to always use a pole as the first vertex, stop as soon as it is clear that the new numbering cannot be better than the previous best, and so on. My implementation starts at a pole with the largest degree, which reminded me that Antonia has four 6-poles in her gums. :smile: At any rate, from my tests so far it looks as if the final method is quite fast. It takes less than a second for the roughly 38k vertices in Antonia's main body mesh.

-- I'm not mad at you, just Westphalian.