segment direction

add in the code the fragment to save the segment direction inside the tree