# How to find points that lie on a circle

From the image below I know the vectors P1, P2 and P3. How can I find the point A which lies on the circle and line P2A which is a bisector (angle q and r are equal) of the lines P2P1 and P2B? Also how can I find the point B which is in the same direction as P2P3 and lies on the circle?

• Down vote without a reason. How am suppose to know whats wrong with the question or let alone improve it? – Containment Apr 9 '18 at 21:58
• This is off topic. please consider using math.stackexchange.com instead for maths questions. – Richard Fabian Apr 10 '18 at 10:57

First, let's name some more vectors so that the origin is at P2 :

$$v_1 = P_1 - P_2$$ $$v_3 = P_3 - P_2$$

We can find B by normalizing v3 and scaling it by the length of v1 (that is, the radius of the circle):

$$v_B = {\lVert v_1 \rVert \over \lVert v_3 \rVert} v_3$$ $$B = P_2 + v_B$$

Finally, we can sum both side vectors to get a bisector, and normalize and scale that to get A: $$v_A = {\lVert v_1 \rVert \over \lVert v_1 + v_B \rVert}(v_1 + v_B)$$ $$A = P_2 + v_A$$

You will probably find possible optimizations while implementing this.

• Please what does || represent? I used the Unity tag, because I'm implementing this in a C# Script. – Containment Apr 9 '18 at 21:57
• @Containment it's the length of the vector inside :) – Quentin Apr 10 '18 at 8:12

P2P3.normalized*R = P2B;

Where R = P2P1.magnitude or R = P2A.magnitude; etc...

P2A = Quaternion.AngleAxis(Q, Vector3.forward)* P2P1 = Quaternion.AngleAxis(-r, Vector3.forward)* P2B;

Let $\vec a$ be $P1- P2$ and $\vec b$ be $P3-P2$

Then point B is simply

$$P2 +\frac{\vec b}{|\vec b|} \cdot radius$$

And point A is

$$\vec c = (B + P1) / 2 - P2$$ $$A = P2 + \frac{\vec c}{|\vec c|} \cdot radius$$

• You're missing a factor, A lies on a unit circle around P2 here. – Quentin Apr 9 '18 at 15:35
• @Quentin there you go – Bálint Apr 9 '18 at 15:39

Here's the answer strictly in unity's terms.

public Vector2 p1;
public Vector2 p2;
public Vector2 p3;
Vector2 b;
Vector2 a;

void Start() {
float radius = (p1 - p2).magnitude;
//Direction from p2 to p3
Vector2 p2_p3_Dir = (p3 - p2).normalized;
//Find point b
b = p2 + p2_p3_Dir * radius;

//Vector from b to p1
Vector2 b_p1 = (p1 - b);
//Distance from b to p1
float b_p1_Distance = b_p1.magnitude;
//Direction vector from b to p1
Vector2 b_p1_Dir = b_p1.normalized;
//Temporary point midway between b and p1
Vector2 temp = b + b_p1_Dir * (b_p1_Distance/2);
//Direction from p2 to temp
Vector2 p2_temp_Dir = (temp - p2).normalized;
//Finally, find a
a = p2 + p2_temp_Dir * radius;

}