my issue today is what should be a simple cross-multiplication, is bouncing the results around making it hard to work out the issue. the sphere should be touching the sweep inside radius at all times all that is needed is the tangent length as the angles can be worked out easy as one is always 90deg and we have one distance from the radius. The maths I am trying to replicate is the law of Sines.
//get tangent length with known radius and angle
float ang = chf('angle');
float radius = chf('radius');
float half_ang = ang/2; // split the angle in half
float angA = half_ang;
float angB = 90.0; // tangent is always 90deg
float angC = 180.0 - angA - angB;
// lengths below are opposite to the angles above of the same ABC charaacter
float lenA = radius; // lenA/sin(angA) = lenB/sin(angB) = lenC/sin(angC) so need to cross multiply
float lenB = (lenA*(sin(angB))) /sin(angA);
float lenC = (lenB*(sin(angC))) /sin(angB);;
float tan_len = lenB; // = cos(half_input);
f@ang_mid = angC;
f@lenA = lenA ;
f@lenB = lenB ;
f@lenC = lenC ;
f@len_tan = tan_len;
f@pscale = tan_len;