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:12:31 EDT (-0400)
  Re: Numerical approximation of the gravity of a torus  
From: Kevin Wampler
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

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