POV-Ray : Newsgroups : povray.off-topic : Numerical approximation of the gravity of a torus Server Time
3 Sep 2024 19:12:32 EDT (-0400)
  Numerical approximation of the gravity of a torus (Message 1 to 10 of 24)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Warp
Subject: Numerical approximation of the gravity of a torus
Date: 3 Mar 2011 15:36:55
Message: <4d6ffbe6@news.povray.org>
In another forum I was pondering about the gravity field of a torus
(ie. imagine you had eg. a torus-shaped planet: What would be the direction
and strength of gravity at different points on its surface?)

  Two possibilities were suggested: The analytical (and thus exact) way,
which would require solving a complicated volume (ie. triple) integral,
and numerical approximation.

  The numerical approximation is simpler in principle, but there are some
difficulties.

  One way to numerically approximate the result would be to fill the torus
with point masses and then sum up their gravity on the tested location.
If we assume that the torus has even density, filling it up with point
masses is actually non-trivial.

  There are two possibilities:

  1) All the point masses have the same mass (ie. the total mass of the
torus divided by the number of points) and are distributed evenly inside
the torus. This is a bit problematic because coming up with an even
distribution of points inside a torus is not easy. Basically it would
mean that you would have to divide the torus into polyhedrons of the
same volume, and put the point masses at their center. However, subdividing
a torus into polyhedrons of the same volume is not trivial.

  2) Instead, we subdivide the torus into polyhedrons of arbitrary size
and scale the mass of the points in relation to the volume of the polyhedron.
(In other words, the masses are scaled according to the local point
density.)

  The second option might be the easiest to do, as it allows for a simple
distribution function for the points which does not need to be strictly
even.

  The easiest division of the torus would be to divide it into slices,
each slice is divided into sections (each such section would thus
effectively be a pyramid with the base on the surface of the torus and
the apex on the central major-radius circle of the torus), and then each
section into polyhedrons (from the base towards the apex of the pyramid).

  One way to easily achieve this programmatically is to simply create
points on the surface of toruses of increasing minor radius (the major
radius being the same as the original torus we are dealing with).

  The problem is deciding what the mass of these points should be. As said,
they can't have equal mass because else you would end up with very uneven
density (the torus would be significantly denser deep inside and less
dense closer to the surface).

  If we think about the points inside one of the slices, the masses should
be, if I understand correctly, proportional to the square of the distance
from the center. This gives you a disc of even density. (However, I'm not
sure now if there should be a constant factor involved...)

  However, that alone is not enough. There's another aspect that has to
be considered: The points would be distributed less densely on the outer
rim of the torus and more densely on the inner rim. Thus they have to be
also scaled according to their distance from the center of the torus.
I'm not exactly sure what the formula would be.

  Since we want the entire torus to have a certain mass m, the sum of
all the point masses have to be that. However, that's actually trivial:
Simply use whatever values are most convenient to create the points, and
then just divide by the sum of the original masses and multiply by m.

  However, the exact formulas to determine the masses of the points is
a bit fuzzy to me. Perhaps someone could help a bit?

-- 
                                                          - Warp


Post a reply to this message

From: Le Forgeron
Subject: Re: Numerical approximation of the gravity of a torus
Date: 3 Mar 2011 16:34:30
Message: <4d700966@news.povray.org>
I would go for some analysis first.

Look at the symmetry, with an even density, it would resolve to the
field from the two circle in the vertical plane with the target point
and the center of the torus.

Looks like a 2 planets field, in 2D.

Compute some particular point to adjust the values.
Such points could:
 * center of torus (no gravity, hence both centers of mass are identical)
 * on the external circle on the middle plane (due to symmetry, it
should behave like the whole mass was at the torus center, allowing to
adjust the apparent mass of each "circle" to keep the previous equality)


Post a reply to this message

From: Darren New
Subject: Re: Numerical approximation of the gravity of a torus
Date: 3 Mar 2011 16:36:21
Message: <4d7009d5$1@news.povray.org>
Warp wrote:
>   In another forum I was pondering about the gravity field of a torus
> (ie. imagine you had eg. a torus-shaped planet: What would be the direction
> and strength of gravity at different points on its surface?)
> 
>   Two possibilities were suggested: The analytical (and thus exact) way,
> which would require solving a complicated volume (ie. triple) integral,
> and numerical approximation.

A few questions: ARe you talking about gravity in the surronding space 
(i.e., flying a space ship around this planet) or are you talking about 
gravity on the surface?

Just off the top of my head, it doesn't seem like it would be terribly 
difficult to solve the gravity equation analytically (integrating either 
over cylinders or disks-with-holes) at a bunch of points, and then 
interpolate between those points for other points, assuming you're talking 
about the outer-space gravity.  Even on the surface, it would seem gravity 
has to change smoothly and it should be pretty obvious where the inflection 
points would be.

The way you're talking about slicing things up, you *are* talking about 
integrating the volume to find the gravity in a particular direction. You're 
just trying to figure out how to do an integration with easier shapes.

A quick google turns up http://www.mathpages.com/home/kmath402/kmath402.htm
But you probably already did that.

It also seems if you made *enough* test point masses, worrying about how to 
subdivide it wouldn't be worthwhile. If your torus has radius 1, and you 
slice it into 10,000 test masses, isn't that going to give you enough 
accuracy? Use the digitalness of your compuations to advantage. Put mass in 
a sphere if the center of the sphere is inside the torus, and calculate from 
there.

I guess it depends on if you want to pre-calculate the field or whether 
you're trying to do this without actually storing too much data.  I usually 
work on the "store lots of data" sorts of problems, so my spidey-sense is 
off here.

Just don't try to work out the super-massive rotating torus gravity. :-)

-- 
Darren New, San Diego CA, USA (PST)
  "How did he die?"   "He got shot in the hand."
     "That was fatal?"
          "He was holding a live grenade at the time."


Post a reply to this message

From: Warp
Subject: Re: Numerical approximation of the gravity of a torus
Date: 3 Mar 2011 17:30:14
Message: <4d701674@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> A few questions: ARe you talking about gravity in the surronding space 
> (i.e., flying a space ship around this planet) or are you talking about 
> gravity on the surface?

  There's no difference between those two. The gravity at any point in
space is calculated in the same way regardless of where that point is.

> Just off the top of my head, it doesn't seem like it would be terribly 
> difficult to solve the gravity equation analytically (integrating either 
> over cylinders or disks-with-holes)

  If I understand correctly, the only way to solve it analytically is to
solve a rather complicated triple integral (ie. a volume integral). Unlike
with a sphere, the volume integral most probably cannot be simplified into
a simpler one (or if it can, it would have to be proved, and proving it
most probably requires solving the triple integral and seeing that it
reduces to a simpler integral, so you are not going to save anything).

  When talking about a spherical body the situation is much simpler.
If you solve the volume integral for the gravity field (outside) of the
sphere, you'll find out that the sphere radius plays no part on the
result (as long as the radius is smaller or equal to the distance between
the point being tested and the center of the sphere). Thus the radius can
be reduced to zero (while retaining the mass), significantly simplifying
calculations. However, that's probably not the case with a torus because
it does not have the required symmetries. (If it is the case, it would
have to be demonstrated, again, probably solving the triple integral.
One could perhaps assume that the minor radius of the torus could be
reduced to zero without affecting the result, but that would have to be
proved before you can make the assumption.)

> The way you're talking about slicing things up, you *are* talking about 
> integrating the volume to find the gravity in a particular direction. You're 
> just trying to figure out how to do an integration with easier shapes.

  No. What I'm talking about is distributing sample points evenly inside
the torus (or, more precisely, making the masses of these sample points
such that the overall mass density is even throughout the torus) for the
purpose of performing a numerical approximation.

  It has nothing to do with integration.

> A quick google turns up http://www.mathpages.com/home/kmath402/kmath402.htm
> But you probably already did that.

  Yes, but I'm not completely convinced that the solution presented is
valid, both because I don't fully understand all the math, and because
it may be that the author is making simplifications without proving that
they can be made without affecting the result.

  Anyways, I'm not so interested in the end result as in the *process* of
getting there by numerical approximation, which is the whole point. :)

> It also seems if you made *enough* test point masses, worrying about how to 
> subdivide it wouldn't be worthwhile. If your torus has radius 1, and you 
> slice it into 10,000 test masses, isn't that going to give you enough 
> accuracy? Use the digitalness of your compuations to advantage. Put mass in 
> a sphere if the center of the sphere is inside the torus, and calculate from 
> there.

  The amount of points is not the problem. It's their distribution that is
(either spatial or mass).

  You can't just put points of equal mass in whichever way you want inside
the torus because you easily end up with uneven density. You have to either
distribute the points evenly, or scale their masses according to the local
point density. That's the problem I'm trying to figure out.

-- 
                                                          - Warp


Post a reply to this message

From: Kevin Wampler
Subject: Re: Numerical approximation of the gravity of a torus
Date: 3 Mar 2011 18:20:20
Message: <4d702234$1@news.povray.org>
On 3/3/2011 12:36 PM, Warp wrote:
>
>    There are two possibilities:
>
>    1) All the point masses have the same mass (ie. the total mass of the
> torus divided by the number of points) and are distributed evenly inside
> the torus. This is a bit problematic because coming up with an even
> distribution of points inside a torus is not easy. Basically it would
> mean that you would have to divide the torus into polyhedrons of the
> same volume, and put the point masses at their center. However, subdividing
> a torus into polyhedrons of the same volume is not trivial.

If the torus isn't too `skinny' you could just uniformly sample a bunch 
of points from its bounding box and retain only those which lie inside 
the torus.  You could also run marching cubes on it and put a point mass 
at the center of each cube, scaling the mass of the points in the `edge' 
cubes by the volume of the polyhedron which is inside the torus.


>    2) Instead, we subdivide the torus into polyhedrons of arbitrary size
> and scale the mass of the points in relation to the volume of the polyhedron.
> (In other words, the masses are scaled according to the local point
> density.)

How about you sample uniformly from a circle (either randomly or in a 
grid).  For each such sample you then create n points in a ring around 
the torus' axis, where the mass of the each point is set proportionally 
to the circumference of the ring?


Post a reply to this message

From: Darren New
Subject: Re: Numerical approximation of the gravity of a torus
Date: 3 Mar 2011 19:27:24
Message: <4d7031ec$1@news.povray.org>
Warp wrote:
>   There's no difference between those two. The gravity at any point in
> space is calculated in the same way regardless of where that point is.

I know that. But the technique and approach to taking shortcuts can differ.

>   Anyways, I'm not so interested in the end result as in the *process* of
> getting there by numerical approximation, which is the whole point. :)

Fair enough.

>> It also seems if you made *enough* test point masses, worrying about how to 
>> subdivide it wouldn't be worthwhile. If your torus has radius 1, and you 
>> slice it into 10,000 test masses, isn't that going to give you enough 
>> accuracy? Use the digitalness of your compuations to advantage. Put mass in 
>> a sphere if the center of the sphere is inside the torus, and calculate from 
>> there.
> 
>   The amount of points is not the problem. It's their distribution that is
> (either spatial or mass).

Then make each point the size of a grain of sand, and you have a really, 
really good approximation. That's what I mean.

>   You can't just put points of equal mass in whichever way you want inside
> the torus because you easily end up with uneven density. You have to either
> distribute the points evenly, or scale their masses according to the local
> point density. That's the problem I'm trying to figure out.

Right. Not knowing why you want the answer, I was suggesting that you 
distribute the points evenly and use lots and lots of points.

If it's just for personal interest in the puzzle of it, or you want to do it 
in real time or something, then sure, that's not the best solution. :-)

-- 
Darren New, San Diego CA, USA (PST)
  "How did he die?"   "He got shot in the hand."
     "That was fatal?"
          "He was holding a live grenade at the time."


Post a reply to this message

From: Warp
Subject: Re: Numerical approximation of the gravity of a torus
Date: 3 Mar 2011 21:17:19
Message: <4d704bae@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> >   The amount of points is not the problem. It's their distribution that is
> > (either spatial or mass).

> Then make each point the size of a grain of sand, and you have a really, 
> really good approximation. That's what I mean.

  I think there's some form of miscommunication here. Points have zero
size. That's irrelevant. The relevant thing is their mass and their
distribution.

> >   You can't just put points of equal mass in whichever way you want inside
> > the torus because you easily end up with uneven density. You have to either
> > distribute the points evenly, or scale their masses according to the local
> > point density. That's the problem I'm trying to figure out.

> Right. Not knowing why you want the answer, I was suggesting that you 
> distribute the points evenly and use lots and lots of points.

  I explained it in my first post: I want to make a numerical approximation
of the gravity of a torus, and a way of doing that is to create point masses
inside it.

  Perhaps you should read my first post again. I *want* to get an even
distribution of mass. That's my question: What formula should I use to
get it? I explained the approach in detail, it's just the specifics that
I'm after.

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: Numerical approximation of the gravity of a torus
Date: 3 Mar 2011 21:25:13
Message: <4d704d88@news.povray.org>
Kevin Wampler <wam### [at] uwashingtonedu> wrote:
> On 3/3/2011 12:36 PM, Warp wrote:
> >
> >    There are two possibilities:
> >
> >    1) All the point masses have the same mass (ie. the total mass of the
> > torus divided by the number of points) and are distributed evenly inside
> > the torus. This is a bit problematic because coming up with an even
> > distribution of points inside a torus is not easy. Basically it would
> > mean that you would have to divide the torus into polyhedrons of the
> > same volume, and put the point masses at their center. However, subdividing
> > a torus into polyhedrons of the same volume is not trivial.

> If the torus isn't too `skinny' you could just uniformly sample a bunch 
> of points from its bounding box and retain only those which lie inside 
> the torus.

  There's a minor problem with that approach which might skew the result
in some cases. Basically, you are dividing the torus into small cubes and
putting the points at the center of each cube. However, some of the cubes
are not cubes because they are cut by the surface of the torus. In these
cases the point masses do not correspond to the volumes of the clipped
cubes.

  (There's also the problem that some of the points will get too close
to the surface that way. If the location we are measuring the gravity
from happens to be too close to such a point, the result will be way too
high. In practice you have a small black hole near the surface of the
torus, and the test location is too close to it, skewing the result.)

> >    2) Instead, we subdivide the torus into polyhedrons of arbitrary size
> > and scale the mass of the points in relation to the volume of the polyhedron.
> > (In other words, the masses are scaled according to the local point
> > density.)

> How about you sample uniformly from a circle (either randomly or in a 
> grid).  For each such sample you then create n points in a ring around 
> the torus' axis, where the mass of the each point is set proportionally 
> to the circumference of the ring?

  I think it's just easier to scale the point masses according to a simple
quadratic function. It's just the exact function I'm looking for.

-- 
                                                          - Warp


Post a reply to this message

From: Darren New
Subject: Re: Numerical approximation of the gravity of a torus
Date: 3 Mar 2011 22:55:53
Message: <4d7062c9$1@news.povray.org>
Warp wrote:
> are not cubes because they are cut by the surface of the torus. In these
> cases the point masses do not correspond to the volumes of the clipped
> cubes.

*My* point was that if these cubes were the size of sand grains, that 
inaccuracy doesn't matter. That's why I asked how precise you needed the 
answer. Plus, if you only sampled the gravity a foot off the surface within 
a precision of grain-of-sand size, you don't have to worry about point 
masses. :-)


(Note to self: Never answer in a sloppy intuitive way when Warp asks a math 
question. :-)

-- 
Darren New, San Diego CA, USA (PST)
  "How did he die?"   "He got shot in the hand."
     "That was fatal?"
          "He was holding a live grenade at the time."


Post a reply to this message

From: Warp
Subject: Re: Numerical approximation of the gravity of a torus
Date: 3 Mar 2011 23:22:31
Message: <4d706906@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> *My* point was that if these cubes were the size of sand grains, that 
> inaccuracy doesn't matter. That's why I asked how precise you needed the 
> answer. Plus, if you only sampled the gravity a foot off the surface within 
> a precision of grain-of-sand size, you don't have to worry about point 
> masses. :-)

  I suppose in that sense it could perhaps work, as long as the testing
point is not closer to the surface of the torus than the half of such a
cube.

-- 
                                                          - Warp


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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