POV-Ray : Newsgroups : povray.general : Object "center of mass" macro : Re: Object "center of mass" macro Server Time
30 Jul 2024 12:27:51 EDT (-0400)
  Re: Object "center of mass" macro  
From: CShake
Date: 10 Sep 2009 18:10:14
Message: <4aa97946$1@news.povray.org>
waggy wrote:
> This is very much right up my alley.  (I'm currently working on a research grant
> to calculate the stress intensity factor around a crack tip using a
> complex-perturbation numerical integration technique.)  I apologize I probably
> won't have time until later this week to help with the math and look at your
> factor-of-two error (if you haven't already found the problem by then).
Sounds like fun research, I'm just starting on my Ph.D. in Mechanical 
Engr, hoping to work on either simulation or outright building of 
non-industrial robotics.

As for the error in the previous macro:
Well, I'm not sure exactly where it came from in the macro I posted 
there, but I redid it to make a full moment tensor and the primary 
moments seemed to double. Then I realized that my original calculated 
box moment was wrong, my volume was half what it should be.

> I would like to see both your original kn^2 macro and an n^3 macro calculating
> useful inertial and geometric properties of an arbitrary object.  (I used
> intersecting open xy planes and trace() rather than inside(), for my n^3 macro.
>  I'll test both later to see which is better for the pathological cases that
> need to use an n^3 method.)
Well, here's my 'completed' "find everything in one pass" macro that 
works in n^3, I figure that it's gotten big enough that I should attach 
it. I know it isn't a binary group here, but it's only a small pov file.
The problem with this is that it isn't nearly as optimized as the 
previous kn^2 CoM finder, and the mesh needs to be pretty small to get 
good accuracy. Fortunately, a decent approximation should be good enough 
for most uses in pov, and that doesn't take too long.

> From what you've posted so far, it looks like a good approach.  I think you may
> end up calculating the volume, center of mass, and inertial tensor with respect
> to the origin all together.  Then, after the loops, find the stress tensor with
> respect to the center of mass.  Now you can find the directions of the
> principle axes by finding the transformation needed to diagonalize the stress
> tensor.  As you're already doing, you should be able to leave factoring in the
> density until the end (assuming the density is constant).
Yup, this one does all that. Thanks for the idea, I just had to look up 
tensor transformations.

> As far as using a different subdivision axis, I agree that you'll find it far
> easier to rotate the object by the inverse of the desired axis rotation, use
> the loops as they are, then transform the coordinate results.
The 'optimized' kn^2 macro for just center of mass has been posted to 
p.t.scene-files, and the subdivision axis can be specified to be x, y, or z.

Now to write a macro that finds the location and normal direction of the 
contact force for arbitrary object collisions...

Chris


Post a reply to this message


Attachments:
Download 'findobjectproperties.pov.txt' (6 KB)

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