getBasisAt static method
normal
- The normal vector (assumed to be unit length).
shBasis
- The resulting SH basis.
Computes the SH basis for the given normal vector.
Implementation
static void getBasisAt(Vector3 normal, List<double> shBasis) {
// normal is assumed to be unit length
final 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);
}