POV-Ray : Newsgroups : povray.general : Object "center of mass" macro : Re: Object "center of mass" macro Server Time
30 Jul 2024 06:22:18 EDT (-0400)
  Re: Object "center of mass" macro  
From: waggy
Date: 5 Sep 2009 11:45:00
Message: <web.4aa286e7708de865f99d05c80@news.povray.org>
CShake wrote:
>...
> I figure that most people don't have a use for center of mass right now,
> except possibly trying to get an object to rotate around the center, but
> by changing the output variable on this macro I can see the 'total
> volume' being useful to some.
>
> My next macro will be finding the moment of inertia of an object, so I
> will probably package these together since they're similar and upload it
> as the first group.
>
> If anyone wants to look at the actual math here for any obvious things
> I've missed I'd appreciate it too.
>
Very nice, Chris!  To the contrary, I think there are at least a few people who
can use this, I being one of them.

The only issue I see immediately is with very complicated objects such as those
based on fractals, noise, or some odd mathematical formula.  Some fractal
objects, for example, may have an infinite number of intersections along a test
ray and should, at the very least, increase the calculation time a great deal.

I hope you don't mind if I make a companion macro based on your code to
calculate the CoM and volume using a more naive approach specifically for such
pathological objects.  If I can get it to work, the approach I'm thinking of
would be less accurate for a given number of subdivisions, but would always
finish in n^3 iterations.

Would you mind posting your test scenes, or include some when you post this to
the object database submission?  It would be helpful for comparison.

Thanks for posting this.
~David


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.