Fix KdTree::GenerateRepresentation and add test.

Change-Id: I15c9ecb05fc32bca7b4fd14bd0d88e76cf904929
Merge topic 'kdtree-repr' into master

6dee6fde Fix KdTree::GenerateRepresentation and add test.