optimized quad bounds calculation