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?

enter image description here

  • \$\begingroup\$ Down vote without a reason. How am suppose to know whats wrong with the question or let alone improve it? \$\endgroup\$ – Containment Apr 9 '18 at 21:58
  • \$\begingroup\$ This is off topic. please consider using math.stackexchange.com instead for maths questions. \$\endgroup\$ – 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.

| improve this answer | |
  • \$\begingroup\$ Please what does || represent? I used the Unity tag, because I'm implementing this in a C# Script. \$\endgroup\$ – Containment Apr 9 '18 at 21:57
  • \$\begingroup\$ @Containment it's the length of the vector inside :) \$\endgroup\$ – 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;

| improve this answer | |

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$$

| improve this answer | |
  • \$\begingroup\$ You're missing a factor, A lies on a unit circle around P2 here. \$\endgroup\$ – Quentin Apr 9 '18 at 15:35
  • \$\begingroup\$ @Quentin there you go \$\endgroup\$ – 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;

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.