Unfortunately can't help myself, but I'd recommend you to also post it at http://math.stackexchange.com . So far they never failed to deliver an answer to my questions.
Comment has been collapsed.
Not really my cup of tea but this looks promising... https://en.m.wikipedia.org/wiki/Householder_transformation
Comment has been collapsed.
I teach math, in other language unfortunately. Though I'm afraid I cannot explain well in English, I'll try.
(a, b) -> (X, Y), reflected by y=4/3x
First, {Y-b}/{X-a} = -3/4 (for they need to be crossed by right angle)
Second, {Y+b}/2 = 4/3[{X+a}/2] (for their middle point needs to be on the said line)
Solve two equations.
X = {-7a+24b}/25, Y = {24a+7b}/25
The matrix
[ -7/25 24/25]
[24/25 7/25]
(Edit) In terms of theta... we use them only for rotation, not reflect. But you may know theta by using calculator.
Comment has been collapsed.
I do not know the answer by heart... But, hey, we can figure it out; you want a linear transformation which takes:
i) v1=(cosθ,sinθ) into v1=(cosθ,sinθ) -- that will keep the line y=mx in place, immovable.
ii) v2=(-sinθ,cosθ) into -v2=(sinθ,-cosθ) -- that will take (a vector which is orthogonal to the line) to its negative.
And that is it -- if you know how the transformation operates on a basis, you know the transformation itself! Just take a matrix with the "outputs" in the columns:
A=[cosθ sinθ]
[sinθ -cosθ]
And make another one with the "inputs" in the columns:
B=[cosθ -sinθ]
[sinθ cosθ]
The matrix you want is A*B^(-1), that is:
M=[cosθ sinθ] * [ cosθ sinθ] = [cos2θ sin2θ]
[sinθ -cosθ] [-sinθ cosθ] [sin2θ -cos2θ]
just as you found online... Why doesn't it work for you? Taking M*P should give you P'.
Let us test this: when y=4/3 x, we have cosθ=3/5 and sinθ=4/5.
So cos2θ=(3/5)^2-(4/5)^2=-7/25 and sin2θ=2(3/5)(4/5)=24/25, and M is:
M=[-7/25 24/25]
[24/25 7/25]
just as Luthienjish found around here. :D
So, according to this, the symmetric of P=[2;1] would be P'=MP, you can finish the calculation.
Cheers!
Comment has been collapsed.
Luthienjish's response gives the right intuition and the easiest way of solving the problem, OP.
But note that the matrix you found online was actually correct: reflection across a line can be factored into the two linear transformations, as Luthienjish explained. First, you reflect the plane across the 45 degree line; and then you rotate the plane counterclockwise by twice the difference of the angles, from the x-axis, of the line of reflection and the 45 degree line until the transformed line of reflection coincides with the 45 degree line.
The first transformation interchanges the unit vectors (1,0) and (0,1), and has matrix ((0,1), (1,0)) like balloonmial said. A counterclockwise rotation by φ sends (1,0) to (cos φ, sin φ) and (0,1) to (-sin φ, cos φ), which implies that the second transformation, rotation by φ=2(θ-π/4), has matrix ((cos(2θ-π/2), -sin(2θ-π/2)), (sin(2θ-π/2), cos(2θ-π/2))=((sin 2θ, cos2θ), (-cos2θ, sin2θ)). Thus the final transformation has matrix ((cos 2θ, sin 2θ), (sin2θ, -cos2θ)).
Expressing the slope m=arctan(θ) of the line of reflection as a ratio of numbers y and x (the height and base, respectively, of the triangle between the x-axis and the line of reflection) and setting h=sqrt(x^2+y^2) (the hypotenuse of this triangle), we determine that the final transformation has matrix (1/h)^2 ((x^2-y^2), 2xy), (2xy, y^2-x^2)). In other words, the point (a,b) maps to (a cosθ + b sin2θ, a sin2θ - b cos2θ) = (1/h)^2 (a(y^2-x^2) + 2bxy, b(x^2 - y^2) + 2 axy).
In particular, when m=4/3, the transformation has matrix (1/25)((-7,24), (24, 7)) and (a,b) maps to (1/25) (-7 a + 24 b, 24 a + 7 b)). In your original example, the point (2,1) is reflected across the line y=4/3x to (2/5, 11/5).
All matrices above are written as lists of column vectors, i.e. ((a,b), (c,d)) stands for
a c
b d
with the appropriate brackets.
Comment has been collapsed.
286 Comments - Last post 57 minutes ago by hbouma
173 Comments - Last post 1 hour ago by hbouma
642 Comments - Last post 1 hour ago by Oppenh4imer
58 Comments - Last post 1 hour ago by RobbyRatpoison
864 Comments - Last post 2 hours ago by Ashtart
255 Comments - Last post 4 hours ago by XfinityX
30 Comments - Last post 12 hours ago by TinTG
23 Comments - Last post 5 minutes ago by Oppenh4imer
505 Comments - Last post 6 minutes ago by Arouet
52 Comments - Last post 12 minutes ago by Greativity
433 Comments - Last post 12 minutes ago by OneManArmyStar
8,211 Comments - Last post 13 minutes ago by ClapperMonkey
14 Comments - Last post 24 minutes ago by GeekDoesStuff
79 Comments - Last post 1 hour ago by axolotlprime
tl;dr: How do I reflect (2,1) across y=4/3x with a transformation matrix? Formula?
What is the transformation matrix that I multiply a point by if I want to reflect that point across a line that goes through the origin in terms of the angle between the line and the x-axis?
In other words,
y = mx
θ is the angle between the x-axis and the line.
The position vector P
[ a ]
[ b ]
is a point on the same plane as the line.
The vector P' is P reflected across y=mx.
What matrix do I multiply P by to get P', in terms of θ?
I've looked online and found
[ cos(2θ) sin(2θ) ]
[ sin(2θ) -cos(2θ) ]
but I tested it and it doesn't work for me.
Also, examples with the vector
[ 2 ]
[ 1 ]
and the line
y = 4/3 * x
would help to stay consistent with my tests.
Comment has been collapsed.