Yes, and here is the logic of it.
To show how, I've drawn a square, pentagon and hexagon.
In each case, I've drawn the same construction lines - a circle that touches all their corners (we can do this with any regular polygon). I've labelled the length of the "defined edge" as $s$ and the length from corner to centre as $r$. I'm going to call the number of sides, $n$.
I've also marked a grey line that bisects the edge, from the centre. Because of the way I've positioned the line, it is a perpendicular bisector of the edge (crosses it at a right angle) so each half is a right angle triangle. The right angle triangle has one side $r$, and one side $s\big/2$, and I've labelled the angle these make at the centre, $A$.
![](https://cdn.statically.io/img/i.sstatic.net/yRkmk.png)
Basic trigonometry says that for the right angle triangles, $$\begin{align}
\sin (A) &= \frac{\left[\dfrac s2\right]}r = \frac s{2r}\\
A &= sin^{-1} \left(\frac s{2r}\right)
\end{align}$$
But we also know that each edge, "takes up" $2\times A$ degrees, and so $n$ sides will "take up" $2\times A\times n$ degrees. But all $n$ sides must take up 360 degrees, the number of degrees at the centre. So $2\cdot A\cdot n = 360$.
Now we can solve the problem
Since $$\begin{align}
2An &= 360\\
An &= 180\\
\sin^{-1}\left(\frac s{2r}\right)\cdot n &= 180\\
n &= \frac{180}{\sin^{-1}\left(\dfrac s{2r}\right)}
\end{align}$$
Testing this with your square:
$s=1, r=\frac{\sqrt2}{2}$
$$\implies n = \frac{180}{\sin^{-1}\left(\dfrac{1}{2\cdot\dfrac{\sqrt2}{2}}\right)} = \frac{180}{45} = 4$$
So your example object was a square (4 sides).
Testing this with your hexagon:
$s=1, r=1$
$$\implies n = \frac{180}{\sin^{-1}\left(\dfrac{1}{2\cdot1}\right)} = \frac{180}{30} = 6$$
So your example object was a hexagon (6 sides).