I knew you would be the one to solve this! I had to adapt it a bit to fit my original plan, which was to have a line snap to the corner of an ellipse as if it was touching it. I’ll upload the results, this is the finished line of expression:
// LAYERS
posP = thisComp.layer(“LINHA: Path 1 [1.1.2]”).transform.position;
bola = thisComp.layer(“BOLA-AZUL”);
diametro = thisComp.layer(“BOLA-AZUL”).content(“Ellipse 1”).content(“Ellipse Path 1”).size;
posB = bola.toComp(bola.anchorPoint);
pontaB = bola.toComp(bola.anchorPoint + [diametro[0]/2,0]);
posB3D = [posB[0],posB[1]];
// SPECULATIVE
raio = sub(pontaB,posB)[0];
c = sub(posB, posP);
modc = length(posP,posB3D);
alfa = -Math.acos(c[0]/modc);
theta = Math.asin(raio/modc);
beta = alfa-theta;
modv = Math.sqrt(Math.pow(modc,2)+Math.pow(raio,2));
v = [Math.cos(beta)*modv, Math.sin(beta)*modv];
add(posP, v)