noise3XZBeforeY method

  1. @override
double noise3XZBeforeY(
  1. double x,
  2. double y,
  3. double z
)
override

3D Re-oriented 8-point BCC noise, with better visual isotropy in (X, Z).

Recommended for 3D terrain and time-varied animations. The Y coordinate should always be the "different" coordinate in your use case. If Y is vertical in world coordinates, call noise3XZBeforeY(x, Y, z). If Z is vertical in world coordinates, call noise3XZBeforeY(x, Z, y) or use noise3XYBeforeZ. For a time varied animation, call noise3XZBeforeY(x, T, y) or use noise3XYBeforeZ.

Implementation

@override
double noise3XZBeforeY(double x, double y, double z) {
  // Re-orient the cubic lattices without skewing, to make X and Z triangular like 2D.
  // Orthonormal rotation. Not a skew transform.
  double xz = x + z;
  double s2 = xz * -0.211324865405187;
  double yy = y * 0.577350269189626;
  double xr = x + s2 - yy;
  double zr = z + s2 - yy;
  double yr = xz * 0.577350269189626 + yy;

  // Evaluate both lattices to form a BCC lattice.
  return _noise3BCC(xr, yr, zr);
}