![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Warp
Subject: Re: Numerical approximation of the gravity of a torus
Date: 3 Mar 2011 21:17:19
Message: <4d704bae@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Darren New <dne### [at] san rr com> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Warp
Subject: Re: Numerical approximation of the gravity of a torus
Date: 3 Mar 2011 21:25:13
Message: <4d704d88@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Kevin Wampler <wam### [at] u washington edu> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Warp
Subject: Re: Numerical approximation of the gravity of a torus
Date: 3 Mar 2011 23:22:31
Message: <4d706906@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Darren New <dne### [at] san rr com> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Warp
Subject: Re: Numerical approximation of the gravity of a torus
Date: 4 Mar 2011 02:53:32
Message: <4d709a7c@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Kevin Wampler <wam### [at] u washington edu> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |