noise3XYBeforeZ method

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

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

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

Implementation

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

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