I'm trying to develop an application (with programming languages) where I can create 6 sided polygons with the same angle, wich is 60º deg, for example, to create the sides, like the image below. The only thing I know is the height of this object and the angle to be used.
This is an example of the result I expect to achieve:
Is there a formula to calculate the distance the point needs to be from the left side to achieve that angle? See image below.
I want to be able to change the height of the element, but keep the proportion of the polygon in all elements, wich is 60º.
I tried to use this formula, but it's not working:
$$x = tan(60º) * h$$


So this is what I did, it gives you $x = 20/\sqrt{3}$.
So more generally for a $n$-agon then you have the angle $\alpha = 180°-360°/n$ (on the sketch $\alpha = 120°$) and therefore $x = \tan((180°-\alpha)/2) \times \frac{h}{2}$ hence:
$$\boxed{x = \tan\left(\frac{180°}{n}\right)\times \frac{h}{2}}$$