Question: Multiple plots on the same graph

Hi all, im just starting with maple, mostly teaching myself how to code, but as you can see, i require some assistance.

ok, so, the basis of this program is to recreate the chaos game, check-out wikipedia if you want to know more, the chaos game is a basic and easy way to make the sierpinski triangle.

my problem is getting multiple plots on the same graph (see my code below)

the plots are in a loop, so each time the loop executes, a new point will be plotted on the original graph (the one right at the beginning that makes a triangle.

anyway, any help would be much appreciated.

Trent.
p.s. The code hasnt copied perfectly, i.e. there are ; when there should be : and probably other little stuff as well.

 

xpoints := Vector([1, 2.5, 4, 1]);
ypoints := Vector([1, 4, 1, 1]);
plot(xpoints, ypoints);

original1 := Vector([2]);
original2 := Vector([2]);
iterations := 5;
for repeat from 1 to iterations do
plot(original1, original2, style = point, symbol = diagonalcross);
random := RandomTools[Generate](integer(range = 1 .. 3));

if random = 1 then
dist1 := (original1+xpoints(1))*(1/2);
dist2 := (original2+ypoints(1))*(1/2);
plot(dist1, dist2, style = point, symbol = diagonalcross, color = "Red")
original1 = dist1;
original2 = dist2;
elif random = 2 then
dist1 := (original1+xpoints(2))*(1/2);
dist2 := (original2+ypoints(2))*(1/2);
plot(dist1, dist2, style = point, symbol = diagonalcross, color = "Green")
original1 = dist1;
original2 = dist2 ;
elif random = 3 then
dist1 := (original1+xpoints(3))*(1/2);
dist2 := (original2+ypoints(3))*(1/2);
plot(dist1, dist2, style = point, symbol = diagonalcross, color = "Blue")
original1 = dist1;
original2 = dist2;
end if;
end do;





Please Wait...