-reflect pts through x axis -reflect pts through y-axis -reflect pts through ori
ID: 3545477 • Letter: #
Question
-reflect pts through x axis
-reflect pts through y-axis
-reflect pts through origin
-reflect points through the line y=x
-rotate (theta) degrees CC
-scale x and y according to a scale factor (determined by me)
-shear parallel to x-axis (with shear factor k set by me)
-shear parallel to y-axis (again, with self determined shear factor
Each of these is to be a seperate function with its own file. A given example (that I know works) for reflect through x-axis is as follows:
function pts = reflectx(pts)
% reflect 2 X N matrix of points through the x-axis
mat = [1 0; 0 -1]
pts = mat * pts;
end
So what I need help with is modifying the above to work with each transformation. I have my versions of them worked out but they don't seem to be wokring when I call them. I am mostly interested in the "mat = [x y; x y]" line for each case. Please be clear as I'm not the greatest at matlab. Thank you very much.
Explanation / Answer
1) through y axis -> mat = [-1 0; 0 1]
2) x axis -> mat = [-1 0; 0 -1]
3) x=y line -> mat = [0 1; 1 0]
4) theta CC -> mat = [cos(theta) sin(theta); -sin(theta) cos(theta)]
5) scale x and y -> mat = [c 0; 0 d] where c,d are x and y scaling respectively
6) shear parallel to x axis -> mat = [k 0; 0 1]
7) shear parallel to y axis-> mat = [1 0; 0 k]
Let me know if you have problem and plz rate if it helps.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.