No. You need to look at right triangles. tan45o=h/d where d is the perpendicular distance from the endpoint to the tree.
By the way, you might want to call the top end of the tree height h1 and the bottom end h2 such that h1+h2=h (the total height of the tree).