Well, this will probably be the last, or nearly last post of a busy year that involved a lot of work on gigs and little focus on this blog. Sorry, maybe next year will be better 🙂

In the previous example, I showed how to rotate a box (rectangle) around an arbitrary point, but the algorithm and code never presumed anything about the geometric nature of the object. It’s possible to extend the exact same algorithm to a collection of points and that is the subject of the current post.

Instead of maintaining variables for the four vertices of a rectangle, the code was modified to work with an arbitrary point collection. A RotatablePoint class was used to hold data points and offload some of the computations. This greatly simplifies the actual demo and provides you with ample means for experimentation.

The online example starts with a small collection of points as shown below.

These points are rotated about the fixed point, drawn as a red dot. The drawing may be cleared after each rotation increment or continually updated from the prior drawing as shown below.

Have a Merry Christmas and I’ll try to post more next year!