getBasisAt static method

dynamic getBasisAt(
  1. Vector3 normal,
  2. List<double> shBasis
)

Implementation

static getBasisAt(Vector3 normal, List<double> shBasis) {
  // normal is assumed to be unit length

  var x = normal.x, y = normal.y, z = normal.z;

  // band 0
  shBasis[0] = 0.282095;

  // band 1
  shBasis[1] = 0.488603 * y;
  shBasis[2] = 0.488603 * z;
  shBasis[3] = 0.488603 * x;

  // band 2
  shBasis[4] = 1.092548 * x * y;
  shBasis[5] = 1.092548 * y * z;
  shBasis[6] = 0.315392 * (3 * z * z - 1);
  shBasis[7] = 1.092548 * x * z;
  shBasis[8] = 0.546274 * (x * x - y * y);
}