我不需要真正的命令或方法,我只想知道如何构建for / while循环以绘制曲线。我已经可以绘制了,但是我不知道如何使用度数变化绘制曲线。
例如:
for(int x = 0; x!= 30; x ++)
这里缺少改变度数的值的部分。
答案 0 :(得分:1)
很难猜出你的意思
使用度数变化曲线
因为有很多绘制曲线的方法
假设x
是您度过的角度,则可以轻松绘制arc():
size(900,900);
noFill();
for(int x = 0; x != 30; x++){
// optional: visualise angle/arc as a grayscale stroke
stroke(map(x,0,29,255,0));
// render an arc at the current angle: notice the angle is in radians
// args: x, y, width, height, startAngle, stopAngle, arcType
arc(450, 450, 810, 810, 0, radians(x), PIE);
}
还有其他类型的曲线处理支持:检出贝塞尔曲线和曲线函数(例如bezierPoint()
,curvePoint()
)