Naive geometry calculations fail very hard, very fast.  There is a reason why Solidworks has you draw on the surface of something that already exists, and extrude a feature up from that, instead of computing the union of two 3D primitives. Computing the coincidence of two lines or planes is a quick path to woe. The geometry package CGAL uses infinite precision rationals instead of floating point, and also bans curves.  A circle is a many-sided polygon, and pi is not acknowledged to exist.  Floating point and computational geometry are uneasy aquaintances.