Fixed one constructor of box profile function and added masking support
Duplicated bilinear interpolation method to remove branch testing