working on algorithm in JtsUtil and added a bunch of util functions