JavaScript 三项式问题

发布于 2024-08-19 03:59:10 字数 235 浏览 3 评论 0原文

好的,使用 Javascript(或者我可以轻松转换的东西,我非常了解 BASIC,但对 C++ 和 C# 有点生疏)我需要解决这个问题/方程:

给定一条线的起点和终点(在 x,y 中,和 z) 线上的哪一点满足方程

A*x+B*y+C*z=D

A、B、C 和 D 的定义,但 xy 和 z 是未知的,但它们位于我上面知道的那条线上。我需要从中得到该点的 x、y 和 z。

Ok, using Javascript (or something I can easily convert, I know BASIC very well, but a little rusty at C++ and C#) I need to solve this problem/equation:

Given the start and endpoint of a line (in x, y, and z) what point on the line satisfies the equation

A*x+B*y+C*z=D

A, B, C and D are defined, but x y and z are unknowns, but are somehwere on that line I know above. I need to get an x, y, and z of the point back from this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

爱已欠费 2024-08-26 03:59:10

由于您知道直线的起点和终点,因此可以得到直线方程,其形式为 ax + by + cz = 0

A*x + B*y + C*z = 0 可以写成 (A/D)*x + (B/D)*y + (C/D)*z = 1,这又是 a 的方程线。

我猜你正在寻找的是两条线的交点。

解这两个方程即可得到 x、y 和 z。实际上这些方程是一个三变量方程组

我希望这有帮助。

干杯

Since you know the start and end point of the line, you can get the equation of line in the form ax + by + cz = 0

A*x + B*y + C*z = 0 can be written as (A/D)*x + (B/D)*y + (C/D)*z = 1, which is again an equation of a line.

I guess what you are seeking is the intersection point of the two lines.

Solve the two equations and you will get your x, y and z. Actually these equations are a system of 3 variable equations.

I hope this helps.

cheers

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