给定3个点,如何构造穿过它们的弧?
假设我有 3 个连续的点(P1
、P2
、P3
),如何构建穿过所有 3 个点的弧?
圆弧必须具有以下 3 个属性:
- 起始弧度
- 结束弧度
- 中心点
圆弧以逆时针方式从起始弧度
到结束弧度
绘制。
我已经尝试过此处的解决方案,但它不起作用,只是因为它假设 P1
必须对应于 Start Radian
并且 P3
必须对应于 end radian
。但现实情况是,这并不总是有效。
Let's say I have 3 consecutive points (P1
,P2
, P3
), how to construct an Arc that passes through all 3 points?
The arc must have the following 3 properties:
- Start Radian
- End Radian
- Center Point
The arc is drawn from Start Radian
to End Radian
in counter-clockwise manner.
I've tried with the solution here, but it doesn't work, simply because it assumes that P1
must correspond to Start Radian
and P3
must correspond to end radian
. But the reality is that this is not always valid.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
按照您希望弧线采用的顺序在它们之间画两条线。将两条线一分为二,得到它们的法线。法线的交点是圆弧的中心。以给定的中心从一个端点到另一端点绘制圆弧。
Draw two lines between them, following the order you want the arc to take. Bisect both lines, coming up with their normals. The intersection of the normals is the center of the arc. Draw your arc from one endpoint to the other, with the given center.
我也有同样的问题。这是 C 语言的一个小片段。正如您所看到的,中心点有两个可能的点。我希望它有帮助。感谢我即将出生的伊格纳西奥:
I had the same problem. Here is a small snippet in C for that. As you can see there are two possible points for the center point. I hope it helps. Credits to my soon Ignacio: