POV-Ray : Newsgroups : povray.newusers : Add twist to isosurface : Re: Add twist to isosurface Server Time
27 Jun 2024 17:30:16 EDT (-0400)
  Re: Add twist to isosurface  
From: Alain
Date: 25 Jun 2012 12:43:54
Message: <4fe8954a$1@news.povray.org>

>
> Hello,
>
> I made a simple isosurface defined as a cylinder minus a groove :
>
>    function { sqrt(pow(x,2) + pow(z,2)) - Groove(x,z) }
>
> with :
>
>    Groove = function(a,b) { R + q - 2*q*abs(cos(ang(a,b)))}
>
>
> Now, a want to twist this isosurface along y axis. I found on Internet
> that, x and z must be modified with functions like this :
>
>    TwistX = function { x*cos(a*y) - z*sin(a*y) }
>    TwistZ = function { x*sin(a*y) + z*cos(a*y) }
>
>
> ok... but how to 'put' this twist's functions 'in' my main isosurface
> function ?
>
>
> this should be simple, but I can not do :(
>
>
> thanks.
>
One possibility would be to add that twist in the function call:

#declare Grooved_Cylinder = function { sqrt(pow(x,2) + pow(z,2)) - 
Groove(x,z) }

object{Grooved_cylinder(x*cos(a*y) - z*sin(a*y), y, x*sin(a*y) + z*cos(a*y))

This will displace the sample points passed to the function and make it 
look twisted.
To reverse the twisting direction, use -y in the sin and cos.



Alain


Post a reply to this message

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