If q = (w, x, y, z), where w is the “scalar part” and qv = (x, y, z) is the “vector part”, then you can calculate the angle between qv and each of the basis vectors vx , vy, vz using the point product.
cos (theta) = (qv dot vx) / (| qv | * | vx |)
If cos (theta) is +1, the axis of rotation q is parallel to this base vector.
cos (theta) = -1 means that they are antiparallel.
source share