How to calculate rotation value of 2 connected edges corner

I can take 2 edges bisector angle value with middle = (theta1+theta2)/2, but I dont know how to calculate rotation value that direction is always outwards from the corner. I need rotation value for rotating object from its 0,0,0 rotation.

Sometimes rotation is right and sometimes opposite, depending of the angle.
So in shortly, object -Y direction is always facing away from the corner.



I do not know if you got it right but, from what I can see in the images, you can take the vector bisect between these edges and use the function to_track_quat:

import bpy
import mathutils
from mathutils import Vector

co1 = Vector((2,0,0))
co2 = Vector((0,3,0))
co_mid = Vector()

vec1 = (co1 - co_mid).normalized()
vec2 = (co2 - co_mid).normalized()

vec_result = vec1+vec2

obj = bpy.context.object
obj.rotation_mode = 'QUATERNION'
obj.rotation_quaternion = mathutils.Vector.to_track_quat(-vec_result, 'X', 'Z')

Thank you mano, so far every angle tests seems right :slight_smile: