Your browser does not support the canvas tag.
 

Family Tree Viewer

 
Instructions
 
Move: Hold Left Mouse Button and Move Mouse
 
Zoom: Mouse Scroll Wheel
 
Change Tree: W (Increase) / S (Decrease) Key
 
Fit Tree to Screen: R Key
 
How I implemented my algorithm:
The algorithm that I used to draw my family tree diagram uses an number array inside of an unique Tree class. Each person in the family tree is assigned a depth value (showing how deep in the family tree they are) and an X position value during the draw process, which is used to calculate their position. The algorithm traverses the family tree recursively by checking the partnerships of the children of the current partnership. When a person is drawn, the algorithm gets the current value of the array at the depth of the person and draws the person at the value multiplied by a fixed width. It then increments the array at that depth to ensure that no two people are drawn at the same horizontal position.