I'm trying to calculate the number of times an angle must be repeated to make a full rotation and become closed.
Example: The internal angle of a pentagon is 108 degrees and it must repeat 5 times to complete a rotation and it closes at 540 degrees. It closes a 540 degrees because that's when all the sides meet and close. http://www.mathsisfun.com/geometry/interior-angles-polygons.html
How can I calculate these numbers for arbitrary angles like 72 degrees or 117 degrees, etc..
Does anyone know of a way to calculate this
Ps: I'm using matlab/octave thanks
This is only possible for $$\frac{\phi}{2\pi} =: a \in \mathbb{Q}$$ If $a = \frac{p}{q}$ is the irreducible form of $a$, i.e. $p$ and $q$ are relatively prime, then the sought value is $q$; the number of performed revolutions is $p$. I don't know of any efficient algorithm for this, especially as MATLAB / Octave work with numeric approximations to the values
function n=getRev(a)b=a;
n=1;
while (abs(b-round(b) > 1e-15))
b = b+a;
n = n+1;
end
end
Code for outer angles:
function n=getOuterRev(a)b=a;
n=1;
k=(n-2)/2;
while (abs(b-k) > 1e-15)
b = b+a;
n = n+1;
k = (n-2)/2;
end
end