Find bisector of a line segment

Hi, I am new to unity and I need help.

I have two Vector3 - A and B. Lets say we connect them with a line.

I need to find the bisector of that line segment (the line that is perpendicular to the segment and it originates from its midpoint).

I tried my best to do it by myself but to no avail. Any help would be appreciated.

207673-picture.png

Refer to picture for more details.

207681-gif-30052023-12-38-29.gif

using UnityEngine;

//
//           C
//           |
//           |
//    A------O------B
//
public class BisectorOfALineSegment : MonoBehaviour
{
    [SerializeField] Vector3 A = new Vector3(2,2,1);
    [SerializeField] Vector3 B = new Vector3(-6,8,9);
    
    #if UNITY_EDITOR
    void OnDrawGizmos ()
    {
        var camera = UnityEditor.SceneView.lastActiveSceneView.camera;// replace with in-game camera elsewhere
        Vector3 viewDirection = camera.transform.forward;
        
        Vector3 O = A + (B-A)*0.5f;
        Vector3 OC = Vector3.Cross( viewDirection , B-O );
        Vector3 C = O + OC;

        Gizmos.color = Color.black; Gizmos.DrawLine( A , B );
        Gizmos.color = Color.red; Gizmos.DrawLine( O , C );
        UnityEditor.Handles.Label( A , nameof(A) );
        UnityEditor.Handles.Label( B , nameof(B) );
        UnityEditor.Handles.Label( C , nameof(C) );
        UnityEditor.Handles.Label( O , nameof(O) );
        UnityEditor.Handles.Label( O+OC*0.5f , $"{nameof(OC)} = {OC}" );
    }
    #endif
}