开发者

Javascript Trinomial Problem

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 poin开发者_开发问答t back from this.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜