如何在 2D 中的 2 个点之间创建一条曲线并获取每隔 d 距离形成该曲线的点?
我数学不好。
我有 2 个点,2D 中的 A(x1, y1)
和 B(x2, y2)
。
我需要创建一条从点 A
到 B
以 R(半径)弯曲的虚拟路径,然后返回描述该弯曲路径的点数组,并非全部可能彼此之间每隔 D(距离)。
在Java中我需要一个像这样的方法:
private ArrayList<PointF> generateCurve(PointF pFrom,PointF pTo,float pRadius,float pMinDistance){
ArrayList<PointF> pOutPut = new ArrayList<PointF>();
// ...generate result to pOutPut
return pOutPut;
}
如何做到这一点?
I'm not good in math.
I have 2 points, A(x1, y1)
and B(x2, y2)
in 2D.
I need to create a virtual path from point A
to B
curved at R(radius), and then return an array of points which are describing this curved path, not all maybe every D(distance) from each other.
In Java I need a method like this:
private ArrayList<PointF> generateCurve(PointF pFrom,PointF pTo,float pRadius,float pMinDistance){
ArrayList<PointF> pOutPut = new ArrayList<PointF>();
// ...generate result to pOutPut
return pOutPut;
}
How to do this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我没有放弃,我又为此努力了几个小时。结果如下:
我创建了一个方法,您可以在其中指定是否需要点之间的最长弧线和最短弧线。
以下是对它的一些调用,以及生成的输出:
正如您可以看到,它正在发挥作用。代码如下:
享受吧!
PS:我创建了两个数学问题来解决您的问题:
I didn't gave up and I've been working on it for a few more hours. And here is the result:
I created a method where you can specify if you want the shortest of the longest arc between the points.
Here are some calls to it, with the produced output:
As you can see, it is working like a charm. Here is the code:
Enjoy!
PS: I created two questions on Mathematics to solve your question:
这有效:
这是当我这样调用它时得到的结果:
generateCurve(new Point2D.Double(10,10), new Point2D.Double(400, 400), 300, 15)
This works:
Here is what I get when I call it like this:
generateCurve(new Point2D.Double(10,10), new Point2D.Double(400, 400), 300, 15)