Cage opened this issue on Feb 24, 2010 · 592 posts
Spanki posted Mon, 29 March 2010 at 12:41 PM
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).
Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.