Clipping circles on a sphere

I’m trying to recreate the transform controls rotate gizmo. Unremarkable when rendered orthographic:

image

In perspective, i haven’t aligned it/clipped it right:

image

I’m trying to sketch to see what is going on, and im trying to see if i can do this with just the projection matrix, without having a branch in the shader, where im doing this, that knows isOrthographic:

In the shader i got my radius like this:

vec4 v = modelViewMatrix * vec4(0.,0.,1.,0.);
float r = length(v);

So how do i cut the red line, and grow the grey line (if this is what needs to happen) in perspective projection: