POV-Ray : Newsgroups : povray.off-topic : Numerical approximation of the gravity of a torus : Re: Numerical approximation of the gravity of a torus Server Time
3 Sep 2024 17:17:34 EDT (-0400)
  Re: Numerical approximation of the gravity of a torus  
From: Warp
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

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