ANSI C library for kd-trees in n-d Cartesian spaces and on the sphere with parallelized tree construction