optimize and simplify spherical math
amend #16 by switching order of flags so --ldflags comes before --dep-libs