In 2D plane, I have a point and a line. How to get the mirror point along this line?
You can use a simple formula to find this. First you have to write the formula of the line using
ax+by+c=0
lets say your line is y=x. and the point you'r trying to mirror is (3,2). we all know it's gonna become (2,3) anyway write y=x in standard form, which will become like this :
y-x=0
now use this formula and insert the values of the point instead of the x and y.
(ax+by+c)/a^2+b^2
(a^2 means a square.)
you will get a value, so let's name it K. in this instance where the point is (3,2) and the line is y-x=0, K would equal to:
(-3+2)/(1+1)= -1/2
now to calculate the new coordinates all you have to do is insert the values in this formula:
x-2ak
y-2bk
where x and y are the original coordinates and a and b are the values used in the original formula of the line (y-x=0 a=-1, b=1, c=0) so the value we get is:
3 - 2 x -1 x -1/2 = 3-1 = 2
2 - 2 x +1 x -1/2 = 2+1 = 3