in reply to Re: Fractal Curves: Short & Fast Codes?
in thread Fractal Curves: Short & Fast Codes?

No, I defined plotxy() in the code; it isn't part of GD. I only included it in Closure, omitted elsewhere since it's redundant to include it three times in the post.

As for the two lines...

If $xy = [[4,5,6],[4,5,6]], scalar(@{$xy->[0]}) = scalar(@{$xy->[0]}) = 3, the number of elements.

$xy->[0] points to the first array in $xy; $xy->[1] second.

@{$xy->[0]} dereferences $xy->[0] into an array.

So, $xy->[0][scalar(@{$xy->[0]})] will be like $xy->[0][3], the new element in the array, yet to be defined, since the index of the last position is 2.

$d*sin(PI*$h/180) is just some transformation stuff from trigonometry/geometry/calculus.

$#{@{$xy->[0]}} gives you the index of the last element, which is 2 in this example.

So, $xy->[0][$#{@{$xy->[0]}}] = $xy->[0][$#{@{$xy->[1]}}] gives you 6.

(I've noticed you have "...$+#..." in your reply. When you see + in a code in the post, it indicates a continuation from the previous line. When you cut and past codes, those + might be inadvertently included. Remember to remove them.)

Hence, the two lines basically say,

new x coordinate = distance (on x axis) from old x coordinate + old x coordinate
new y coordinate = distance (on y axis) from old y coordinate + old y coordinate