Given a center and a radius, this program produces the coordinates of a square whether hollow or solid. This program is especially useful for drawing squares around circles. The result is a set of coordinates that is suitable for use to produce the square shape on a matrix.
Just adding that this works best if the radius and coordinates of the centre of the square are integers and big enough that the algorithm can do +1 and -1 increments to find the points. That is determined by the way you calculate the tempX and tempY matrices. Perhaps there could be an input to select how many points you want per side and then create the tempX and tempY matrices accordingly. Might make it... Thanks!