POV-Ray : Newsgroups : povray.newusers : How do I Perform Transformations on Isosurface, like Scale, Shear, Rotate e= : Re: How do I Perform Transformations on Isosurface, like Scale, Shear, Rotate e= Server Time
3 Sep 2024 08:15:15 EDT (-0400)
  Re: How do I Perform Transformations on Isosurface, like Scale, Shear, Rotate e=  
From: Mike Williams
Date: 22 Jan 2005 01:25:05
Message: <FYripHAgFf8BFwO2@econym.demon.co.uk>
Wasn't it mephuser who wrote:
>How do I Perform Transformations on Isosurface, like Scale, Shear, Rotate
>etc?
>
>How do I modify the code?

The "scale" and "rotate" keywords work perfectly well for isosurfaces. 

To shear an isosurface you can perform variable substitution.
See <http://www.econym.demon.co.uk/isotut/substitute.htm> for the
principles involved.

Here's a sheared box. I'm using a box because it's easy to see the
effect of the shear, scale and rotation. Just replace F with the
function of your isosurface.

#declare F=function{max((y*y-1),(x*x-1),(z*z-1))}
isosurface {
  function { F(x-y/3,y,z) }
        max_gradient 3
        contained_by{sphere{0,2}}
        pigment {rgb 1}
}


You can perform scaling and rotation by substituting the variables, but
you will usually need to adjust the size of the contained_by object and
max_gradient, which is unnecessary when you use the "scale" and "rotate"
keywords.

Here's a scaled box:

#declare F=function{max((y*y-1),(x*x-1),(z*z-1))}
#declare XScale=2;
#declare YScale=1;
#declare ZScale=0.5;
isosurface {
  function { F(x/XScale, y/YScale, z/ZScale) }
        max_gradient 14
        contained_by{sphere{0,3}}
        pigment {rgb 1}
}


Here's a box rotated by 30 degrees about the y axis.

#declare F=function{max((y*y-1),(x*x-1),(z*z-1))}
#declare A=radians(30);
isosurface {
  function { F(x*cos(A)-z*sin(A), y, z*cos(A)+x*sin(A)) }
        max_gradient 4
        contained_by{sphere{0,2}}
        pigment {rgb 1}
}

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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