Rasterizing spheres?
Jim Blinn's book Jim Blinn's Corner: Notation, Notation, Notation has a couple of chapters which go through this in detail with all of the edge cases. This book is a collection of essays from his column in IEEE Computer Graphics and Applications. Highly recommended.