Need help with matrix manipulati​on/transfo​rmation to reflect points about an axis

5 views (last 30 days)
I need some help reflecting/mirroring a set of data points across an arbitrary axis. My points are as follows:
x=[6;12;5;3];
y=[0;-1;-7;11];
and I would like to reflect them about a line that goes from (0,0) to (5,10). The line could be any angle but this will work fine for my example.
Ultimately I may have thousands of points but I just need to understand how to do this so that I can apply the technique on a larger scale.
Can someone help me understand how to do this as I am not much of a linear algebra guy. Thanks in advance.

Accepted Answer

Mark Evans
Mark Evans on 16 Nov 2020
Solved problem by first doing a coordinate transformation and then mirroting across the new y-axis.
z=[cos(theta) sin(theta);-sin(theta) cos(theta)]; % Calculate transformation matrix
m=[x;y]; % Combine x & y coordinates in a single matrix
k=z*m; % Multiply matrices to get x & y values wrt new coordinate system
x_new=k(1,:);
y_new=k(2,:);
mirrored_x=-fliplr(x_new);
mirrored_y=fliplr(y_new);

More Answers (1)

Mark Evans
Mark Evans on 13 Nov 2020
Bump

Categories

Find more on Mathematics in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!