An Explanation for the Scale Invariant Relationship between Tree Size and Density based on Optimization of Net Primary Production