How to mirror image in MATLAB.
11 次查看(过去 30 天)
显示 更早的评论
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
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!