geometry functions, and quad check