How do i measure the shape of an irregular curved wall?
You use a scribing tool


Example 1
Example 2


You can also use regular compasses with care. Or make something up with a pencil and a piece of wood to hold the pencil and offset it.

You put the shelf next to the wall, at the height you want it, pull the scribe along the wall with the pencil or marker on the shelf - this produces a cut line. 


Just imagine doing this horizontally instead of vertically, part way up the wall instead of at the bottom.

Similar product being used to fit counter-top to uneven wall