Koch curve: Difference between revisions
m
→{{header|J}}: bring image onto rosettacode so it can be displayed on page
m (→{{header|J}}: bring image onto rosettacode so it can be displayed on page) |
|||
Line 1,173:
plot koch ^: 5 tri</syntaxhighlight>
[[
The idea is to continually expand the segments between a list of points in the complex plane. Given consecutive x and y in the list, v = (y-x)/3 is a vector representing 1/3 of the trip from x to y. An iteration building the Koch curve starts at x, advances by v, advances by v rotated by 60 degrees, advances by v rotated -60 degrees, and finally advances by another v, reaching y. x seg y produces this expansion. koch takes a list of points and expands segments between consecutive ones, producing another list. koch ^: 5 does this 5 times, and plot shows the snowflake in a window.
|