Best-fit of implicit surfaces and plane curves