← All math tools

Inverse Bisector

Find the unit vector pointing away from the angle formed by two rays. Vertex B is where the rays meet.

View the Unity C# source on GitHub

3D view

Drag an orange handle to move it, or drag an arrow to move along one axis. Drag the background to orbit. Results are drawn in green.

Result

Inputs

Point A
Vertex B
Point C

Unity C#

The same calculation as a Unity C# helper.

using UnityEngine;

public static class InverseBisector
{
    public static bool TryGetDirection(Vector3 a, Vector3 vertex, Vector3 c, out Vector3 direction)
    {
        direction = Vector3.zero;
        Vector3 rayA = a - vertex;
        Vector3 rayC = c - vertex;
        float lengthA = rayA.magnitude;
        float lengthC = rayC.magnitude;
        if (lengthA == 0f || lengthC == 0f) return false;

        Vector3 sum = rayA / lengthA + rayC / lengthC;
        float length = sum.magnitude;
        if (length <= 1e-6f) return false;

        direction = -sum / length;
        return true;
    }
}