Answer the question
In order to leave comments, you need to log in
How to calculate coordinates for a tree?
There is a certain diagram for the elements of which you need to calculate the coordinates so that there are no overlaps and the tree looks normal. The coordinates of the root element are set manually. Accordingly, when moving the root or deleting an element, all elements can be recalculated.
The tree should look something
like this : Did not work out.
Tell me an algorithm or something to implement something like this
Answer the question
In order to leave comments, you need to log in
In your picture, a certain non-leaf node is located in the middle of the interval (along the X axis) that its child nodes occupy.
So solve the problem of determining how much space child nodes should take, including all their children, and so on. This problem can be solved by the PVG tree traversal algorithm, manually managing the vertex stack or using recursive calls to the traversal procedure.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question