在 Java/Processing 中,我想测试贝塞尔曲线是否与圆重叠,以便我可以将其中一个移开。
有没有简单的方法来做到这一点?
最佳答案
您可以使用 bezierPoint()
函数沿着贝塞尔曲线获取一系列点。
然后您可以针对您的圆圈测试这些点。
来自 the reference :
noFill();
bezier(85, 20, 10, 10, 90, 90, 15, 80);
fill(255);
int steps = 10;
for (int i = 0; i <= steps; i++) {
float t = i / float(steps);
float x = bezierPoint(85, 10, 90, 15, t);
float y = bezierPoint(20, 10, 90, 80, t);
ellipse(x, y, 5, 5);
}
(来源:processing.org)
关于java - 确定贝塞尔曲线是否与圆重叠的最佳方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36360916/