I know that you get whether the lid is open or closed from:
ioreg -r -k AppleClamshellState -d 4 | grep AppleClamshellState.
What I want to know is if the lid is open, what is its angle relative to the plane it is sitting on.
There is no easy way to do this from within the computer (you could always measure it of course). The hardware on laptops only needs to know whether the lid is closed or not, so a simple on/off switch is enough and built-in.