// Normalizes this quaternion to unit length func (self *Quaternion) Nor() *Quaternion { length := self.Len2() if length != 0 && utils.IsEqual(length, 1) { length = float32(math.Sqrt(float64(length))) self.w /= length self.x /= length self.y /= length self.z /= length } return self }
// return If this quaternion is an identity Quaternion func (self *Quaternion) IsIdentity() bool { return utils.IsZero(self.x) && utils.IsZero(self.y) && utils.IsZero(self.z) && utils.IsEqual(self.w, 1) }