setAxisAngle method

void setAxisAngle(
  1. double ax,
  2. double ay,
  3. double az,
  4. double angle,
)

Set to a rotation of angle radians about the axis (ax, ay, az). A zero axis gives the identity.

Implementation

void setAxisAngle(double ax, double ay, double az, double angle) {
  final len = math.sqrt(ax * ax + ay * ay + az * az);
  if (len < 1e-12) {
    setIdentity();
    return;
  }
  final half = angle * 0.5;
  final s = math.sin(half) / len;
  x = ax * s;
  y = ay * s;
  z = az * s;
  w = math.cos(half);
}