Improved corner detection for shadow casting