Vector4D.qFromEuler constructor

Vector4D.qFromEuler(
  1. double pitch,
  2. double yaw,
  3. double roll
)

Implementation

factory Vector4D.qFromEuler(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 .vec4(
    x1*y0*z0 - x0*y1*z1,
    x0*y1*z0 + x1*y0*z1,
    x0*y0*z1 - x1*y1*z0,
    x0*y0*z0 + x1*y1*z1,
  );
}