How can I reflect a point with respect to a plane?
I have three points (0,0,2), (4,0,0) and (0,8,0). And I have a point (x,y,z). From these, I want derive a composite transformation matrix. How can I do that?
Given the following:
The calculation steps for the augmented reflection matrix are as follows:
1) Calculate the 3x3 reflection matrix R0 for a plane with the same normal vector, but which lies at the origin
Ro = I - 2 NNT
2) Augment the reflection matrix to create the augmented reflection matrix RA
3) Calculate the final augmented reflection matrix by first applying the translation A, mirroring the point by RA, then applying the reverse of the translation A-1
R = ARAA-1
Three points, A, B and C define a plane. The lines AB and AC are both on the plane, so their normalised cross product, perpendicular to both lines, is the plane's normal n:
n = normalise( (B - A) ⨯ (C - A) )
The equation for the plane is given by: n · x + d = 0, where -d is the displacement between the plane and the origin in the normal direction, i.e.: d = -n · A.
An arbitrary point x can be described as the sum of two vectors, u pointing from plane to point in the normal direction, v being the other component:
u = (x · n + d) n
v = x - u
The mirror image of x can then be calculated by flipping the u-component: x' = -u + v. Now that x' is known, capturing the calculation in a transformation matrix is trivial: solve T x = x' for T.