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:20:23 EDT (-0400)
  Re: Numerical approximation of the gravity of a torus  
From: Warp
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

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