|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
Wasn't it mephuser who wrote:
>How do I Perform Transformations on Isosurface, like Scale, Shear, Rotate
>etc?
I suddenly had a thought about how to do all these by variable
substitution, and have written it up in my isosurface tutorial.
<http://www.econym.demon.co.uk/isotut/substitute.htm#shear>
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
![](/i/fill.gif) |