用C查找第3点在一条线上++ [英] Find 3rd point in a line using c++

查看:160
本文介绍了用C查找第3点在一条线上++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作在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(PO​​W(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(PO​​W(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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆