struct triangle { pt a; pt b; pt c; } tree structures seem more useful when there is a lot of data to work with. they can be used with goals of organisation. but you could make a small one too. here is an idea: the points are nodes and the lines are edges. struct pt { int x; int y; struct pt_list { pt *this; pt *next; } neighbors; };