POV-Ray : Newsgroups : povray.binaries.images : Super Shapes with isosurface : Re: Super Shapes with isosurface Server Time
19 May 2024 06:16:43 EDT (-0400)
  Re: Super Shapes with isosurface  
From: Hans de Vries
Date: 24 Mar 2004 10:47:27
Message: <4061ad8f$1@news.povray.org>
I enjoyed the images at your photo side.

http://subcube.com

Some very nice isosurfaces over there :^)

Regards, Hans

Tor Olav Kristensen wrote:
> Hans de Vries wrote:
> 
>>
>> The simplest version for the time being below. It speeds things up 
>> with circa 25%
>> The trick is to get the right ranges for theta (-pi..+pi) and phi 
>> (-pi/2..+pi/2)
>> and avoiding divides by zero.
> 
> 
> Often it will also help to "predeclare" constants so that they
> don't have to be evaluated over and over again at rendertime.
> 
> E.g.:
> 
> #macro Super_Function_3D()
> 
> #local HalfPi = pi/2;
> #local mm1 = 0.25*m1;
> #local mm2 = 0.25*m2;
> #local inn11 = 1/n11;
> #local inn12 = 1/n12;
> 
> isosurface {
>   function {
>     pow(
>       pow(abs(cos(mm2*(f_ph(x, z, y) - HalfPi))/a2), n22) +
>       pow(abs(sin(mm2*(f_ph(x, z, y) - HalfPi))/b2), n32),
>       inn12
>     ) *
>     pow(
>       pow(abs(cos(mm1*atan2(x, y))/a1), n21) +
>       pow(abs(sin(mm1*atan2(x, y))/b1), n31),
>       inn11
>     ) *
>     f_r(x,y,z)
>     - 1
>   }
>   max_gradient 20
>   contained_by { box { <-2,-2,-2>,<2,2,2> } }
> }
> 
> 
>> #macro Super_Function_3D (m1, a1, b1, n11, n21, n31, m2, a2, b2, n12, 
>> n22, n32 )
>>
>>   isosurface {
>>     function {
>>                pow(  pow(abs(cos(0.25*m2*(f_ph(x,z,y)-pi/2))/a2),n22)  +
>>                      pow(abs(sin(0.25*m2*(f_ph(x,z,y)-pi/2))/b2),n32)
>>                    ,1/n12)  *
>>
>>                pow(  pow(abs(cos(0.25*m1*atan2(x,y))/a1),n21)  +
>>                      pow(abs(sin(0.25*m1*atan2(x,y))/b1),n31)
>>                    ,1/n11)  *
>>
>>                    f_r(x,y,z)
>>                - 1
>>              }
>>     max_gradient 20
>>     contained_by { box { <-2,-2,-2>,<2,2,2> } }
>>    }
>>
>> #end
>>
>> Regards, Hans
>>
>> Tor Olav Kristensen wrote:
>>
>>> Hans de Vries wrote:
>>> ...
>>>
>>>>     function {
>>>>                pow(  
>>>> pow(abs(cos(0.25*m2*asin(z/sqrt(x*x+y*y+z*z)))/a2),n22)  +
>>>>                      
>>>> pow(abs(sin(0.25*m2*asin(z/sqrt(x*x+y*y+z*z)))/b2),n32)
>>>>                    ,1/n12)  *
>>>>
>>>>                pow(  
>>>> pow(abs(cos(0.25*m1*acos(y/sqrt(x*x+y*y))*abs(y)/y)/a1),n21)  +
>>>>                      
>>>> pow(abs(sin(0.25*m1*acos(y/sqrt(x*x+y*y))*abs(y)/y)/b1),n31)
>>>>                    ,1/n11)  *
>>>>
>>>>                    sqrt (x*x+y*y+z*z)
>>>>                - 1
>>>>              }
> 
> 
>


Post a reply to this message

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