JavaScript 三项式问题
好的,使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您知道直线的起点和终点,因此可以得到直线方程,其形式为
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