first, i cut a piece of cardboard. usually i just pull some from a cereal box.
i then willl put the cardboard up against the surface that i will eventually put the wood on.

i've used a tool called the accuscribe. it looks like this.
compasses for scribing range is quality and, accordingly, price. the accuscribe cost me about $15.00.
Once your cardboard is in position, with a steady hand, you need to transfer a pencil line onto the cardboard. Be sure to keep you hand steady and the compass level as you move across the surface you are trying to transfer.
You need a pencil mark on 100% of the cardboard, so you may need to adjust the compass so that it touches the cardboard for the whole area you are trying to copy.
Once you get a line on the cardboard, cut it and see how it fits. Has the gap closed considerably? Do you think you can do better? If so, adjust the compass and draw another line.
When you are satisfied with your template, trace the template onto the surface you are going to use.
your piece should now fit into the space, as intended.