用C查找第3点在一条线上++ [英] Find 3rd point in a line using c++
问题描述
我的工作在C ++应用程序。而其新的给我。在这里,我写这收获线两个坐标功能。我必须处理这些坐标,找到另一点这在同一条线上。
我将获得 A(X1,Y1)和B(x2,y2)
坐标。
需要找到
C(X3,Y3)
坐标。
因此,我计算给定直线的斜率。
I am working in c++ application. And its new to me. Here I write a function which gain two coordinates of a line. I have to process these coordinates and find another point which in that same line.
I will gain A(x1,y1) and B(x2,y2)
coordinates.
need to find
C(x3,y3)
coordinates.
Therefore I calculate the Slope of given line.
双坡=(X1-X2)/(Y1-Y2);
我知道3点从A点的距离。
And I know the distance of 3rd point from A point.
双DIS = SQRT(POW(X2-X1)+ POW(Y2,Y1))* 1.35;
我要寻找新的坐标X3,Y3使用斜率
和 DIS
。
I want to find new coordinates x3 ,y3 using Slope
and dis
.
谁能帮我解决这个吧。
要计算X3的我可以用数学的一部分,
To calculate the x3 I can use mathematical part,
X3 =斜率* Y3 ------------------- 1
DIS = SQRT(POW(X3-X1)+ POW(Y3-Y1))------------ 2
使用这两个公式其中发生在运行时,我想计算 X3
和 Y3
。
using these 2 equations which generating in run time , I want to calculate x3
and y3
.
推荐答案
太多的数学。
x3 = (x1 - x2) * 1.35 + x2
y3 = (y1 - y2) * 1.35 + y2
这篇关于用C查找第3点在一条线上++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!