How to mirror image in MATLAB.

11 次查看(过去 30 天)
Cillian
Cillian 2012-4-26
评论: HARSH 2023-7-17
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 个)

Sean de Wolski
Sean de Wolski 2012-4-26
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.

类别

Help CenterFile Exchange 中查找有关 Geometric Transformation and Image Registration 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by