add density calulation and fix bug in pos transform