POV-Ray : Newsgroups : povray.general : Need math help : Re: Need math help Server Time
10 Aug 2024 03:23:19 EDT (-0400)
  Re: Need math help  
From: David Fontaine
Date: 9 Mar 2000 19:03:37
Message: <38C83B18.2B0E74BE@faricy.net>
#macro TorusConnect(p1,mj1,mn1,p2,mj2,mn2)
   #local Dist = sqrt(pow(p1.x-p2.x,2)+pow(p1.y-p2.y,2)+pow(p1.z-p2.z,2));
   #local Ang1 = atan2((mn1+mj1-mn2-mj2)/Dist,1);
   #local Ang2 = asin((mn1-mn2)/sqrt(pow(Dist,2)+pow(mn1+mj1-mn2-mj2,2)));
   cone { p1+vnormalize(p2-p1)*mn1*sin(Ang1+Ang2),mj1+mn1*cos(Ang1+Ang2)
          p2+vnormalize(p2-p1)*mn2*sin(Ang1+Ang2),mj2+mn2*cos(Ang1+Ang2)
   }
#end
If you want the math behind it I can give it to you :-)
And if you want a second cone differenced out of it to smoothly connect the
interior as well, most of the work is already done.

--
___     _______________________________________________
 | \     |_          <dav### [at] faricynet> <ICQ 55354965>
 |_/avid |ontaine        http://www.faricy.net/~davidf/

"The only difference between me and a madman is that I'm not mad." -Dali


Post a reply to this message

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