Skip to main content
Added inline image
Source Link
Thomas W.
  • 1.1k
  • 6
  • 8

PostScript, 120 chars

-7 -4 moveto 14 0 rlineto 7{true upath dup 2{120 rotate uappend}repeat[2 0 0 2 7 4]concat}repeat matrix setmatrix stroke 

Ghostscript output: http://troll.ws/i/zxUNk7.png (Sorry, I'm not allowed to include an image)

Rendered Ghostscript output

This is drawing the figure by recursively tripling what's already drawn.

First step is drawing a line. The line is saved as a userpath, then the userpath is added two more times after rotating 120 degrees each time. [2 0 0 2 7 4]concat moves the "rotation point" to the center of the next big white "center triangle" that is to be enclosed by replications of the triangle we already have. Here, we're back to step 1 (creating a upath that's tripled by rotation).

The number of iterations is controlled by the first number in line 3.

PostScript, 120 chars

-7 -4 moveto 14 0 rlineto 7{true upath dup 2{120 rotate uappend}repeat[2 0 0 2 7 4]concat}repeat matrix setmatrix stroke 

Ghostscript output: http://troll.ws/i/zxUNk7.png (Sorry, I'm not allowed to include an image)

This is drawing the figure by recursively tripling what's already drawn.

First step is drawing a line. The line is saved as a userpath, then the userpath is added two more times after rotating 120 degrees each time. [2 0 0 2 7 4]concat moves the "rotation point" to the center of the next big white "center triangle" that is to be enclosed by replications of the triangle we already have. Here, we're back to step 1 (creating a upath that's tripled by rotation).

The number of iterations is controlled by the first number in line 3.

PostScript, 120 chars

-7 -4 moveto 14 0 rlineto 7{true upath dup 2{120 rotate uappend}repeat[2 0 0 2 7 4]concat}repeat matrix setmatrix stroke 

Ghostscript output:

Rendered Ghostscript output

This is drawing the figure by recursively tripling what's already drawn.

First step is drawing a line. The line is saved as a userpath, then the userpath is added two more times after rotating 120 degrees each time. [2 0 0 2 7 4]concat moves the "rotation point" to the center of the next big white "center triangle" that is to be enclosed by replications of the triangle we already have. Here, we're back to step 1 (creating a upath that's tripled by rotation).

The number of iterations is controlled by the first number in line 3.

Source Link
Thomas W.
  • 1.1k
  • 6
  • 8

PostScript, 120 chars

-7 -4 moveto 14 0 rlineto 7{true upath dup 2{120 rotate uappend}repeat[2 0 0 2 7 4]concat}repeat matrix setmatrix stroke 

Ghostscript output: http://troll.ws/i/zxUNk7.png (Sorry, I'm not allowed to include an image)

This is drawing the figure by recursively tripling what's already drawn.

First step is drawing a line. The line is saved as a userpath, then the userpath is added two more times after rotating 120 degrees each time. [2 0 0 2 7 4]concat moves the "rotation point" to the center of the next big white "center triangle" that is to be enclosed by replications of the triangle we already have. Here, we're back to step 1 (creating a upath that's tripled by rotation).

The number of iterations is controlled by the first number in line 3.