Finding the orientation of a triangle's angular bisect?

When given three vectors (blue parts), I’m trying to find what the orientation of the grey part will be assuming that the lower left vector is the angle being used. I’m sure there is an easy solution but I’m having trouble figuring it out.

I’m assuming you want the grey line to go through the middle of the parts in 2D space (also called the midpoint):

local midPoint = + xPos2) / 2, 0, (yPos1 + yPos2) / 2)

Then you’d use atan2 to calculate the rotation (Part is the bottom left part):

local rotation = math.deg(math.atan2(midPoint.Z - Part.Position.Z, midPoint.X - Part.Position.X))

If you want to find a right angle (or perpendicular bisector) so the grey part is always 90 degrees from the slope of the top left and bottom right parts, you’d need to find the opposite slope and calculate the point of intersection and replace midPoint with that value.

local intersection = -- The point of intersection
local rotation =  math.deg(math.atan2(intersection.Z - Part.Position.Z, intersection.X - Part.Position.X))

I don’t have the brainpower to explain how to get point of intersection right now so this website may help:

Make sure you replace the Y coordinate with the Z coordinate as I’m assuming you’re not dealing with the Y coordinate.