Welcome to Fractal Forums

Fractal Software => Structure Synth Gallery => Topic started by: barcud on April 16, 2016, 09:52:13 PM




Title: Turbo Squid - with javascript and Structure Synth parameters
Post by: barcud on April 16, 2016, 09:52:13 PM
One of the first tries to bring the java-script together with direct Structure Synth generated parts.

Javascript:
Code:
#javascript

Builder.load("sinwaveSculpture5turbine_es.es");
max =480;
z_height=2

Builder.append("rule sinwave{")
for (i = 0; i <=  max; i+=1) {
trig_val=i*2.8/max
sin_x=48*i/max
sin_y=8*Math.sin(trig_val)-Math.sin(trig_val)
rot_z=88*Math.cos(trig_val)
sin_updown=Math.sin(trig_val*2)
wsx="{ y "+ sin_y + " x " +sin_x +" rz "+ rot_z +" ry "+ (70-sin_updown*260) +" rz "+ 80*sin_updown +" y -3 s 0.2 "+ (4.2+sin_updown*4) +" "+ (1.5+sin_updown*1.3)+" color red b 0.5 sat 0.8 h "+ (100+sin_updown*79)+"} box"
Builder.append(wsx)
}

Builder.append("}")
Builder.build();

EisenScript (save as sinwaveSculpture5turbine_es.es):
Code:
mysin

rule mysin md 6{
{rx 0} sinwave
{rx 60} mysin
}

{x 45 z 3 y -1 s 1.5  rz -90 color orange b 0.8 sat 0.8} thrusters


rule thrusters{
1 * {rx 0  s 0.2 2.6 0.2}TRing
}

rule TRing  md 32
{
{ ry 5.625  rx 33 }TRingPart  // different rx produce nice results
2 * {rz 180 y -1} 1 * { ry 5.625  rx -14}TurbineCone
{ ry 11.25 rx 0 x 1.7 } TRing
}

rule TRingPart{
{ b 0.25 y -1.5 rx -90 }troof       // with that you get a roof structure
{ b 0.4 a 0.5 y 1.0 s 2.0 1 0.1 } box
{ b 0.4 a 0.5 z 2 y 1.0 s 2.4 1 0.1 } box
{ s 2.4 0.1 2.25 y 4 z 0.44 }box  // white tiles outward
{z -2  y -0.6 s 12 0.1 5 }box  // turbo fan inside out
}

rule troof{
{ z 4 } panel
{ z 3 s 0.8 0.1 1.75 } box
{ y -1.9 z 3 s 0.1 0.1 1.925 } box
}

rule panel{
{ s 2.2 0.1 0.125 } box  //bottom ones
{ y -1 s 0.2 2 0.1  } box  // vertical ones
{ y -1.925 s 2.3 0.1 0.25} box  //top ones
}

rule turbineCone{
{ s 1 0.1 5.5 y 12 z -1 }box
}