Trippy vase

... in OpenSCAD

Spiral it!

step=$preview ? 1 : 1;

phi=(1+sqrt(5))/2;

function surf(theta,z,height,R)=R*(1+sin(phi*90*z/height))*(1+.25*(cos(1*360*z/height)+.5*sin(10*theta+sqrt(2)*360*z/height)+.5*sin(5*theta-sqrt(3)*360*z/height)));

eps=.1;
h=1.2;
module vase(height=100,sides=360,R=30,top=true,bottom=true){
    points=[
        for(z=[0:step:height])
        for(theta=[0:sides-1])
        let(r=surf(theta,z,height,R),
            x=r*cos(theta),
            y=r*sin(theta))
        [x,y,z]];

    faces=concat(
        [
            // Triangle #1
            for(z=[0:(height-1)/step])
            for(s=[0:sides-1])
            let(// clockwise from left-down corner
                f1=s+sides*z,
                f2=s+sides*(z+1),
                f3=((s+1)%sides)+sides*(z+1),
                f4=((s+1)%sides)+sides*z)
            [f1,f2,f3]],
        [
            // Triangle #2
            for(z=[0:(height-1) / step])
            for(s=[0:sides-1])
            let(// clockwise from left-down corner
                f1=s+sides*z,
                f2=s+sides*(z+1),
                f3=((s+1)%sides)+sides*(z+1),
                f4=((s+1)%sides)+sides*z)
            [f3,f4,f1]],

        [if (bottom==true) [for(s=[0:sides-1]) s]],  //bottom;

        [if (top==true) [for(s=[sides-1:-1:0]) (height/step)*(sides)+s]] //top
    );

    polyhedron(points=points, faces=faces);
}

vase(height=180,sides=360,R=30,top=true,bottom=true);

Palavras chave/keywords: 3dprint, openscad, stl, math, Fourier

Criado/Created: 27-11-2021 [15:26]

Última actualização/Last updated: 29-11-2021 [16:15]


Voltar à página inicial.


GNU/Emacs Creative Commons License

(c) Tiago Charters de Azevedo