POV-Ray : Newsgroups : povray.binaries.programming : torus equation : Re: torus equation Server Time
19 Apr 2024 15:27:30 EDT (-0400)
  Re: torus equation  
From: Tor Olav Kristensen
Date: 11 Feb 2002 19:38:10
Message: <3C686358.B118ABA9@online.no>
majucatur wrote:
> 
> Thank you to Peter Popov and Ron Parker for the information that you gave me
> on CSG, that were of great utility.
> 
> I have another question, does somebody know how is expressed a torus
> mathematically?, the other figures don't represent a real problem, but does
> it seem that the torus is a compound figure, how can I calculate the normal,
> the intersections, etc. for a torus?, does exist a torus mathematical
> formula?...

For answers to some of your questions, you
may have a look into these posts of mine:

http://news.povray.org/povray.advanced-users/20922/138919
news://news.povray.org/3C292BC5.5A6AB4A6%40hotmail.com

http://news.povray.org/povray.advanced-users/20922/145305
news://news.povray.org/3C4B045F.DFBD5D79%40hotmail.com


And at this page you'll find a polynomial
equation for the torus:

http://www.nada.kth.se/hacks/doc/PoVRay/pov122.html


Here's a macro that will return a quartic torus:

#macro QuarticTorus(Rmaj, Rmin)

  #local rxz = -2*(Rmaj^2 + Rmin^2);
  #local ry =  2*(Rmaj^2 - Rmin^2);
  #local rr =  (Rmaj^2 - Rmin^2)^2;

  quartic {
    <
      1,   0,   0,   0,   2,   0,   0,   2,   0, rxz,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
      1,   0,   0,   2,   0,  ry,   0,   0,   0,   0,
      1,   0, rxz,   0,  rr
    >
    sturm
  }

#end // macro QuarticTorus


Tor Olav


Post a reply to this message

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