【发布时间】:2015-04-26 04:31:14
【问题描述】:
我正在尝试创建一个创建自定义模式的程序。我有它,如果边 = 3,它是一个三角形 4 = 矩形,并且上面的任何其他东西都有一个公式,所以如果你真的想要,你可以有 25 个边。我正在使用线条、旋转和旋转来种植、转动、绘制重复。
angleMeasure = (180 * (sides-2) ) /sides;
println(angleMeasure);
println(radians(angleMeasure));
//creating the 5+ shape
pushMatrix();
translate(width/2, height/2); //translating the whole shape/while loop
while(counter < sides){
line(0,0,170,0);
translate(170,0);//THIS translate is what makes the lines go in the direction they need too.
rotate(angleMeasure);
counter = counter + 1;
这几乎可以正常工作。最后一行和第一行没有连接。建议?也许这是数学问题,但 println 以度为单位揭示了正确的角度测量值。这是它的样子:http://i.stack.imgur.com/TwYMj.png
编辑:将旋转从 rotate(angleMeasure) 更改为 rotate(angleMeasure * -1)。这旋转了整个形状,并清楚地表明第一行的角度是关闭的。见:http://i.stack.imgur.com/Z1KmY.png
【问题讨论】:
-
你能上传一张4面的图片吗?
-
您能用
rotate(radians(angleMeasure));再试一次吗?处理中的所有角度输入都应以弧度为单位。
标签: math image-processing processing