Find an angle between 3 points given another point that must be contained in the angle

I need to know the angle between 3 points given another point R that must be contained in the angle. If a ray is drawn from the center P point to R, then it must be contained in the angle. For example:

The 3 points are labeled P.

 P P P . R 

In this case, the angle between the three points would be less than 180 degrees.

 P P P R 

In this case, the angle between the three points would be greater than 180 degrees.

How can I find this angle?

• Is it known which point is the center point? Otherwise it's not clear what you mean by the angle between the three points. If so you can most likely solve this using dot products. – kccu Jan 16 '16 at 3:21
• The center point is known. – questioner and answerer Jan 16 '16 at 4:45
• Sorry, meant the OP! @questionerandanswerer: Do you understand concepts like vectors and dot products? – Frentos Jan 16 '16 at 8:33
• Never mind, I found the solution. – questioner and answerer Jan 17 '16 at 4:36
• @questionerandanswerer: could you add your solution as an answer here, please, or delete this question entirely? Otherwise the question will hang around forever looking unanswered. Thanks! – Frentos Jan 20 '16 at 2:05