POV-Ray : Newsgroups : povray.off-topic : Numerical approximation of the gravity of a torus Server Time
3 Sep 2024 15:15:58 EDT (-0400)
  Numerical approximation of the gravity of a torus (Message 11 to 20 of 24)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 4 Messages >>>
From: Kevin Wampler
Subject: Re: Numerical approximation of the gravity of a torus
Date: 3 Mar 2011 23:25:41
Message: <4d7069c5@news.povray.org>
On 3/3/2011 6:25 PM, Warp wrote:
>
>> 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.

Of course, but Darren's point holds in this case.  The marching cubes 
approach fixes this if you're really concerned.


>    (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.)

I would think that any approach based on approximating the torus as a 
bunch of point masses would have this problem.


>    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.

Does just scaling the mass proportionally to a point's distance from the 
torus' axis not work here?  If you're looking for an exact equation 
based on the actual mass of the torus, just run a post-process 
normalization pass where you scale the mass of each point so that they 
sum to the total mass of the torus.


Post a reply to this message

From: Warp
Subject: Re: Numerical approximation of the gravity of a torus
Date: 4 Mar 2011 02:53:32
Message: <4d709a7c@news.povray.org>
Kevin Wampler <wam### [at] uwashingtonedu> wrote:
> >    (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.)

> I would think that any approach based on approximating the torus as a 
> bunch of point masses would have this problem.

  Only if you start measuring inside the torus.

> >    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.

> Does just scaling the mass proportionally to a point's distance from the 
> torus' axis not work here?  If you're looking for an exact equation 
> based on the actual mass of the torus, just run a post-process 
> normalization pass where you scale the mass of each point so that they 
> sum to the total mass of the torus.

  I explained the details in my original post.

-- 
                                                          - Warp


Post a reply to this message

From: Le Forgeron
Subject: Re: Numerical approximation of the gravity of a torus
Date: 4 Mar 2011 03:01:28
Message: <4d709c58$1@news.povray.org>
Le 04/03/2011 03:17, Warp a écrit :
>   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.
> 

Simplest distribution: along the major radius circle. Kind of 1D
distribution, evenly spaced with same masse along a circle. Easy.

Now, if you intend to refine that point inside the minor disc on the
perpendicular plane, you are in trouble for an "all the same mass"
points scheme. But that should not stop you from substituing for
instance the central point with seven points (hexagon pattern with
center), as long as you adjust the mass of each point according to its
distance from the main axis of the torus.

What can be done for 1--> 7 can be pushed further with any triangular
tiling of the circle. The points would not be even spaced, nor have all
the same mass, but it would work.

If you really want even spaced points of same mass... put a high
resolution grid (of regular tetrahedron instead of cube if you care) and
generate two set of points:
 * first set is made of the center of tetrahedrons completely in the torus
 * second set is made the center of tetrahedrons with at least one part
inside the torus.

Sets 1 & 2 would converge to the same when the resolution is increased,
so you can probably choose a basic test: if the center of the
tetrahedron is inside the torus, it has full mass.

About the mass of each points: the density * volume of torus divided by
the number of points!


For symmetry, it would be nice to have the hexagonal paving of the grid
to align with the plane of the torus.

Look at http://en.wikipedia.org/wiki/Sphere_packing
in particular, the regular packing. each sphere's center is a point of
your grid (cubic close packing/face centered cubic). Sample the torus
and you are done.



-- 
Software is like dirt - it costs time and money to change it and move it
around.

Just because you can't see it, it doesn't weigh anything,
and you can't drill a hole in it and stick a rivet into it doesn't mean
it's free.


Post a reply to this message

From: Kevin Wampler
Subject: Re: Numerical approximation of the gravity of a torus
Date: 4 Mar 2011 11:30:05
Message: <4d71138d$1@news.povray.org>
On 3/3/2011 11:53 PM, Warp wrote:
>
>> Does just scaling the mass proportionally to a point's distance from the
>> torus' axis not work here?
>
>    I explained the details in my original post.

Hopefully this is sufficiently precise:


def genTorusPoints(major, minor, usteps, vsteps, rsteps):
   for i in xrange(usteps):
     for j in xrange(vsteps):
       for k in xrange(rsteps):
         u, v, r = 2*i*pi/usteps, 2*j*pi/vsteps, (k+1.0)/rsteps
         x = (major+r*minor*cos(v))*cos(u)
         y = (major+r*minor*cos(v))*sin(u)
         z = r*minor*sin(v)
         m = r*sqrt(x*x+y*y)
         yield x, y, z, m


Post a reply to this message

From: Warp
Subject: Re: Numerical approximation of the gravity of a torus
Date: 4 Mar 2011 14:45:16
Message: <4d71414c@news.povray.org>
Kevin Wampler <wam### [at] uwashingtonedu> wrote:
> def genTorusPoints(major, minor, usteps, vsteps, rsteps):
>    for i in xrange(usteps):
>      for j in xrange(vsteps):
>        for k in xrange(rsteps):
>          u, v, r = 2*i*pi/usteps, 2*j*pi/vsteps, (k+1.0)/rsteps
>          x = (major+r*minor*cos(v))*cos(u)
>          y = (major+r*minor*cos(v))*sin(u)
>          z = r*minor*sin(v)
>          m = r*sqrt(x*x+y*y)
>          yield x, y, z, m

  The density will not be equal because the points will be distributed more
densely deeper inside the torus than closer to the surface, without the
correspondent scaling of the mass.

  As for taking into account the distance from the center on the mass, are
you sure that it's proportional to 'r' and not 'r*r'?

-- 
                                                          - Warp


Post a reply to this message

From: Kevin Wampler
Subject: Re: Numerical approximation of the gravity of a torus
Date: 4 Mar 2011 17:29:56
Message: <4d7167e4$1@news.povray.org>
On 3/4/2011 11:45 AM, Warp wrote:
> Kevin Wampler<wam### [at] uwashingtonedu>  wrote:
>> def genTorusPoints(major, minor, usteps, vsteps, rsteps):
>>     for i in xrange(usteps):
>>       for j in xrange(vsteps):
>>         for k in xrange(rsteps):
>>           u, v, r = 2*i*pi/usteps, 2*j*pi/vsteps, (k+1.0)/rsteps
>>           x = (major+r*minor*cos(v))*cos(u)
>>           y = (major+r*minor*cos(v))*sin(u)
>>           z = r*minor*sin(v)
>>           m = r*sqrt(x*x+y*y)
>>           yield x, y, z, m
>
>    The density will not be equal because the points will be distributed more
> densely deeper inside the torus than closer to the surface, without the
> correspondent scaling of the mass.

Since r=0 for points in the center of the `tube' and r=1 for points on 
the surface, points deeper inside the torus are indeed given less mass.


>    As for taking into account the distance from the center on the mass, are
> you sure that it's proportional to 'r' and not 'r*r'?
>

I'm not sure what you mean by "the center" here, but I do think that r 
is correct in this case.  You can think of the case of a cylinder 
instead of a torus.  Here, the volume of a `wedge' increases as you move 
further away from the central axis, but only the volume only grows 
linearly.  Intuitively this is because only one of its three dimensions 
grows as you move further out, but you can prove if you want by looking 
at the volume of a fixed fraction of a cylindrical ring of constant 
thickness as its radius increases.

We actually have a torus and not a cylinder, and the sqrt(x*x+y*y) term 
takes into account the change in density due to the distance from the 
torus' axis.  The resulting equation is bilinear, which is maybe where 
you got the intuition that it should be quadratic from.


Post a reply to this message

From: Warp
Subject: Re: Numerical approximation of the gravity of a torus
Date: 4 Mar 2011 17:50:14
Message: <4d716ca5@news.povray.org>
Kevin Wampler <wam### [at] uwashingtonedu> wrote:
> On 3/4/2011 11:45 AM, Warp wrote:
> > Kevin Wampler<wam### [at] uwashingtonedu>  wrote:
> >> def genTorusPoints(major, minor, usteps, vsteps, rsteps):
> >>     for i in xrange(usteps):
> >>       for j in xrange(vsteps):
> >>         for k in xrange(rsteps):
> >>           u, v, r = 2*i*pi/usteps, 2*j*pi/vsteps, (k+1.0)/rsteps
> >>           x = (major+r*minor*cos(v))*cos(u)
> >>           y = (major+r*minor*cos(v))*sin(u)
> >>           z = r*minor*sin(v)
> >>           m = r*sqrt(x*x+y*y)
> >>           yield x, y, z, m
> >
> >    The density will not be equal because the points will be distributed more
> > densely deeper inside the torus than closer to the surface, without the
> > correspondent scaling of the mass.

> Since r=0 for points in the center of the `tube' and r=1 for points on 
> the surface, points deeper inside the torus are indeed given less mass.

  I misintepreted the meaning of 'r'.

> I'm not sure what you mean by "the center" here, but I do think that r 
> is correct in this case.  You can think of the case of a cylinder 
> instead of a torus.  Here, the volume of a `wedge' increases as you move 
> further away from the central axis, but only the volume only grows 
> linearly.  Intuitively this is because only one of its three dimensions 
> grows as you move further out, but you can prove if you want by looking 
> at the volume of a fixed fraction of a cylindrical ring of constant 
> thickness as its radius increases.

  The two outer loops are subdividing the torus into pyramid-shaped
volumes (with the apex at the center of the "tube" and the base at
the surface of the torus). The inner loops then subdivides this pyramid
into parts from apex to base at even steps.

  Two of the dimensions (those defined by 'u' and 'r') of these parts
remain the same, while one dimension (the one defined by 'v') increases
linearly. I suppose this means you are right: The volume of these parts
increases linearly, not quadratically. (Well, technically speaking not
really. In a cylinder they would, but in the torus it depends on which
way the pyramid is pointing to: If it's pointing towards the center of
the torus, it gets narrower towards the base, while on the other direction
it gets wider. But that's what the "sqrt(x*x+y*y)" part is addressing...)

-- 
                                                          - Warp


Post a reply to this message

From: scott
Subject: Re: Numerical approximation of the gravity of a torus
Date: 8 Mar 2011 05:10:02
Message: <4d76007a$1@news.povray.org>
>    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.

I would have thought the easiest and trivial way is to just sample the 
3D volume containing the torus in a regular grid pattern.  Kind of like 
creating a volume texture of the torus.  You can then divide the total 
mass by the number of points "inside" to figure the mass of each point 
for use in the calculations.  Just choose a resolution good enough for 
the accuracy you require.


Post a reply to this message

From: Alain
Subject: Re: Numerical approximation of the gravity of a torus
Date: 8 Mar 2011 10:48:26
Message: <4d764fca$1@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?
>

Some things to consider:

When in the hole of the torus, the gravity is only toward the plane 
perpendicular to the major radius. On that plane, the gravity is zero.

Everywhere on the torus surface, gravity is biased toward the major axis.

Gravity is highest at the exterior equator and null at the interior equator.

The athmosphere would take the shape of an oblate sphere. It's thickness 
would make the inside areas very dark. The iner "tropical" region could 
very well be in perpetual total darkness, but relatively warm.



Alain


Post a reply to this message

From: Alain
Subject: Re: Numerical approximation of the gravity of a torus
Date: 8 Mar 2011 10:56:30
Message: <4d7651ae$1@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?
>

Start with 2 points placed at the major radius.
Draw 2 circles of minor radius.

Calculate the 2D influence for those 2 circles.

Rotate around the major axis.

This assume that the density is constant.

It resolves to a static 2 body gravitic interaction.




Alain


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 4 Messages >>>

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