Tangent SOIC partials first calculation
Tangent SOIC corrected sign
DeepSOIC squared distance implementation

Seems to work rather well. I know that if you for the tangent to be horizontal, remove the constraint and add a vertical constraint the solver is unable to solve it...