确定贝塞尔曲线是否与圆重叠的最佳方法是什么?

What is the best way to determine whether a bezier is overlapping a circle?

在 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