POV-Ray : Newsgroups : povray.general : Need math help : Re: SV: Need math help Server Time
10 Aug 2024 03:20:21 EDT (-0400)
  Re: SV: Need math help  
From: Tor Olav Kristensen
Date: 10 Mar 2000 13:05:47
Message: <38C93865.F5FE5F14@hotmail.com>
Hi

Sebastian Strand wrote:

> Well, thanks to all three of you that presented a solution. I will now
> proceed to try and decide which one to use, probably by testing which macro
> parses quickest  :)

Try this:

#macro TorusConnect(SP,SMaR,SMiR,EP,EMaR,EMiR)

  #local a=EP-SP;
  #local b=SMaR-EMaR;
  #local c=SMiR-EMiR;
  #local d=vdot(a,a);
  #local e=d+b*b;
  #local f=sqrt(d);
  #local g=sqrt(e-c*c);
  #local h=(f*g-c*b)/e;
  #local i=(f*c+g*b)/e;
  #local j=a/f;

  cone { SMiR*i*j+SP,SMiR*h+SMaR,(EMiR*i+f)*j+SP,EMiR*h+EMaR }

#end // macro TorusConnect

Tor Olav

mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

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