Getting the Rotation of a Rectangular Prism like Region3

I’m trying to replicate Region3 (to satisfy my curiousity), especially its properties CFrame and Size.

I already know how to get the position and size

-- a and b are positions of two opposite corners in a rectangular prism
-- a is the lower part of the prism, while b is the upper part of the prism
local position = (a + b) / 2
local size = (2*position) - (2*a) -- or (2*b) - (2*position)

but I really don’t know how to get the rotation/orientation of the rectangular prism like how Region3 does. Keep in mind that I do NOT want to use Region3 since it will be cheating.

Thank you! :heartpulse:

this will be my last bump, please i need help, thank you

thats a lot of math…

uhh how am i gonna do that :sweat_smile:

This text will be blurred

can someone help me here :((((

maybe this could help How to get the Rotation of something? - #3 by dthecoolest