|
![](/i/fill.gif) |
On 3/4/2011 11:45 AM, Warp wrote:
> Kevin Wampler<wam### [at] u washington edu> 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
|
![](/i/fill.gif) |