# Quaternion from max and min coordinate values of the Cube?

I am facing some problem in creating the orientation of detected objects. I know the max and min coordinate values (xmin, xmax, ymin, ymax, zmin, zmax). So, I can easily find the vertex of the objects Bounding BOX (Cube) which are

[xmin ymin zmin;
xmax ymin zmin;
xmax ymax zmin;
xmin ymax zmin;
xmin ymin zmax;
xmax ymin zmax;
xmax ymax zmax;
xmin ymax zmax]


Now how can I create the quaternion from axis angle representation in order to get the orientation of the bounding box? I know that a quaternion is a set of 4 numbers, [x y z w], which represents rotations the following way:

// RotationAngle is in radians
x = RotationAxis.x * sin(RotationAngle / 2)
y = RotationAxis.y * sin(RotationAngle / 2)
z = RotationAxis.z * sin(RotationAngle / 2)
w = cos(RotationAngle / 2)


How to get the RotationAxis and RotationAngle when knowing the vertex of the object (in my case is a cube or 3D rectangle)?

Thanks

edit retag close merge delete