I would like to make an animation that shows where a graphic (square, circle etc) would be after it is reflected over a line.

Thanks

=================

=================

1 Answer

1

=================

I came up with a solution using ReflectionTransform[]. Here’s my code:

TabView[{

“Square” ->

Manipulate[Graphics[

{{Opacity[1], Red, Rectangle[{a,b},{c,d}]}, Line[{{5, 5}, {5, -5}}],

GeometricTransformation[{Opacity[1], Blue,Large,Rectangle[{a,b},{c,d}]},

ReflectionTransform[{5, 0}, {5,0}]]}],{a,0,2},{b,0,2},{c,1,4},{d,1,4}

],

“Triangle” ->

Manipulate[Graphics[

{{Opacity[1], Red,Triangle[{{a,b},{a,c},{c,b}}]}, Line[{{5, 5}, {5, -5}}],

GeometricTransformation[{Opacity[1], Blue,Large, Triangle[{{a,b},{a,c},{c,b}}]}, ReflectionTransform[{5, 0}, {5,0}]]}],{a,0,2},{b,0,2},{c,1,5}],

“Circle” ->

Manipulate[Graphics[

{{Opacity[1], Red,Disk[{a,b},c]}, Line[{{5, 5}, {5, -5}}],

GeometricTransformation[{Opacity[1], Blue,Large,Disk[{a,b},c]},

ReflectionTransform[{5, 0}, {5,0}]]}], {a, 0,2},{b,0,2},{c,1,4}]

}]

Here’s what that code produced:

The sliders adjust the shape’s position and size and there are tabs for a triangle reflection, square/rectangle reflection, and circle reflection. The red shape is the starter shape and the blue shape is the reflected shape.

I produced the animation using Mathematica Online so it’s a little choppy.