Let’s first consider a general case where the line is nothing but the X-Axis. We can now definitely say that the conjugate of a point is the reflection of the point about X-Axis.
Now, using the methods of translation and rotation of coordinate axes we will find out the reflection of a point about the generic line.
The idea of translation was described in the previous post. Here we describe the idea of rotation.
What is Rotation?
In Euclidean geometry, a rotation of axes in two dimensions is a mapping from an xy-Cartesian coordinate system to an x’y’-Cartesian coordinate system in which the origin is kept fixed and the x’ and y’ axes are obtained by rotating the x and y axes through an angle θ.
How to Perform Rotation?
Rotation can be interpreted as multiplying (rotating in anticlockwise direction) or dividing (rotating in clockwise direction) every point of the coordinate system by a constant vector.
Note here that if we want to rotate a point by θ in the anticlockwise direction about the origin, we multiply it by polar (1.0, θ) as discussed in SET 1. Similarly, we divide by polar (1.0, θ) to rotate the point by θ in the clockwise direction.
After the rotation, required computations are performed and rotation is nullified by dividing or multiplying every point by the constant vector respectively.
So, we have to reflect a point P about a line specified by points A and B denoted as AB. Since, we know that the conjugate of a point is the reflection of the point about X-Axis. In order to be able to use this fact, we will first perform translation (making A as the origin in the new system) and then rotating the coordinate axes in such a way that the line becomes the X-Axis in the new coordinate system.
Now we can simply apply the formula for reflection about X-Axis and then nullify the effects of rotation and translation to get the final result.
These steps can be described as under:
- Translation (Shifting origin at A): Subtract A from all points.
Pt = P – A Bt = B – A At is origin
- Rotation (Shifting BtAt to the X-Axis): Divide all points by Bt (dividing means rotating in clockwise direction which is the requirement here to bring on X-Axis).
Pr = Pt/Bt
- Reflection of Pr about BrAr (which is nothing but the X-Axis): Simply take the conjugate of the point.
Prreflected = conj(Pr)
- Restoring back from Rotation: Multiply all points by Bt.
- Restoring back from Translation: Add A to all points.
P reflected = conj(Pr)*Bt + A
return conj(Pr)*Bt + A where, Bt = B – A Pt = P – A Pr = Pt/Bt
The point P on reflecting about AB becomes: P_reflected(7, 4)
This article is contributed by Aanya Jindal. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
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.
- Reflection of a point at 180 degree rotation of another point
- Equation of straight line passing through a given point which bisects it into two equal line segments
- Slope of the line parallel to the line with the given slope
- Find an Integer point on a line segment with given two ends
- Direction of a Point from a Line Segment
- Section formula (Point that divides a line in given ratio)
- Program to find the mid-point of a line
- Find the other end point of a line with given one end and mid
- Shortest distance between a Line and a Point in a 3-D plane
- Perpendicular distance between a point and a Line in 2 D
- Check whether the point (x, y) lies on a given line
- Find foot of perpendicular from a point in 2 D plane to a Line
- Minimum distance from a point to the line segment using Vectors
- Rotation of a point about another point in C++
- How to check if two given line segments intersect?
- Given n line segments, find if any two segments intersect
- Count maximum points on same line
- Klee's Algorithm (Length Of Union Of Segments of a line)
- Line Clipping | Set 1 (Cohen–Sutherland Algorithm)
- Represent a given set of points by the best possible straight line