public static float [ ] gridIdxToPoint ( Grid grid , int idx ) { int [ ] gridIdx = new int [ 3 ] ; int ydiv = grid . getDivision ( ) . getX ( ) ; int zdiv = ydiv * grid . getDivision ( ) . getY ( ) ; gridIdx [ 2 ] = idx / zdiv ; idx -= gridIdx [ 2 ] * zdiv ; gridIdx [ 1 ] = idx / ydiv ; idx -= gridIdx [ 1 ] * ydiv ; gridIdx [ 0 ] = idx ; Vec3f size = grid . getSize ( ) ; float [ ] point = { gridIdx [ 0 ] * size . getX ( ) + grid . getMin ( ) . getX ( ) , gridIdx [ 1 ] * size . getY ( ) + grid . getMin ( ) . getY ( ) , gridIdx [ 2 ] * size . getZ ( ) + grid . getMin ( ) . getZ ( ) } ; return point ; }
Convert a grid index to a point .