Given a point(x, y, z) in 3-D and coefficients of the equation of plane, the task is to find the mirror image of that point through the given plane.
Input: a = 1, b = -2, c = 0, d = 0, x = -1, y = 3, z = 4
Output: x3 = 1.7999999999999998, y3 = -2.5999999999999996, z3 = 4.0
Input: a = 2, b = -1, c = 1, d = 3, x = 1, y = 3, z = 4
Output: x3 = -3.0, y3 = 5.0, z3 = 2.0
Approach: Equation of plane is as ax + by + cz + d = 0. Therefore, direction ratios of the normal to the plane are (a, b, c). Let N be the foot of perpendicular from given point to the given plane so, line PN has directed ratios (a, b, c) and it passes through P(x1, y1, z1).
The equation of line PN will be as:-
(x - x1) / a = (y - y1) / b = (z - z1) / c = k
Hence any point on line PN can be written as:-
x = a*k + x1 y = b*k + y1 z = c*k + z1
since N lies in both line and plane so will satisfy(ax + by + cz + d = 0).
=>a * (a * k + x1) + b * (b * k + y1) + c * (c * k + z1) + d = 0. =>a * a * k + a * x1 + b * b * k + b * y1 + c * c * k + c * z1 + d = 0. =>(a * a + b * b + c * c)k = -a * x1 - b * y1 - c * z1 - d. =>k = (-a * x1 - b * y1 - c * z1 - d) / (a * a + b * b + c * c).
Now, the coordinates of Point N in terms of k will be:-
x2 = a * k + x1 y2 = b * k + y1 z2 = c * k + z1
Since, Point N(x2, y2, z2) is midpoint of point P(x1, y1, z1) and point Q(x3, y3, z3), coordinates of Point Q are:-
=> x3 = 2 * x2 - x1 => y3 = 2 * y2 - y1 => z3 = 2 * z2 - z1
x3 = 1.8 y3 = -2.6 z3 = 4.0
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Find mirror image of a point in 2-D plane
- Program to find equation of a plane passing through 3 points
- Find the equation of plane which passes through two points and parallel to a given axis
- Number of jump required of given length to reach a point of form (d, 0) from origin in 2D plane
- Shortest distance between a Line and a Point in a 3-D plane
- Distance between a point and a Plane in 3 D
- Find the foot of perpendicular of a point in a 3 D plane
- Find foot of perpendicular from a point in 2 D plane to a Line
- Maximum distinct lines passing through a single point
- Rotation of a point about another point in C++
- Reflection of a point at 180 degree rotation of another point
- Count of parallelograms in a plane
- Program to determine the quadrant of the cartesian plane
- Maximum distance between two points in coordinate plane using Rotating Caliper's Method
- Number of triangles in a plane if no more than two points are collinear
- Program to determine the octant of the axial plane
- Program to check whether 4 points in a 3-D plane are Coplanar
- Check if a line at 45 degree can divide the plane into two equal weight parts
- Maximum number of region in which N non-parallel lines can divide a plane
- Count of intersections of M line segments with N vertical lines in XY plane
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.