How to mirror image in MATLAB.

11 views (last 30 days)
Cillian
Cillian on 26 Apr 2012
Commented: HARSH on 17 Jul 2023
I really need help with the task below, can someone give a hint, just how to start solving this problem?
Write a program that makes the following:
Given the plane Ax + By + Cz = D and a point x in space, calculate the mirror image s of x in the plane.
Function script: function s = mirror(x, A, B, C, D)
Input: The point x and the parameters of the plane equation.
Output: The mirror image s
Also, presenting all occuring vectors as column vectors.
At last, test the functions on a suitable planes and points, just to check the results.
Here is my attempt so far;
function s = spegel(x, A, B, C, D)
s = A.*x + B.*y + C.*z - D;
s = x(length(gen):-1:1) % for the general case of a 1D vector (either row or column)
end
I would be very thankful for some help.
Regards
Cillian
  1 Comment
HARSH
HARSH on 17 Jul 2023
Can You explain the plane mirror code in matlab ?

Sign in to comment.

Answers (1)

Sean de Wolski
Sean de Wolski on 26 Apr 2012
That looks right for the 1d case. You may wish to look at: fliplr, flipud, flipdim.
If you open them up, e.g:
open flipud
You can see how they work.

Community Treasure Hunt

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

Start Hunting!