线缩放 - 如何获取新坐标?

发布于 2024-11-05 03:16:01 字数 408 浏览 4 评论 0原文

我正在开发一个涉及线缩放的应用程序。我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

昨迟人 2024-11-12 03:16:01

您想研究直线方程。通过幅度和起点,您可以轻松计算给定长度的终点。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文