• March 05, 2021, 02:16:39 PM

Login with username, password and session length

Author Topic:  Triangles - often overlooked primitive in StructureSynth  (Read 86 times)

0 Members and 1 Guest are viewing this topic.

Offline kronpano

  • Moderator
  • ******
  • Posts: 43
    • BrowserSynth
Triangles - often overlooked primitive in StructureSynth
« on: December 14, 2020, 01:35:52 PM »
The "problem" with triangles is that you can "see" them only from one side - so I tend to define the triangle twice.
One clockwise and the other one counter clockwise.
Once that is done they open up a lot of new structures - here are 5 of them
All basically generated in the same way - just with positive or negative rotation.
Code: [Select]
set background #777

set colorpool list:#E13800,#DF811D,#92C6C2,#E1D0B2

rule regtri2{
{s 1 } triangle[-1,0,1;0,1,0;1,0,1]
{s 1 } triangle[1,0,1;0,1,0;-1,0,1]
}

rule wtribox1{
4 * { rz 90 x  1} 4 * {ry -90 x 1} 1 * { ry -90 x 1 color random }regtri2
}
rule wtribox2{
4 * { rz -90 x  1} 3 * {ry 90 x 1} 1 * { ry 90 x 1 color random }regtri2
}
rule wtribox3{
4 * { rz 90 x  1} 3 * {ry 90 x 1} 1 * { ry 90 x 1 color random }regtri2
}
rule wtribox4{
4 * { rz -90 x  1} 3 * {ry -90 x 1} 1 * { ry -90 x 1 color random }regtri2
}
rule wtribox5{
4 * { rz -90 x  1} 4 * {ry 90 x 1} 1 * { ry -90 x 1 color random }regtri2
}

3 * {y -4 x 5 rz 30}wtribox5
1 * { y 4} 3 * {y -4 x 5 rz 30}wtribox4
1 * { y 7} 3 * {y -4 x 5 rz 30}wtribox3
1 * { y 12} 3 * {y -4 x 5 rz 30}wtribox2
1 * { y 15} 3 * {y -4 x 5 rz 30}wtribox1

That will create the image below.

Linkback: https://fractalforums.org/structuresynth-and-browsersynth/79/triangles-often-overlooked-primitive-in-structuresynth/3929/

Offline kronpano

  • Moderator
  • ******
  • Posts: 43
    • BrowserSynth
Re: Triangles - often overlooked primitive in StructureSynth
« Reply #1 on: December 14, 2020, 01:36:41 PM »
Put a couple of boxes in the mix and you get something like that

Offline kronpano

  • Moderator
  • ******
  • Posts: 43
    • BrowserSynth
Re: Triangles - often overlooked primitive in StructureSynth
« Reply #2 on: December 14, 2020, 01:51:41 PM »
Triangles can also be used for Rubik's snake like structures
Code: [Select]
snake

rule snake{
snakepart
{ry 90 rz 90 x -10}snake
}
rule snake w 0.1{
snakepart
{rz 90 x -10}snake
}
rule snake w 0.2{
snakepart
{rz 180 x 0}snake
}


rule snakepart{
{color red}snakepart1
{rz -45 s 0.02 9 9 rz -45 color white}box
}

rule snakepart{
{color white}snakepart1
{rz -45 s 0.02 9 9 rz -45 color red}box
}
rule snakepart{
{color black}snakepart1
{rz -45 s 0.02 9 9 rz -45 color red}box
}

rule snakepart1{
{s 10}tri
{s 10 z 1}tri
{y -5 s 10 0.01 10}box
{x 5 s 0.01 10 10}box
{rz -45 s 0.01 10 10 rz -45}box
}

rule tri{
triangle[0,0,0; 1,0,0;1,1,0]
triangle[0,0,0; 1,1,0;1,0,0]
}

Offline kronpano

  • Moderator
  • ******
  • Posts: 43
    • BrowserSynth
Re: Triangles - often overlooked primitive in StructureSynth
« Reply #3 on: December 14, 2020, 02:57:00 PM »
Or perhaps even some pagoda style houses with roofs

Basic code for one house:
Code: [Select]
set background #777
#define wid 0.1
#define len 2.1

{s 5}house

rule house{
{y -1 z 0.1}roof
{y 0 s 2 color lightgray b 1.2 a 0.9}box
{y -1 color brown}f_box
}


rule f_box md 4{
frame
{x 1 y 1 rz 90}f_box
}

rule frame {
{ z 1 s len wid wid } box
{ z -1 s len wid wid } box
{ x 1 s wid wid len } box
}

rule roof{
1 * {y 1 x -0.2 z 0.34 rz 45 s 1.1 1.1 1} 1 * {ry -90}rot1
}

rule rot1 md 4{
{y 0.05 s 1.2 1.6 0.7 }diamond1
{ y -0.35 rz 0 rx 90}rot1
}

rule diamond1{
{ s 0.5} py1
{ s 0.5 fz z 1 } py1
}

rule py1 {
{s 1 } triangle[3,0,0;2,0,0;1.5,2.6,0]
{s 1}triangle[2,0,0;3,0,0;1.5,1.3,2.6]
{s 1 }triangle[1.5,2.6,0;2,0,0;1.5,1.3,2.6]
{s 1 }triangle[3,0,0;1.5,2.6,0;1.5,1.3,2.6]
}


clip
BrowserSynth and StructureSynth

Started by kronpano on Image Threads

4 Replies
283 Views
Last post September 18, 2020, 03:53:03 PM
by kronpano
xx
StructureSynth tutorials

Started by Sabine62 on Fractal Programs Discussion, Help, & Support

6 Replies
329 Views
Last post July 29, 2020, 11:50:34 AM
by kronpano
clip
Mesh - the other forgotten primitive

Started by kronpano on StructureSynth & BrowserSynth

0 Replies
32 Views
Last post February 21, 2021, 06:30:10 PM
by kronpano
question
Making a custom primitive from existing primitives

Started by Tas_mania on Mandelbulber

11 Replies
914 Views
Last post April 08, 2019, 11:39:07 AM
by Tas_mania
clip
BrowserSynth - a StructureSynth implementation that runs in a web browser

Started by kronpano on Fractal Image Gallery

2 Replies
223 Views
Last post July 24, 2020, 02:35:24 AM
by gerson