Cage opened this issue on Feb 24, 2010 · 592 posts
Cage posted Mon, 29 March 2010 at 1:15 PM
Quote - BTW, I have confirmed that your get_weights() routine is broke... I also know why it's broke - I just don't know the fix yet (I need to think about it a little).
The bug can be found here:
for di in range(len(dists)): <br></br> dist = dists[di] <br></br> val = (dmax - dist) / (dmax - dmin)<br></br>...remember that 'dmax' is essentially 'dmax = max(dists)', so ONE of the distances ('dist' in the code above) within that array == dmax. Which means... (dmax - dist) will = 0.0 and zero divided by anything is zero.
How it's affecting the current close-vert method...
Currently, you're basically fooling the code by throwing in an additional distance - if there ARE any extras - when you have extras, that's ok, because dmax will end up matching that extra (it's the furtherst distance away) and it gets dropped later on. But when there's less than 'num_influences', you don't end up adding an extra one, so one of the few that you do have ends up getting dropped (if you started with 5, you end up with 4, if you only had 3, you end up with 2, etc). In other words, this could be contributing to some of the piggy-backing.
Anyway, I'm pretty sure that once we get that routine fixed, it can also be used to compute the weights from the 3 vert indices returned by the ray-cast code, so it would only need to return the indices (simplifying things a bit).
Yes. Exactly! I've looked at the weighting code a few times recently, as it's become clear that the script can be improved for uphill comparisons, and had arrived at the same basic assessment of the problem. I can't find anything online, however, relating to weighting a set of coordinates based on distance. I have no idea how to fix it. One could set an arbitrary max value (notice that the default value is 100, if no argument for max is sent), but I think that's probably just as incorrect, or worse. I did some searches on the math behind falloff zones, wondering if the ideas (or at least terminology) used by Morphing Clothes might point somewhere useful, but I could find nothing online. Google fails me. :lol: Kuroyume might know something about falloff zones. I think he worked with those a lot in his Poser to C4D script/program/whatever you C4D folks call such things. Hmm.
I'm glad you're looking at this and thinking about it. :thumbupboth: I've had surprising luck with some things, but I still lack advanced math skills. So I can only take things so far, alas. :lol:
===========================sigline======================================================
Cage can be an opinionated jerk who posts without thinking. He apologizes for this. He's honestly not trying to be a turkeyhead.
Cage had some freebies, compatible with Poser 11 and below. His Python scripts were saved at archive.org, along with the rest of the Morphography site, where they were hosted.