线缩放 - 如何获取新坐标?
我正在开发一个涉及线缩放的应用程序。我正在使用 Java/GWT,所以如果已经有内置的东西那就太好了。我知道这是非常基本的数学,但我无法理解它(在你问之前它不是家庭作业)。
我知道可以用 Trig 来完成,但这是一段将运行 1000 次的代码,因此如果可能的话,它需要是基本操作 (- + / *)
本质上,橙色线按比例放大并产生蓝色线。
我有:
- 坐标 (x1, y1) & (x2,y2)
- 橙色线的长度(毕达哥拉斯)
- 蓝色线的长度
我需要:
- 坐标(u1,v1)& (u2, v2)
I am working on a application which involves line scaling. I am working in Java/GWT so if there is already something inbuilt it would be great. I know this is very basic maths but I can't get my head around it (not its not homework before you ask).
I know it can be done with Trig, but this is a piece of code that will be run 1000s of times so it needs to be basic operations if possible (- + / *)
Essentially the orange line scales up and produces the blue line.
I have:
- Coordinates (x1, y1) & (x2, y2)
- Length of orange line (by Pythagoras)
- Length of blue line
I need:
- Coordinates (u1, v1) & (u2, v2)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想研究直线方程。通过幅度和起点,您可以轻松计算给定长度的终点。
Y = mx + b
这是一个快速教程:
http://www.mathsisfun.com/equation_of_line.html< /a>
你也可以用谷歌搜索共线点,这实际上就是你正在寻找的。
或者,您可以使用向量数学:
http://www.netcomuk.co.uk/~ jenolive/vect3.html
You want to look into the equation of a straight line. With the magnitude and start point you can easily calculate the end point for a given length.
Y = mx + b
Here is a quick tutorial:
http://www.mathsisfun.com/equation_of_line.html
You could also google for collinear points which is actually what you are looking for.
Alternativly you could use vector maths:
http://www.netcomuk.co.uk/~jenolive/vect3.html