def noise3d(self, x, y, z):
<EOL>stretch_offset = (x + y + z) * STRETCH_CONSTANT_3D<EOL>xs = x + stretch_offset<EOL>ys = y + stretch_offset<EOL>zs = z + stretch_offset<EOL>xsb = floor(xs)<EOL>ysb = floor(ys)<EOL>zsb = floor(zs)<EOL>squish_offset = (xsb + ysb + zsb) * SQUISH_CONSTANT_3D<EOL>xb = xsb + squish_offset<EOL>yb = ysb + squish_offset<EOL>zb = zsb + squish_offset<EOL>xins = xs - xsb<EOL>yins = ys - ysb<EOL>zins = zs - zsb<EOL>in_sum = xins + yins + zins<EOL>dx0 = x - xb<EOL>dy0 = y - yb<EOL>dz0 = z - zb<EOL>value = <NUM_LIT:0><EOL>extrapolate = self._extrapolate3d<EOL>if in_sum <= <NUM_LIT:1>: <EOL><INDENT>a_point = <NUM_LIT><EOL>a_score = xins<EOL>b_point = <NUM_LIT><EOL>b_score = yins<EOL>if a_score >= b_score and zins > b_score:<EOL><INDENT>b_score = zins<EOL>b_point = <NUM_LIT><EOL><DEDENT>elif a_score < b_score and zins > a_score:<EOL><INDENT>a_score = zins<EOL>a_point = <NUM_LIT><EOL><DEDENT>wins = <NUM_LIT:1> - in_sum<EOL>if wins > a_score or wins > b_score: <EOL><INDENT>c = b_point if (b_score > a_score) else a_point <EOL>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>xsv_ext0 = xsb - <NUM_LIT:1><EOL>xsv_ext1 = xsb<EOL>dx_ext0 = dx0 + <NUM_LIT:1><EOL>dx_ext1 = dx0<EOL><DEDENT>else:<EOL><INDENT>xsv_ext0 = xsv_ext1 = xsb + <NUM_LIT:1><EOL>dx_ext0 = dx_ext1 = dx0 - <NUM_LIT:1><EOL><DEDENT>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysb<EOL>dy_ext0 = dy_ext1 = dy0<EOL>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>ysv_ext1 -= <NUM_LIT:1><EOL>dy_ext1 += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>ysv_ext0 -= <NUM_LIT:1><EOL>dy_ext0 += <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysb + <NUM_LIT:1><EOL>dy_ext0 = dy_ext1 = dy0 - <NUM_LIT:1><EOL><DEDENT>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 = zsb<EOL>zsv_ext1 = zsb - <NUM_LIT:1><EOL>dz_ext0 = dz0<EOL>dz_ext1 = dz0 + <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsb + <NUM_LIT:1><EOL>dz_ext0 = dz_ext1 = dz0 - <NUM_LIT:1><EOL><DEDENT><DEDENT>else: <EOL><INDENT>c = (a_point | b_point) <EOL>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>xsv_ext0 = xsb<EOL>xsv_ext1 = xsb - <NUM_LIT:1><EOL>dx_ext0 = dx0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dx_ext1 = dx0 + <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL><DEDENT>else:<EOL><INDENT>xsv_ext0 = xsv_ext1 = xsb + <NUM_LIT:1><EOL>dx_ext0 = dx0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dx_ext1 = dx0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL><DEDENT>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>ysv_ext0 = ysb<EOL>ysv_ext1 = ysb - <NUM_LIT:1><EOL>dy_ext0 = dy0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dy_ext1 = dy0 + <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL><DEDENT>else:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysb + <NUM_LIT:1><EOL>dy_ext0 = dy0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dy_ext1 = dy0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL><DEDENT>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 = zsb<EOL>zsv_ext1 = zsb - <NUM_LIT:1><EOL>dz_ext0 = dz0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dz_ext1 = dz0 + <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL><DEDENT>else:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsb + <NUM_LIT:1><EOL>dz_ext0 = dz0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dz_ext1 = dz0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL><DEDENT><DEDENT>attn0 = <NUM_LIT:2> - dx0 * dx0 - dy0 * dy0 - dz0 * dz0<EOL>if attn0 > <NUM_LIT:0>:<EOL><INDENT>attn0 *= attn0<EOL>value += attn0 * attn0 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:0>, dx0, dy0, dz0)<EOL><DEDENT>dx1 = dx0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dy1 = dy0 - <NUM_LIT:0> - SQUISH_CONSTANT_3D<EOL>dz1 = dz0 - <NUM_LIT:0> - SQUISH_CONSTANT_3D<EOL>attn1 = <NUM_LIT:2> - dx1 * dx1 - dy1 * dy1 - dz1 * dz1<EOL>if attn1 > <NUM_LIT:0>:<EOL><INDENT>attn1 *= attn1<EOL>value += attn1 * attn1 * extrapolate(xsb + <NUM_LIT:1>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:0>, dx1, dy1, dz1)<EOL><DEDENT>dx2 = dx0 - <NUM_LIT:0> - SQUISH_CONSTANT_3D<EOL>dy2 = dy0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dz2 = dz1<EOL>attn2 = <NUM_LIT:2> - dx2 * dx2 - dy2 * dy2 - dz2 * dz2<EOL>if attn2 > <NUM_LIT:0>:<EOL><INDENT>attn2 *= attn2<EOL>value += attn2 * attn2 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:1>, zsb + <NUM_LIT:0>, dx2, dy2, dz2)<EOL><DEDENT>dx3 = dx2<EOL>dy3 = dy1<EOL>dz3 = dz0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>attn3 = <NUM_LIT:2> - dx3 * dx3 - dy3 * dy3 - dz3 * dz3<EOL>if attn3 > <NUM_LIT:0>:<EOL><INDENT>attn3 *= attn3<EOL>value += attn3 * attn3 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:1>, dx3, dy3, dz3)<EOL><DEDENT><DEDENT>elif in_sum >= <NUM_LIT:2>: <EOL><INDENT>a_point = <NUM_LIT><EOL>a_score = xins<EOL>b_point = <NUM_LIT><EOL>b_score = yins<EOL>if a_score <= b_score and zins < b_score:<EOL><INDENT>b_score = zins<EOL>b_point = <NUM_LIT><EOL><DEDENT>elif a_score > b_score and zins < a_score:<EOL><INDENT>a_score = zins<EOL>a_point = <NUM_LIT><EOL><DEDENT>wins = <NUM_LIT:3> - in_sum<EOL>if wins < a_score or wins < b_score: <EOL><INDENT>c = b_point if (b_score < a_score) else a_point <EOL>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>xsv_ext0 = xsb + <NUM_LIT:2><EOL>xsv_ext1 = xsb + <NUM_LIT:1><EOL>dx_ext0 = dx0 - <NUM_LIT:2> - <NUM_LIT:3> * SQUISH_CONSTANT_3D<EOL>dx_ext1 = dx0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_3D<EOL><DEDENT>else:<EOL><INDENT>xsv_ext0 = xsv_ext1 = xsb<EOL>dx_ext0 = dx_ext1 = dx0 - <NUM_LIT:3> * SQUISH_CONSTANT_3D<EOL><DEDENT>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysb + <NUM_LIT:1><EOL>dy_ext0 = dy_ext1 = dy0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_3D<EOL>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>ysv_ext1 += <NUM_LIT:1><EOL>dy_ext1 -= <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>ysv_ext0 += <NUM_LIT:1><EOL>dy_ext0 -= <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysb<EOL>dy_ext0 = dy_ext1 = dy0 - <NUM_LIT:3> * SQUISH_CONSTANT_3D<EOL><DEDENT>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 = zsb + <NUM_LIT:1><EOL>zsv_ext1 = zsb + <NUM_LIT:2><EOL>dz_ext0 = dz0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_3D<EOL>dz_ext1 = dz0 - <NUM_LIT:2> - <NUM_LIT:3> * SQUISH_CONSTANT_3D<EOL><DEDENT>else:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsb<EOL>dz_ext0 = dz_ext1 = dz0 - <NUM_LIT:3> * SQUISH_CONSTANT_3D<EOL><DEDENT><DEDENT>else: <EOL><INDENT>c = (a_point & b_point) <EOL>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>xsv_ext0 = xsb + <NUM_LIT:1><EOL>xsv_ext1 = xsb + <NUM_LIT:2><EOL>dx_ext0 = dx0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dx_ext1 = dx0 - <NUM_LIT:2> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL><DEDENT>else:<EOL><INDENT>xsv_ext0 = xsv_ext1 = xsb<EOL>dx_ext0 = dx0 - SQUISH_CONSTANT_3D<EOL>dx_ext1 = dx0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL><DEDENT>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>ysv_ext0 = ysb + <NUM_LIT:1><EOL>ysv_ext1 = ysb + <NUM_LIT:2><EOL>dy_ext0 = dy0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dy_ext1 = dy0 - <NUM_LIT:2> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL><DEDENT>else:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysb<EOL>dy_ext0 = dy0 - SQUISH_CONSTANT_3D<EOL>dy_ext1 = dy0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL><DEDENT>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 = zsb + <NUM_LIT:1><EOL>zsv_ext1 = zsb + <NUM_LIT:2><EOL>dz_ext0 = dz0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dz_ext1 = dz0 - <NUM_LIT:2> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL><DEDENT>else:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsb<EOL>dz_ext0 = dz0 - SQUISH_CONSTANT_3D<EOL>dz_ext1 = dz0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL><DEDENT><DEDENT>dx3 = dx0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dy3 = dy0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dz3 = dz0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>attn3 = <NUM_LIT:2> - dx3 * dx3 - dy3 * dy3 - dz3 * dz3<EOL>if attn3 > <NUM_LIT:0>:<EOL><INDENT>attn3 *= attn3<EOL>value += attn3 * attn3 * extrapolate(xsb + <NUM_LIT:1>, ysb + <NUM_LIT:1>, zsb + <NUM_LIT:0>, dx3, dy3, dz3)<EOL><DEDENT>dx2 = dx3<EOL>dy2 = dy0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dz2 = dz0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>attn2 = <NUM_LIT:2> - dx2 * dx2 - dy2 * dy2 - dz2 * dz2<EOL>if attn2 > <NUM_LIT:0>:<EOL><INDENT>attn2 *= attn2<EOL>value += attn2 * attn2 * extrapolate(xsb + <NUM_LIT:1>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:1>, dx2, dy2, dz2)<EOL><DEDENT>dx1 = dx0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dy1 = dy3<EOL>dz1 = dz2<EOL>attn1 = <NUM_LIT:2> - dx1 * dx1 - dy1 * dy1 - dz1 * dz1<EOL>if attn1 > <NUM_LIT:0>:<EOL><INDENT>attn1 *= attn1<EOL>value += attn1 * attn1 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:1>, zsb + <NUM_LIT:1>, dx1, dy1, dz1)<EOL><DEDENT>dx0 = dx0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_3D<EOL>dy0 = dy0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_3D<EOL>dz0 = dz0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_3D<EOL>attn0 = <NUM_LIT:2> - dx0 * dx0 - dy0 * dy0 - dz0 * dz0<EOL>if attn0 > <NUM_LIT:0>:<EOL><INDENT>attn0 *= attn0<EOL>value += attn0 * attn0 * extrapolate(xsb + <NUM_LIT:1>, ysb + <NUM_LIT:1>, zsb + <NUM_LIT:1>, dx0, dy0, dz0)<EOL><DEDENT><DEDENT>else: <EOL><INDENT>p1 = xins + yins<EOL>if p1 > <NUM_LIT:1>:<EOL><INDENT>a_score = p1 - <NUM_LIT:1><EOL>a_point = <NUM_LIT><EOL>a_is_further_side = True<EOL><DEDENT>else:<EOL><INDENT>a_score = <NUM_LIT:1> - p1<EOL>a_point = <NUM_LIT><EOL>a_is_further_side = False<EOL><DEDENT>p2 = xins + zins<EOL>if p2 > <NUM_LIT:1>:<EOL><INDENT>b_score = p2 - <NUM_LIT:1><EOL>b_point = <NUM_LIT><EOL>b_is_further_side = True<EOL><DEDENT>else:<EOL><INDENT>b_score = <NUM_LIT:1> - p2<EOL>b_point = <NUM_LIT><EOL>b_is_further_side = False<EOL><DEDENT>p3 = yins + zins<EOL>if p3 > <NUM_LIT:1>:<EOL><INDENT>score = p3 - <NUM_LIT:1><EOL>if a_score <= b_score and a_score < score:<EOL><INDENT>a_point = <NUM_LIT><EOL>a_is_further_side = True<EOL><DEDENT>elif a_score > b_score and b_score < score:<EOL><INDENT>b_point = <NUM_LIT><EOL>b_is_further_side = True<EOL><DEDENT><DEDENT>else:<EOL><INDENT>score = <NUM_LIT:1> - p3<EOL>if a_score <= b_score and a_score < score:<EOL><INDENT>a_point = <NUM_LIT><EOL>a_is_further_side = False<EOL><DEDENT>elif a_score > b_score and b_score < score:<EOL><INDENT>b_point = <NUM_LIT><EOL>b_is_further_side = False<EOL><DEDENT><DEDENT>if a_is_further_side == b_is_further_side:<EOL><INDENT>if a_is_further_side: <EOL><INDENT>dx_ext0 = dx0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_3D<EOL>dy_ext0 = dy0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_3D<EOL>dz_ext0 = dz0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_3D<EOL>xsv_ext0 = xsb + <NUM_LIT:1><EOL>ysv_ext0 = ysb + <NUM_LIT:1><EOL>zsv_ext0 = zsb + <NUM_LIT:1><EOL>c = (a_point & b_point)<EOL>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>dx_ext1 = dx0 - <NUM_LIT:2> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dy_ext1 = dy0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dz_ext1 = dz0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>xsv_ext1 = xsb + <NUM_LIT:2><EOL>ysv_ext1 = ysb<EOL>zsv_ext1 = zsb<EOL><DEDENT>elif (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>dx_ext1 = dx0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dy_ext1 = dy0 - <NUM_LIT:2> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dz_ext1 = dz0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>xsv_ext1 = xsb<EOL>ysv_ext1 = ysb + <NUM_LIT:2><EOL>zsv_ext1 = zsb<EOL><DEDENT>else:<EOL><INDENT>dx_ext1 = dx0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dy_ext1 = dy0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dz_ext1 = dz0 - <NUM_LIT:2> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>xsv_ext1 = xsb<EOL>ysv_ext1 = ysb<EOL>zsv_ext1 = zsb + <NUM_LIT:2><EOL><DEDENT><DEDENT>else:<EOL><INDENT>dx_ext0 = dx0<EOL>dy_ext0 = dy0<EOL>dz_ext0 = dz0<EOL>xsv_ext0 = xsb<EOL>ysv_ext0 = ysb<EOL>zsv_ext0 = zsb<EOL>c = (a_point | b_point)<EOL>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>dx_ext1 = dx0 + <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dy_ext1 = dy0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dz_ext1 = dz0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>xsv_ext1 = xsb - <NUM_LIT:1><EOL>ysv_ext1 = ysb + <NUM_LIT:1><EOL>zsv_ext1 = zsb + <NUM_LIT:1><EOL><DEDENT>elif (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>dx_ext1 = dx0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dy_ext1 = dy0 + <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dz_ext1 = dz0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>xsv_ext1 = xsb + <NUM_LIT:1><EOL>ysv_ext1 = ysb - <NUM_LIT:1><EOL>zsv_ext1 = zsb + <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>dx_ext1 = dx0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dy_ext1 = dy0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dz_ext1 = dz0 + <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>xsv_ext1 = xsb + <NUM_LIT:1><EOL>ysv_ext1 = ysb + <NUM_LIT:1><EOL>zsv_ext1 = zsb - <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>else: <EOL><INDENT>if a_is_further_side:<EOL><INDENT>c1 = a_point<EOL>c2 = b_point<EOL><DEDENT>else:<EOL><INDENT>c1 = b_point<EOL>c2 = a_point<EOL><DEDENT>if (c1 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>dx_ext0 = dx0 + <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dy_ext0 = dy0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dz_ext0 = dz0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>xsv_ext0 = xsb - <NUM_LIT:1><EOL>ysv_ext0 = ysb + <NUM_LIT:1><EOL>zsv_ext0 = zsb + <NUM_LIT:1><EOL><DEDENT>elif (c1 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>dx_ext0 = dx0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dy_ext0 = dy0 + <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dz_ext0 = dz0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>xsv_ext0 = xsb + <NUM_LIT:1><EOL>ysv_ext0 = ysb - <NUM_LIT:1><EOL>zsv_ext0 = zsb + <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>dx_ext0 = dx0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dy_ext0 = dy0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dz_ext0 = dz0 + <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>xsv_ext0 = xsb + <NUM_LIT:1><EOL>ysv_ext0 = ysb + <NUM_LIT:1><EOL>zsv_ext0 = zsb - <NUM_LIT:1><EOL><DEDENT>dx_ext1 = dx0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dy_ext1 = dy0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dz_ext1 = dz0 - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>xsv_ext1 = xsb<EOL>ysv_ext1 = ysb<EOL>zsv_ext1 = zsb<EOL>if (c2 & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>dx_ext1 -= <NUM_LIT:2><EOL>xsv_ext1 += <NUM_LIT:2><EOL><DEDENT>elif (c2 & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>dy_ext1 -= <NUM_LIT:2><EOL>ysv_ext1 += <NUM_LIT:2><EOL><DEDENT>else:<EOL><INDENT>dz_ext1 -= <NUM_LIT:2><EOL>zsv_ext1 += <NUM_LIT:2><EOL><DEDENT><DEDENT>dx1 = dx0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dy1 = dy0 - <NUM_LIT:0> - SQUISH_CONSTANT_3D<EOL>dz1 = dz0 - <NUM_LIT:0> - SQUISH_CONSTANT_3D<EOL>attn1 = <NUM_LIT:2> - dx1 * dx1 - dy1 * dy1 - dz1 * dz1<EOL>if attn1 > <NUM_LIT:0>:<EOL><INDENT>attn1 *= attn1<EOL>value += attn1 * attn1 * extrapolate(xsb + <NUM_LIT:1>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:0>, dx1, dy1, dz1)<EOL><DEDENT>dx2 = dx0 - <NUM_LIT:0> - SQUISH_CONSTANT_3D<EOL>dy2 = dy0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>dz2 = dz1<EOL>attn2 = <NUM_LIT:2> - dx2 * dx2 - dy2 * dy2 - dz2 * dz2<EOL>if attn2 > <NUM_LIT:0>:<EOL><INDENT>attn2 *= attn2<EOL>value += attn2 * attn2 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:1>, zsb + <NUM_LIT:0>, dx2, dy2, dz2)<EOL><DEDENT>dx3 = dx2<EOL>dy3 = dy1<EOL>dz3 = dz0 - <NUM_LIT:1> - SQUISH_CONSTANT_3D<EOL>attn3 = <NUM_LIT:2> - dx3 * dx3 - dy3 * dy3 - dz3 * dz3<EOL>if attn3 > <NUM_LIT:0>:<EOL><INDENT>attn3 *= attn3<EOL>value += attn3 * attn3 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:1>, dx3, dy3, dz3)<EOL><DEDENT>dx4 = dx0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dy4 = dy0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dz4 = dz0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>attn4 = <NUM_LIT:2> - dx4 * dx4 - dy4 * dy4 - dz4 * dz4<EOL>if attn4 > <NUM_LIT:0>:<EOL><INDENT>attn4 *= attn4<EOL>value += attn4 * attn4 * extrapolate(xsb + <NUM_LIT:1>, ysb + <NUM_LIT:1>, zsb + <NUM_LIT:0>, dx4, dy4, dz4)<EOL><DEDENT>dx5 = dx4<EOL>dy5 = dy0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dz5 = dz0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>attn5 = <NUM_LIT:2> - dx5 * dx5 - dy5 * dy5 - dz5 * dz5<EOL>if attn5 > <NUM_LIT:0>:<EOL><INDENT>attn5 *= attn5<EOL>value += attn5 * attn5 * extrapolate(xsb + <NUM_LIT:1>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:1>, dx5, dy5, dz5)<EOL><DEDENT>dx6 = dx0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_3D<EOL>dy6 = dy4<EOL>dz6 = dz5<EOL>attn6 = <NUM_LIT:2> - dx6 * dx6 - dy6 * dy6 - dz6 * dz6<EOL>if attn6 > <NUM_LIT:0>:<EOL><INDENT>attn6 *= attn6<EOL>value += attn6 * attn6 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:1>, zsb + <NUM_LIT:1>, dx6, dy6, dz6)<EOL><DEDENT><DEDENT>attn_ext0 = <NUM_LIT:2> - dx_ext0 * dx_ext0 - dy_ext0 * dy_ext0 - dz_ext0 * dz_ext0<EOL>if attn_ext0 > <NUM_LIT:0>:<EOL><INDENT>attn_ext0 *= attn_ext0<EOL>value += attn_ext0 * attn_ext0 * extrapolate(xsv_ext0, ysv_ext0, zsv_ext0, dx_ext0, dy_ext0, dz_ext0)<EOL><DEDENT>attn_ext1 = <NUM_LIT:2> - dx_ext1 * dx_ext1 - dy_ext1 * dy_ext1 - dz_ext1 * dz_ext1<EOL>if attn_ext1 > <NUM_LIT:0>:<EOL><INDENT>attn_ext1 *= attn_ext1<EOL>value += attn_ext1 * attn_ext1 * extrapolate(xsv_ext1, ysv_ext1, zsv_ext1, dx_ext1, dy_ext1, dz_ext1)<EOL><DEDENT>return value / NORM_CONSTANT_3D<EOL>
Generate 3D OpenSimplex noise from X,Y,Z coordinates.