Hey,

While I actually am not really familiar with the original problem that this
trick solves, after seeing your code I got somewhat hooked today trying to
optimize it further. I thought I would post what I've to be able to have
some discussion about it. There were a couple things I was confused
about... But first, here is my pass at further modifying your code:

https://gist.github.com/1795840

Some changes:

   1. Removed all the remaining pymel
   2. During the first loop that computes the radius of each point, I
   create an MPoint as well and save all of the data in an object.
   3. I sort the object by radius size instead of doing that extremely
   repetitive loop to find the biggest sphere each time. Instead I figured we
   could just start with a sorted list and work through it. Am I wrong about
   this approach? Did they need to remain in the original order for some
   reason? I didn't think they did and all we care about is having the biggest
   spheres first.
   4. For the main intensive loop, since we no longer have to do the size
   test, we just go forward over our sorted list, popping off the next
   biggest, and then doing the collision test on the remainder.

I noticed that (at least in my own tests) the original version, yours, and
mine all did not properly set the radiusPP values on each particle. They
all end up being 0.2. I can go and change them individually in the scene
via the component editor, but I have yet to figure out how to get them to
actually set in the script. So that remains unsolved.

I think my version should be faster the more steps you use and the more
complex the geometry. When I tested 60 steps on a very large sphere, my
results were showing a ~30% increase in speed from yours.

Very interested in messing with this :-)



On Fri, Feb 10, 2012 at 12:26 PM, notanymike <notanym...@gmail.com> wrote:

> Update:
>
> It turns out the code was written by Djelloul Bekri, and Dorian had
> just explained how it works on his blog...
>
> On Feb 10, 9:05 am, notanymike <notanym...@gmail.com> wrote:
> > I've converted the following code from being all pymel to mostly using
> > the Maya API, mainly for fun:
> >
> > http://www.fevrierdorian.com/blog/post/2011/03/14/Remplir-un-mesh-de-...
> >
> > My code is available here:
> >
> > http://pastebin.com/3KbhXagZ
> >
> > It's a bit faster...I also attempted to translate the french parts of
> > the code into English, though I don't speak French, so it's just an
> > educated guess....
> >
> > I was hoping to create a "skeletonizer" script, but maybe someone will
> > find what I've got here useful as is...
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to