improve grid sdf with static_cast