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

问题描述

在2D平面上,我有一个点,一条线。如何相处的这条线的镜子呢?

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

推荐答案

假设直线方程为斧+由+ C = 0 。现在想象一下,一条垂直于它,这可以重新$ P $由 -bx + psented 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.

的第二部分是,发现在第二行的一个点是等距离的从第一行的第一个点。对于这一点,你可以找到两条线的交叉点。计算 X 给定的点和交叉点的差异。现在添加这些到的交叉点X 值。这给了你所需要的点(可能需要否定的差异 - 这是给减法的使用顺序)。

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).

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

08-20 01:21