简体   繁体   English

找出线段的已知X的Y?

[英]Finding the Y of a known X of a line segment?

I'm trying to place my hero's feet on a ground made up of line segments. 我试图将英雄的脚放在由线段组成的地面上。

在此处输入图片说明

If I know the X,Y of points A, B, and C and the X of Hero, how do I find the Y of Hero so that his feet touch the ground (assume X is the middle of the Hero and Y is along the bottom)? 如果我知道A,B和C点的X,Y和Hero的X,我如何找到Hero的Y,以便他的脚触地(假设X是Hero的中间,而Y沿着英雄底部)? And do I have to do anything differently if he's standing exactly over a point? 如果他正好站在一个点上,我是否需要做其他不同的事情?

Thanks. 谢谢。

If A and B are two points in a coordinate plane with points (xA, yA) and (xB, yB) respectively - then the slope of the line between them is simple geometry - delta y/delta x, or (yB-yA)/(xB-xA) . 如果AB是坐标平面中分别具有点(xA, yA)(xB, yB)两个点-那么它们之间的线的斜率就是简单的几何形状-增量y /增量x或(yB-yA)/(xB-xA) The general form of the line can be given as y = yA+(yB-yA)/(xB-xA)*(x-xA) 该行的一般形式可以表示为y = yA+(yB-yA)/(xB-xA)*(x-xA)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM