fromEuler static method

Returns a quaternion from pitch, yaw, roll Euler angles (in radians).

Implementation

static QuaternionBase fromEuler(double pitch, double yaw, double roll) {
  final x0 = math.cos(pitch*0.5);
  final x1 = math.sin(pitch*0.5);
  final y0 = math.cos(yaw*0.5);
  final y1 = math.sin(yaw*0.5);
  final z0 = math.cos(roll*0.5);
  final z1 = math.sin(roll*0.5);

  return createFactory(
    x1*y0*z0 - x0*y1*z1,
    x0*y1*z0 + x1*y0*z1,
    x0*y0*z1 - x1*y1*z0,
    x0*y0*z0 + x1*y1*z1,
  );
}