you need some trig
So I’m going to refer to angle A as ‘theta’ just to avoid confusion with point A.
(B - A).magnitude = hypot
sin(theta) * hypot = len(BC)
cos(theta) * hypot = len(AC)
With this we now know the length of either leg. Next is to find the direction of either leg. We could solve for angle(B) and solve from that… or we already have theta=angle(A), so might as well just use that. Which means, really, all we need from above is the cos(theta)*hypot
Thing is theta doesn’t necessarily denote direction and we actually have 2 right triangles here that resolve all this information we have. We could easily get the mirror of C over the line AB. Arithmetically/Geometrically they’re both valid values (just like how +/-2 are both valid for sqrt(4)).
So we either need to assume some information… like “C is counter-clockwise around point A from B”. But it’d also be valid to assume “C is clockwise around A from B”. A way we can do this is to just apply a sign to theta, negative meaning one direciton, positive meaning the other.
With that said… there’s tons of ways to easily rotate a Vector2, like this method:
/// <summary>
/// Rotate Vector2 counter-clockwise by 'a'
/// </summary>
/// <param name="v"></param>
/// <param name="a"></param>
/// <returns></returns>
public static Vector2 RotateBy(Vector2 v, float a)
{
a *= Mathf.deg2Rad;
var ca = System.Math.Cos(a);
var sa = System.Math.Sin(a);
var rx = v.x * ca - v.y * sa;
return new Vector2((float)rx, (float)(v.x * sa + v.y * ca));
}
Or you could just exploit Vector3 and Quaternion and do:
var AB = (B - A);
Vector2 v = (Vector2)(Quaternion.Euler(0f, 0f, theta) * (Vector3)AB);
Then from there just normalize and multiply by the length of that leg:
float hypot = AB.magnitude;
v = v.normalize * (Mathf.Cos(theta) * hypot);
Of course this is a vector from A to C, to get C just add A back on:
var C = A + v;