You need to look in the API methods for various bits... it's all there...
Make a list of the loop's vertices.
You get a vertex.
You get its point in 3D
You get the vertex's edges.
For the two edges get its other end's vertex and thence its point.
You get the vector between the vertex-point and that end-point in turn.
You see if vertor1==vertor2 [or its 'reverse'].
If they're not 'equal' then it's a corner...
.