I came across an old toy in the attic the other day; it is so old I don't even remember its name. This will create attractive displays by reflecting coloured scraps of paper inside a hollow triangular prism. Simulating the toy in two dimensions was a snap. The distance between two points is of course:
{(x1-x2)2+(y1-y2)2}1/2
while the straight line passing through (x1,y1) and being normal to the line y= slope.x+ yInter is:
(y-y1)= (x1-x)/slope
It is possible to derive a final expression for the reflection of a point with respect to a straight line, but it gets rather long- winded: More conveniently, numeric values are substituted in intermediate expressions, as soon as they are available. To get at the same result, it is also possible to rotate the plane until the line is horizontal, obtain an easy reflection, then perform a complimentary rotation.
Reflection is intrinsically symmetric; additional symmetry is afforded by the rotational action of the prism.
There is a short demonstration program for reflections. Other than that, it only takes two or three loops to produce the graphics.