POV-Ray : Newsgroups : povray.general : Need math help : Need math help Server Time
10 Aug 2024 03:24:39 EDT (-0400)
  Need math help  
From: Sebastian Strand
Date: 9 Mar 2000 12:08:58
Message: <38c7daaa@news.povray.org>
I've been trying to create a macro that would seamlessly connect two
toruses, just like John VanSickle's Connect macro does for spheres. I can't
seem to get it right, however, so I'd be very grateful if someone with more
math skills than me could help me.

Here's something to work with:
#macro TorusConnect(SP,SMaR,SMiR,EP,EMaR,EMiR)
  #local D=vlength(EP-SP);

  #local Rd=(SMaR+SMiR)-(EMaR+EMiR);
  #local D2=sqrt(D*D-Rd*Rd);

  cone { SP+(EP-SP)/D*(SMiR-EMiR)*(SMaR+SMiR)/D, (SMaR+SMiR)*D2/D,
EP+(EP-SP)/D*(SMiR-EMiR)*(SMaR+SMiR)/D, (EMaR+EMiR)*D2/D }
#end

This, obviously, doesn't work but it does come quite close; it just leaves a
tiny edge at the connection point.








Post a reply to this message

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