(x,y) co-ordinates of n equally spaced points on the perimeter of a square Where a square of known dimensions has n points equally spaced around its perimeter, is there a way to calculate the set of (x,y) coordinates of these points?
I have a solution in C# language where starting from (0,0) I can add increments of perimeter/n to the x coordinate up to the max allowed value for x (i.e the length of the side of the square), and then spill the remainder into y and so on, but I can't help thinking there must be a better way.
Update with an example:
For instance, with number of points n=9 and the square sides of length=2, the distance between each pair of points around the perimeter is 0.889 and the set of points to two decimal places would be:
(0, 0)
(0.89, 0)
(1.78, 0)
(2, 0.67)
(2, 1.56)
(1.56, 2)
(0.67, 2)
(0, 1.78)
(0, 0.89)

 A: Assume that each side of the square is $s$ units and that you are going to have $n$ points.
First, pretend that instead of placing these points around the perimeter of a square, you are placing them on 1 line segment, of length $4s$.  Then the $n$ points would be located at
$$0, ~\left(1 \times \frac{4s}{n}\right),
 ~\left(2 \times \frac{4s}{n}\right),
 ~\left(3 \times \frac{4s}{n}\right),
\cdots,
 ~\left((n-1) \times \frac{4s}{n}\right).$$
These one dimensional locations must then be translated into points on the perimeter of your square.
Let $k \in \{0,1,2,\cdots\},$ where
$k = \lfloor \frac{n}{4}\rfloor.$ 
That is, $k$ is the largest non-negative integer less than or equal to $\frac{n}{4}.$
First, one point goes to $(0,0)$.
Then, you can distribute $k$ points along the bottom edge of the rectangle, at points
$$\left(1 \times \frac{4s}{n}, ~0\right),
 ~\left(2 \times \frac{4s}{n}, ~0\right),
 ~\left(3 \times \frac{4s}{n}, ~0\right),
\cdots,
 ~\left(k \times \frac{4s}{n}, ~0\right).
$$
Similarly, you can then distribute another $k$ points along the left edge at
$$\left(0, ~1 \times \frac{4s}{n}\right),
 ~\left(0, ~2 \times \frac{4s}{n}\right),
 ~\left(0, ~3 \times \frac{4s}{n}\right),
\cdots,
 ~\left(0, ~k \times \frac{4s}{n}\right).
$$
Now, you have to "turn the corners".
First, calculate the "margin left over" along the bottom edge as
$$M = \left[s - \left(k \times \frac{4s}{n}\right)\right].$$
Then, the $k$ points along the right edge will be located at
$$\left(s, ~-M + 1 \times \frac{4s}{n}\right),
 ~\left(s, ~-M + 2 \times \frac{4s}{n}\right),
 ~\left(s, ~-M + 3 \times \frac{4s}{n}\right),
\cdots,
 ~\left(s, ~-M + k \times \frac{4s}{n}\right).
$$
Similarly, the $k$ points along the top edge will go at
$$\left(-M + 1 \times \frac{4s}{n}, ~s\right),
 ~\left(-M + 2 \times \frac{4s}{n}, ~s\right),
 ~\left(-M + 3 \times \frac{4s}{n}, ~s\right),
\cdots,
 ~\left(-M + k \times \frac{4s}{n}, ~s\right).
$$
Note that when $n$ is a multiple of $4$, so that $4k$ exactly equals $n$, then the above algorithm will end up having you place a point on the upper right corner of the square twice.
There is an exceptional case to be considered.
If
$$s + M ~\geq~ \left(k+1\right) 
\times \left(\frac{4s}{n}\right)$$
then an additional point will need to be placed along both the right edge, and the top edge.
