Calculating symmetric points

Some months ago I was trying to figure out a way to find the symmetry of a given point using a line as a mirror. I got busy doing other things and all my notes were lost like tears in the rain. I finally got time to complete the research.

I found three simple ways to do so. All three need an origin position and a direction (a unit vector that represents the line itself); it’s needless to say that the origin must be over the line.

Vector Projection

Let’s label the original point as A and the symmetric partner as P.

Assuming we already have A, we want to find using vector projections. In the figure below, a is Ab is the direction and the point opposite to the arrow’s tip is the origin. P will be analogous to A, but below b.

Using basic linear algebra:

projA= \mathbf{a_1}= |\mathbf{a}|\cos\theta = \mathbf{a}\cdot\mathbf{\hat b}

rejA= \mathbf{a_2}= \mathbf{a}- \mathbf{a}_1

Here’s the code that applies this principle:

Perpendicular Vectors

I wanted alternate ways to have the desired points with. For this approach, the initial point A is not needed as input, as both A and B will be generated at the same time.

In this case, the first step will be to create the projection vector of the future points. After that, the rejection vectors will be nothing more than the perpendicular vectors of such projection. The results are three vectors that will be used to create the desired points.

This method provides control over the generation of points, via three variables (randomly set in the code above for the sake of the example). Those variables can be passed as arguments but are used as they are for explanatory purposes.

Radial construction

There’s also a third solution. Given an origin point along the line, it’s possible to either create a pair of mirrored points by thinking of them as points over a circle. The hemispheres of the circle are dictated by the mirror line and the points reside in each of them.

Although the code provided will generate both points, it’s possible to modify it and calculate the mirror of an existing point.

This solution also provides customizability via two variables: distance from the origin and angle.

I’m pretty sure there are more ways to get the symmetry of a point over a line, but I these 3 methods will perform the task.

Leave a Reply