def as_rotation(self): """ The rotation represented by self, given as an angle around an vector serving as the Euler axis of rotation. """ qs = self.unit().components() half_theta = acos(qs[0]) if half_theta < EPSILON: return (0.0,vector(1.0,0.0,0.0)) else: return (2.0*half_theta, vector.with_components(qs[1:])/sin(half_theta))
def as_rotation(self): """ The rotation represented by self, given as an angle around an vector serving as the Euler axis of rotation. """ qs = self.unit().components() half_theta = acos(qs[0]) if half_theta < EPSILON: return (0.0,vector(1.0,0.0,0.0)) else: return (2.0*half_theta, vector.with_components(qs[1:])/sin(half_theta))
def with_components(cls,qs): """ Constructs a new quat instance from [q0,q1,q2,q3]. """ return quat(qs[0],vector.with_components(qs[1:]))
def with_components(cls,qs): """ Constructs a new quat instance from [q0,q1,q2,q3]. """ return quat(qs[0],vector.with_components(qs[1:]))