POV-Ray : Newsgroups : povray.beta-test.binaries : Function / pattern issues. Povr supertoroid parametric. : Function / pattern issues. Povr supertoroid parametric. Server Time
29 Apr 2024 14:42:01 EDT (-0400)
  Function / pattern issues. Povr supertoroid parametric.  
From: William F Pokorny
Date: 14 Jun 2020 08:17:04
Message: <5ee61540$1@news.povray.org>
<---------------------- References. Thirteen previous posts

Function / pattern issues. New inbuilt f_bump().
http://news.povray.org/povray.beta-test.binaries/thread/%3C5ee4dc4b%241%40news.povray.org%3E/

and

Function / pattern issues. New inbuilt f_elliptical_sphrswp().
http://news.povray.org/povray.beta-test.binaries/thread/%3C5ee529b9%241%40news.povray.org%3E/

I posted code to povray.text.scene-files for a parametric supertoroid 
which will run in POV-Ray proper:

http://news.povray.org/povray.text.scene-files/thread/%3C5ec01b20%241%40news.povray.org%3E/

Herein documenting better povr code for it which runs about four times 
faster.

The new povr code looks like:

...
#declare Vrx  = 0.1;
#declare Vry  = 0.1;
#declare Vrz  = 0.1;
#declare VrAx = 0.9/Vrx;  // Major radius in x dived by Vrx.
#declare VrBy = 0.2/Vry;  // Major radius in y dived by Vry.
#declare VrE1 = 1.0;  // Flat / Sharp
#declare VrE2 = 1.0;  // Square or Diamond path
#declare VrMajorR = max(Vrx+VrAx,Vry+VrBy,Vrz);

#declare FnX = function (u,v)
{
     Vrx * (VrAx + f_signpow(cos(u),VrE1,VrE1)) *
                   f_signpow(cos(v),VrE2,VrE2)
}
#declare FnY = function (u,v)
{
     Vry * (VrBy + f_signpow(cos(u),VrE1,VrE1)) *
                   f_signpow(sin(v),VrE2,VrE2)
}
#declare FnZ = function (u,v) { Vrz * f_signpow(sin(u),VrE1,VrE1) }

#declare Para99 = parametric {
     function { FnX(u,v) }
     function { FnY(u,v) }
     function { FnZ(u,v) }
     <-pi,-pi>, <pi,pi>
     contained_by { box { <-VrMajorR*2.2,-VrMajorR*2.2,-VrMajorR*2.2>,
             <VrMajorR*2.2,VrMajorR*2.2,VrMajorR*2.2> } } // Sloppy
     accuracy 0.0005
     max_gradient 0.001
     precompute 18, x,y,z
     pigment { color Green }
}
...

here the bounding still general. The elapsed times for each of the 
attached images was in the 2-3 second range with AA on my two core i3.

It's a flexible shape.

Bill P.


Post a reply to this message


Attachments:
Download 'storyparasupertoroid.jpg' (121 KB)

Preview of image 'storyparasupertoroid.jpg'
storyparasupertoroid.jpg


 

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