The key to understanding how gp:recalcPolyCorners works is to revisit the diagram showing what the key values of 12 through 15 represent:
In the diagram, the user moved the corner point associated with the key value of 14. This means the corner points associated with 13 and 15 need to be recalculated.
Point 15 needs to be moved along the current vector defined by point 12 to point 15 until it lines up with the new point 14. The vectors from 12 to 15, and from 14 to 15, must be perpendicular to each other. The same operation must be applied to recalculate the new location for point 13.
Now take another look at the code to see if it makes sense.