Seashell surfaces
These are parametric isosurfaces using variations of functions like:
#declare W = function(u){u/(2*pi)}
#declare Fx = function(u,v){W(u)*cos(N*u)*(1+cos(v))}
#declare Fy = function(u,v){W(u)*sin(N*u)*(1+cos(v))}
#declare Fz = function(u,v){W(u)*sin(v) + H*pow(W(u),2)}
Where
- H controls the height of the shell
- N is the number of turns
u/(2*pi) simply gives a value that goes linearly from 0 to 1 as u goes from 0 to 2*pi.
It turns up several times in the functions, so I've made it into a separate sub-function W(u)
I started with the parametric functions for a torus:
#declare Fx = function(u,v){cos(u)*(1+cos(v))}
#declare Fy = function(u,v){sin(u)*(1+cos(v))}
#declare Fz = function(u,v){sin(v)}
The first parts of Fx, Fy and Fz are multiplied by R(u) so that
the radius of the tube increases linearly as u increases.
The N*u factors that occur in Fx and Fy cause the tube to
go round the origin N times.
Then I added +H*pow(W(u),2) to Fz so that the turns
of the spiral are offset in the z direction by a distance that varies from 0 to H.
I found that I needed to
square the u/(2*pi) term, otherwise the offset was too
rapid at the start.
|