在 OpenSCAD 中生成一个点 (vector/matrix)?

Generating a point (vector/matrix) in OpenSCAD?

我想以编程方式创建 polyhedron in OpenSCAD by generating its point vectors。但是,为矩阵赋值...

p = [1,0,0];
r = [[], [], [], [], [], [] ];

for( i=[0:5] ) 
{
    echo("i=",i);
    r[i] = [0,1];
}

... 产生语法错误:

ERROR: Parser error in line 7: syntax error 
ERROR: Compilation failed! 

我是不是弄错了(哪个)或者这些类型真的只是只读的(没有按索引赋值)?

分配后无法修改r

有关可以生成列表的表达式,请参阅 https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/List_Comprehensions

示例:

points = [ for (a = [0 : 5 : 359]) [ 20 * sin(a), 10 * cos(a) ] ];
polygon(points);