Calculate new point by Normal vector

Hi all!
I need to apply an offset (AK, KC) to point A, i.e. Vector2d and do it perpendicular to AB
as it shown on the picture.

So this is a 2d problem, right? Because otherwise your distance AK would trace a circle around the normal. So K wouldn’t be a point but a circle. So in case we talk about 2d it’s actually quite simple. First get your normal vector AB and normalize it. So our normal points towards B. To get the perpendicular to your normal all you have to do is rotate the normal by 90° this is super simpler in 2d because a 90° rotation just means swapping the two components and inverting one of them. Which component you invert dictates the rotation direction. Since we need a counter-clockwise rotation we just do:

Vector2 n = (B - A).normalized;
Vector2 p = new Vector2(-n.y, n.x); // 90° counter clockwise rotation

With those two vectors it’s just ordinary vector addition:

Vector2 C = A - n * KC + p * AK;

This should give you the point you’re looking for.

Note if you need this in a 3d environment you need to specify more data as the problem is not solvable with the current information.

Since you know AK and KC then you can determine AC, which is AK + KC.

Then to find the coordinates of C, you can do A + AC = C.

Add a comment if I have misunderstood this :slight_smile: