I know this is an old question but it helped me when looking at this so I am sharing a working Kotlin example and also explicitly showing the angle being calculated as I found this can cause confusion.
If you consider the three points as making a triangle then you can get the 'internal' angles of the triangle using the approach discussed in the question and answers here, but you do need to be careful you are focusing on the correct equation for the angle you want.
I found that the exact angle you are referring to can be confusing when looking at this, so its useful to be able to check your code against some known or working examples that allow you visualise the angle you want.
At the time of writing the link below is to an excellent online tool that allows you enter the three points in a triangle and compute, amongst other things, the internal angles. It also includes an explanation of how the calculations are done, with your example values plugged in, which can be very useful when debugging the code:
Below is tested Kotlin code to calculate angle at vertex 'b' in a triangle like this (does not have to equilateral) :
The Kotlin code is below - the logging is obviously not needed but is useful when using a tool like the above site to test results:
private fun angleBetweenThreePoints(a: CirclePoint, b: CirclePoint, c:CirclePoint): Double {
var ab:Double = Math.sqrt(Math.pow((a.x - b.x).toDouble(), 2.0) + Math.pow((a.y - b.y).toDouble(), 2.0))
var ac:Double = Math.sqrt(Math.pow((a.x - c.x).toDouble(), 2.0) + Math.pow((a.y - c.y).toDouble(), 2.0))
var bc:Double = Math.sqrt(Math.pow((b.x - c.x).toDouble(), 2.0) + Math.pow((b.y - c.y).toDouble(), 2.0))
var cosValue = (ab * ab + bc * bc - ac * ac) /( 2 * bc * ab)
val angle = acos(cosValue) *(180/Math.PI)
//Optional logging to help test and debug
Log.d(TAG,"ab: " + ab)
Log.d(TAG,"ac: " + ac)
Log.d(TAG,"bc: " + bc)
Log.d(TAG,"a: " + a.x +"," + a.y)
Log.d(TAG,"b: " + b.x +"," + b.y)
Log.d(TAG,"c: " + c.x +"," + c.y)
Log.d(TAG,"angle: " + angle)
return angle
}
Note that this does not test for edge cases like non-intersecting lines etc.