[問題] 請問程式碼是哪裡出了問題呢??
以下為程式碼
------------------------------------------------------------------------------
> with(plots);
> with(plottools);
> with(geometry);
> Sierpinski := proc (x1, y1, x2, y2, x3, y3, x4, y4, n)
if n <= 1 then
[(1/2)*x1+(1/2)*x2, (1/2)*y2+(1/2)*y3, 0, (1/3)*x2-(1/3)*x1]
else
Sierpinski(x1, y1, x2, y2, x3, y3, x4, y4, n-1),
Sierpinski(x1, (1/3)*y1+(2/3)*y4, (2/3)*x4+(1/3)*x3, (1/3)*y1+(2/3)*y4, (2/3)*x4+(1/3)*x3,
y4, x4, y4, n-1),
Sierpinski(x1, (1/3)*y4+(2/3)*y1, (2/3)*x4+(1/3)*x3,
(1/3)*y4+(2/3)*y1, (2/3)*x4+(1/3)*x3, (1/3)*y1+(2/3)*y4, x1,
(1/3)*y1+(2/3)*y4, n-1),
Sierpinski(x1, y1, (2/3)*x4+(1/3)*x3, y1,
(2/3)*x4+(1/3)*x3, (1/3)*y4+(2/3)*y1, x1, (1/3)*y4+(2/3)*y1, n-1),
Sierpinski((2/3)*x4+(1/3)*x3, y1, (1/3)*x1+(2/3)*x2, y1, (1/3)*x1+(2/3)*x2,
(1/3)*y4+(2/3)*y1, (2/3)*x4+(1/3)*x3, (1/3)*y4+(2/3)*y1, n-1),
Sierpinski((1/3)*x1+(2/3)*x2, y1, x2, y2, x2, (2/3)*y2+(1/3)*y3,
(1/3)*x1+(2/3)*x2, (1/3)*y4+(2/3)*y1, n-1),
Sierpinski((1/3)*x1+(2/3)*x2,
(1/3)*y4+(2/3)*y1, x2, (2/3)*y2+(1/3)*y3, x2, (1/3)*y2+(2/3)*y3,
(2/3)*x3+(1/3)*x4, (1/3)*y2+(2/3)*y3, n-1),
Sierpinski((2/3)*x3+(1/3)*x4,
(1/3)*y2+(2/3)*y3, x2, (1/3)*y2+(2/3)*y3, x3, y3, (2/3)*x3+(1/3)*x4, y3,
n-1),
Sierpinski((2/3)*x4+(1/3)*x3, (1/3)*y1+(2/3)*y4, (2/3)*x3+(1/3)*x4,
(1/3)*y2+(2/3)*y3, (2/3)*x3+(1/3)*x4, y3, (2/3)*x4+(1/3)*x3, y4, n-1)
end if
end proc;
>
%;
> Tlist := [Sierpinski(0, 0, 512, 0, 512, 512, 0, 512, 2)];
print(`output redirected...`); # input placeholder
[[ 512] [256 1280 512] [256 512]
[[256, 256, 0, ---], [---, ----, 0, ---], [---, 256, 0, ---],
[[ 3 ] [ 3 3 9 ] [ 3 9 ]
[256 256 512] [ 256 512] [1280 256 512]
[---, ---, 0, ---], [256, ---, 0, ---], [----, ---, 0, ---],
[ 3 3 9 ] [ 3 9 ] [ 3 3 9 ]
[1280 512] [1280 1280 512] [ 1280 512]]
[----, 256, 0, ---], [----, ----, 0, ---], [256, ----, 0, ---]]
[ 3 9 ] [ 3 3 9 ] [ 3 9 ]]
>
> n := nops(Tlist);
p[i] := hexahedron([Tlist[i][1], Tlist[i][2], Tlist[i][3]], Tlist[i][4]);
plots[display]([seq(p[i], i = 1 .. n)]);
%;
9
Error, (in plots/polyhedraplot) first argument must be a list of three tuples
Error, (in plots:-display) expecting plot structures but received: [p[1],
p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]]
------------------------------------------------------------------------------
最後三行是所顯示的問題
有哪位高手大大可以告訴我是哪裡出了問題
怎麼改嗎??
謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.41.227.118
※ 文章網址: http://www.ptt.cc/bbs/Maple/M.1402244578.A.547.html
→
06/09 10:30, , 1F
06/09 10:30, 1F
→
09/13 21:56, , 2F
09/13 21:56, 2F
Maple 近期熱門文章
PTT數位生活區 即時熱門文章