如何计算沿线的镜像点? [英] How to calculate the mirror point along a line?

查看:38
本文介绍了如何计算沿线的镜像点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在二维平面中,我有一个点和一条线.沿着这条线如何得到镜像点?

In 2D plane, I have a point and a line. How to get the mirror point along this line?

推荐答案

假设直线的方程是ax + by + c = 0.现在想象一条垂直于它的线,可以用 -bx + ay + d = 0 表示(两条垂直线的斜率乘积为-1).现在的问题是找到d.把点的坐标放在第二行,就很容易得到d的值了.

Suppose the equation of the line is ax + by + c = 0. Now imagine a line perpendicular to it, which can be represented by -bx + ay + d = 0 (product of slopes of two perpendicular lines is -1). Now the problem is to find d. Put the co-ordinate of the point on the second line, and you'll get the value of d easily.

第二部分是,在第二条线上找到一个与第一条线的第一个点等距的点.为此,您可以找到两条线的交点.计算给定点和交点的xy的差值.现在将它们添加到相交点的 xy 值.这给出了您需要的点(您可能需要否定差异 - 这取决于您使用的减法顺序).

The second part is, to find a point on the second line which is equidistant as the first point from the first line. For that, you can find the intersection of the two lines. Calculate the differences in x and y of the given point and the intersection point. Now add those to the x and y value of the intersecting point. That gives the point you need (you may need to negate the differences - that's up to the order of subtraction you use).

这篇关于如何计算沿线的镜像点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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