Mirror filter

29 views
Skip to first unread message

Fraser

unread,
Oct 2, 2009, 8:59:55 PM10/2/09
to MathMap
I recently needed an angled mirror effect and was surprised not to
find it anywhere (although maybe I didn't look hard enough). Anyway, I
coded it up quickly in Mathmap. It mirrors the image about a line
through the centre with an adjustable angle. To mirror the left side
to the right, use 90 degrees, and right-side to left use 270.

filter mirror (image in,
float angle: 0-360 (0))
r_angle = deg2rad(angle);
if (r_angle < pi && a >= r_angle && a < r_angle + pi) ||
(r_angle > pi && (a >= r_angle || a < r_angle-pi)) then
new_a = a;
else
new_a = 2*r_angle - a;
end;
in(ra:[r, new_a])
end

photo...@gmail.com

unread,
Oct 4, 2009, 6:10:15 PM10/4/09
to MathMap
thank for sharing...true a mirror script was lacking

BTW i wonder if MM may allow to mirror images in the most commune
sense:
that will require the image size be doubled (for only vertical or only
horizontal mirror)
or quadruplicated ( if mirrored in both direction )

Ideally with a option to scale down to the original H or W
(NOT to the original size that will create ugly distortion ifimage was
mirrored only in one direction)
Reply all
Reply to author
Forward
0 new messages