Optimization of diameters and bifurcation angles in lung and vascular tree structures