<EOL>stretch_offset = (x + y + z + w) * STRETCH_CONSTANT_4D<EOL>xs = x + stretch_offset<EOL>ys = y + stretch_offset<EOL>zs = z + stretch_offset<EOL>ws = w + stretch_offset<EOL>xsb = floor(xs)<EOL>ysb = floor(ys)<EOL>zsb = floor(zs)<EOL>wsb = floor(ws)<EOL>squish_offset = (xsb + ysb + zsb + wsb) * SQUISH_CONSTANT_4D<EOL>xb = xsb + squish_offset<EOL>yb = ysb + squish_offset<EOL>zb = zsb + squish_offset<EOL>wb = wsb + squish_offset<EOL>xins = xs - xsb<EOL>yins = ys - ysb<EOL>zins = zs - zsb<EOL>wins = ws - wsb<EOL>in_sum = xins + yins + zins + wins<EOL>dx0 = x - xb<EOL>dy0 = y - yb<EOL>dz0 = z - zb<EOL>dw0 = w - wb<EOL>value = <NUM_LIT:0><EOL>extrapolate = self._extrapolate4d<EOL>if in_sum <= <NUM_LIT:1>: <EOL><INDENT>a_po = <NUM_LIT><EOL>a_score = xins<EOL>b_po = <NUM_LIT><EOL>b_score = yins<EOL>if a_score >= b_score and zins > b_score:<EOL><INDENT>b_score = zins<EOL>b_po = <NUM_LIT><EOL><DEDENT>elif a_score < b_score and zins > a_score:<EOL><INDENT>a_score = zins<EOL>a_po = <NUM_LIT><EOL><DEDENT>if a_score >= b_score and wins > b_score:<EOL><INDENT>b_score = wins<EOL>b_po = <NUM_LIT><EOL><DEDENT>elif a_score < b_score and wins > a_score:<EOL><INDENT>a_score = wins<EOL>a_po = <NUM_LIT><EOL><DEDENT>uins = <NUM_LIT:1> - in_sum<EOL>if uins > a_score or uins > b_score: <EOL><INDENT>c = b_po if (b_score > a_score) else a_po <EOL>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>xsv_ext0 = xsb - <NUM_LIT:1><EOL>xsv_ext1 = xsv_ext2 = xsb<EOL>dx_ext0 = dx0 + <NUM_LIT:1><EOL>dx_ext1 = dx_ext2 = dx0<EOL><DEDENT>else:<EOL><INDENT>xsv_ext0 = xsv_ext1 = xsv_ext2 = xsb + <NUM_LIT:1><EOL>dx_ext0 = dx_ext1 = dx_ext2 = dx0 - <NUM_LIT:1><EOL><DEDENT>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb<EOL>dy_ext0 = dy_ext1 = dy_ext2 = dy0<EOL>if (c & <NUM_LIT>) == <NUM_LIT>:<EOL><INDENT>ysv_ext0 -= <NUM_LIT:1><EOL>dy_ext0 += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>ysv_ext1 -= <NUM_LIT:1><EOL>dy_ext1 += <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + <NUM_LIT:1><EOL>dy_ext0 = dy_ext1 = dy_ext2 = dy0 - <NUM_LIT:1><EOL><DEDENT>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb<EOL>dz_ext0 = dz_ext1 = dz_ext2 = dz0<EOL>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>if (c & <NUM_LIT>) == <NUM_LIT>:<EOL><INDENT>zsv_ext0 -= <NUM_LIT:1><EOL>dz_ext0 += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>zsv_ext1 -= <NUM_LIT:1><EOL>dz_ext1 += <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>zsv_ext2 -= <NUM_LIT:1><EOL>dz_ext2 += <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + <NUM_LIT:1><EOL>dz_ext0 = dz_ext1 = dz_ext2 = dz0 - <NUM_LIT:1><EOL><DEDENT>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>wsv_ext0 = wsv_ext1 = wsb<EOL>wsv_ext2 = wsb - <NUM_LIT:1><EOL>dw_ext0 = dw_ext1 = dw0<EOL>dw_ext2 = dw0 + <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>wsv_ext0 = wsv_ext1 = wsv_ext2 = wsb + <NUM_LIT:1><EOL>dw_ext0 = dw_ext1 = dw_ext2 = dw0 - <NUM_LIT:1><EOL><DEDENT><DEDENT>else: <EOL><INDENT>c = (a_po | b_po) <EOL>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>xsv_ext0 = xsv_ext2 = xsb<EOL>xsv_ext1 = xsb - <NUM_LIT:1><EOL>dx_ext0 = dx0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dx_ext1 = dx0 + <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL>dx_ext2 = dx0 - SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>xsv_ext0 = xsv_ext1 = xsv_ext2 = xsb + <NUM_LIT:1><EOL>dx_ext0 = dx0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dx_ext1 = dx_ext2 = dx0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL><DEDENT>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb<EOL>dy_ext0 = dy0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy_ext1 = dy_ext2 = dy0 - SQUISH_CONSTANT_4D<EOL>if (c & <NUM_LIT>) == <NUM_LIT>:<EOL><INDENT>ysv_ext1 -= <NUM_LIT:1><EOL>dy_ext1 += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>ysv_ext2 -= <NUM_LIT:1><EOL>dy_ext2 += <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + <NUM_LIT:1><EOL>dy_ext0 = dy0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy_ext1 = dy_ext2 = dy0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL><DEDENT>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb<EOL>dz_ext0 = dz0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz_ext1 = dz_ext2 = dz0 - SQUISH_CONSTANT_4D<EOL>if (c & <NUM_LIT>) == <NUM_LIT>:<EOL><INDENT>zsv_ext1 -= <NUM_LIT:1><EOL>dz_ext1 += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>zsv_ext2 -= <NUM_LIT:1><EOL>dz_ext2 += <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + <NUM_LIT:1><EOL>dz_ext0 = dz0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz_ext1 = dz_ext2 = dz0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL><DEDENT>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>wsv_ext0 = wsv_ext1 = wsb<EOL>wsv_ext2 = wsb - <NUM_LIT:1><EOL>dw_ext0 = dw0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw_ext1 = dw0 - SQUISH_CONSTANT_4D<EOL>dw_ext2 = dw0 + <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>wsv_ext0 = wsv_ext1 = wsv_ext2 = wsb + <NUM_LIT:1><EOL>dw_ext0 = dw0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw_ext1 = dw_ext2 = dw0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL><DEDENT><DEDENT>attn0 = <NUM_LIT:2> - dx0 * dx0 - dy0 * dy0 - dz0 * dz0 - dw0 * dw0<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>, wsb + <NUM_LIT:0>, dx0, dy0, dz0, dw0)<EOL><DEDENT>dx1 = dx0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL>dy1 = dy0 - <NUM_LIT:0> - SQUISH_CONSTANT_4D<EOL>dz1 = dz0 - <NUM_LIT:0> - SQUISH_CONSTANT_4D<EOL>dw1 = dw0 - <NUM_LIT:0> - SQUISH_CONSTANT_4D<EOL>attn1 = <NUM_LIT:2> - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1<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>, wsb + <NUM_LIT:0>, dx1, dy1, dz1, dw1)<EOL><DEDENT>dx2 = dx0 - <NUM_LIT:0> - SQUISH_CONSTANT_4D<EOL>dy2 = dy0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL>dz2 = dz1<EOL>dw2 = dw1<EOL>attn2 = <NUM_LIT:2> - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2<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>, wsb + <NUM_LIT:0>, dx2, dy2, dz2, dw2)<EOL><DEDENT>dx3 = dx2<EOL>dy3 = dy1<EOL>dz3 = dz0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL>dw3 = dw1<EOL>attn3 = <NUM_LIT:2> - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3<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>, wsb + <NUM_LIT:0>, dx3, dy3, dz3, dw3)<EOL><DEDENT>dx4 = dx2<EOL>dy4 = dy1<EOL>dz4 = dz1<EOL>dw4 = dw0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL>attn4 = <NUM_LIT:2> - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4<EOL>if attn4 > <NUM_LIT:0>:<EOL><INDENT>attn4 *= attn4<EOL>value += attn4 * attn4 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:0>, wsb + <NUM_LIT:1>, dx4, dy4, dz4, dw4)<EOL><DEDENT><DEDENT>elif in_sum >= <NUM_LIT:3>: <EOL><INDENT>a_po = <NUM_LIT><EOL>a_score = xins<EOL>b_po = <NUM_LIT><EOL>b_score = yins<EOL>if a_score <= b_score and zins < b_score:<EOL><INDENT>b_score = zins<EOL>b_po = <NUM_LIT><EOL><DEDENT>elif a_score > b_score and zins < a_score:<EOL><INDENT>a_score = zins<EOL>a_po = <NUM_LIT><EOL><DEDENT>if a_score <= b_score and wins < b_score:<EOL><INDENT>b_score = wins<EOL>b_po = <NUM_LIT><EOL><DEDENT>elif a_score > b_score and wins < a_score:<EOL><INDENT>a_score = wins<EOL>a_po = <NUM_LIT><EOL><DEDENT>uins = <NUM_LIT:4> - in_sum<EOL>if uins < a_score or uins < b_score: <EOL><INDENT>c = b_po if (b_score < a_score) else a_po <EOL>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>xsv_ext0 = xsb + <NUM_LIT:2><EOL>xsv_ext1 = xsv_ext2 = xsb + <NUM_LIT:1><EOL>dx_ext0 = dx0 - <NUM_LIT:2> - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL>dx_ext1 = dx_ext2 = dx0 - <NUM_LIT:1> - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>xsv_ext0 = xsv_ext1 = xsv_ext2 = xsb<EOL>dx_ext0 = dx_ext1 = dx_ext2 = dx0 - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL><DEDENT>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + <NUM_LIT:1><EOL>dy_ext0 = dy_ext1 = dy_ext2 = dy0 - <NUM_LIT:1> - <NUM_LIT:4> * SQUISH_CONSTANT_4D<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 = ysv_ext2 = ysb<EOL>dy_ext0 = dy_ext1 = dy_ext2 = dy0 - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL><DEDENT>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + <NUM_LIT:1><EOL>dz_ext0 = dz_ext1 = dz_ext2 = dz0 - <NUM_LIT:1> - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL>if (c & <NUM_LIT>) != <NUM_LIT>:<EOL><INDENT>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 += <NUM_LIT:1><EOL>dz_ext0 -= <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>zsv_ext1 += <NUM_LIT:1><EOL>dz_ext1 -= <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>zsv_ext2 += <NUM_LIT:1><EOL>dz_ext2 -= <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb<EOL>dz_ext0 = dz_ext1 = dz_ext2 = dz0 - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL><DEDENT>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>wsv_ext0 = wsv_ext1 = wsb + <NUM_LIT:1><EOL>wsv_ext2 = wsb + <NUM_LIT:2><EOL>dw_ext0 = dw_ext1 = dw0 - <NUM_LIT:1> - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL>dw_ext2 = dw0 - <NUM_LIT:2> - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>wsv_ext0 = wsv_ext1 = wsv_ext2 = wsb<EOL>dw_ext0 = dw_ext1 = dw_ext2 = dw0 - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL><DEDENT><DEDENT>else: <EOL><INDENT>c = (a_po & b_po) <EOL>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>xsv_ext0 = xsv_ext2 = xsb + <NUM_LIT:1><EOL>xsv_ext1 = xsb + <NUM_LIT:2><EOL>dx_ext0 = dx0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dx_ext1 = dx0 - <NUM_LIT:2> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dx_ext2 = dx0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>xsv_ext0 = xsv_ext1 = xsv_ext2 = xsb<EOL>dx_ext0 = dx0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dx_ext1 = dx_ext2 = dx0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + <NUM_LIT:1><EOL>dy_ext0 = dy0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy_ext1 = dy_ext2 = dy0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>ysv_ext2 += <NUM_LIT:1><EOL>dy_ext2 -= <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>ysv_ext1 += <NUM_LIT:1><EOL>dy_ext1 -= <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb<EOL>dy_ext0 = dy0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy_ext1 = dy_ext2 = dy0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + <NUM_LIT:1><EOL>dz_ext0 = dz0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz_ext1 = dz_ext2 = dz0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>zsv_ext2 += <NUM_LIT:1><EOL>dz_ext2 -= <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>zsv_ext1 += <NUM_LIT:1><EOL>dz_ext1 -= <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb<EOL>dz_ext0 = dz0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz_ext1 = dz_ext2 = dz0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>wsv_ext0 = wsv_ext1 = wsb + <NUM_LIT:1><EOL>wsv_ext2 = wsb + <NUM_LIT:2><EOL>dw_ext0 = dw0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw_ext1 = dw0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dw_ext2 = dw0 - <NUM_LIT:2> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>wsv_ext0 = wsv_ext1 = wsv_ext2 = wsb<EOL>dw_ext0 = dw0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw_ext1 = dw_ext2 = dw0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT><DEDENT>dx4 = dx0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dy4 = dy0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dz4 = dz0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dw4 = dw0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>attn4 = <NUM_LIT:2> - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4<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:1>, wsb + <NUM_LIT:0>, dx4, dy4, dz4, dw4)<EOL><DEDENT>dx3 = dx4<EOL>dy3 = dy4<EOL>dz3 = dz0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dw3 = dw0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>attn3 = <NUM_LIT:2> - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3<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>, wsb + <NUM_LIT:1>, dx3, dy3, dz3, dw3)<EOL><DEDENT>dx2 = dx4<EOL>dy2 = dy0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dz2 = dz4<EOL>dw2 = dw3<EOL>attn2 = <NUM_LIT:2> - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2<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>, wsb + <NUM_LIT:1>, dx2, dy2, dz2, dw2)<EOL><DEDENT>dx1 = dx0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dz1 = dz4<EOL>dy1 = dy4<EOL>dw1 = dw3<EOL>attn1 = <NUM_LIT:2> - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1<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>, wsb + <NUM_LIT:1>, dx1, dy1, dz1, dw1)<EOL><DEDENT>dx0 = dx0 - <NUM_LIT:1> - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL>dy0 = dy0 - <NUM_LIT:1> - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL>dz0 = dz0 - <NUM_LIT:1> - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL>dw0 = dw0 - <NUM_LIT:1> - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL>attn0 = <NUM_LIT:2> - dx0 * dx0 - dy0 * dy0 - dz0 * dz0 - dw0 * dw0<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>, wsb + <NUM_LIT:1>, dx0, dy0, dz0, dw0)<EOL><DEDENT><DEDENT>elif in_sum <= <NUM_LIT:2>: <EOL><INDENT>a_is_bigger_side = True<EOL>b_is_bigger_side = True<EOL>if xins + yins > zins + wins:<EOL><INDENT>a_score = xins + yins<EOL>a_po = <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>a_score = zins + wins<EOL>a_po = <NUM_LIT><EOL><DEDENT>if xins + zins > yins + wins:<EOL><INDENT>b_score = xins + zins<EOL>b_po = <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>b_score = yins + wins<EOL>b_po = <NUM_LIT><EOL><DEDENT>if xins + wins > yins + zins:<EOL><INDENT>score = xins + wins<EOL>if a_score >= b_score and score > b_score:<EOL><INDENT>b_score = score<EOL>b_po = <NUM_LIT><EOL><DEDENT>elif a_score < b_score and score > a_score:<EOL><INDENT>a_score = score<EOL>a_po = <NUM_LIT><EOL><DEDENT><DEDENT>else:<EOL><INDENT>score = yins + zins<EOL>if a_score >= b_score and score > b_score:<EOL><INDENT>b_score = score<EOL>b_po = <NUM_LIT><EOL><DEDENT>elif a_score < b_score and score > a_score:<EOL><INDENT>a_score = score<EOL>a_po = <NUM_LIT><EOL><DEDENT><DEDENT>p1 = <NUM_LIT:2> - in_sum + xins<EOL>if a_score >= b_score and p1 > b_score:<EOL><INDENT>b_score = p1<EOL>b_po = <NUM_LIT><EOL>b_is_bigger_side = False<EOL><DEDENT>elif a_score < b_score and p1 > a_score:<EOL><INDENT>a_score = p1<EOL>a_po = <NUM_LIT><EOL>a_is_bigger_side = False<EOL><DEDENT>p2 = <NUM_LIT:2> - in_sum + yins<EOL>if a_score >= b_score and p2 > b_score:<EOL><INDENT>b_score = p2<EOL>b_po = <NUM_LIT><EOL>b_is_bigger_side = False<EOL><DEDENT>elif a_score < b_score and p2 > a_score:<EOL><INDENT>a_score = p2<EOL>a_po = <NUM_LIT><EOL>a_is_bigger_side = False<EOL><DEDENT>p3 = <NUM_LIT:2> - in_sum + zins<EOL>if a_score >= b_score and p3 > b_score:<EOL><INDENT>b_score = p3<EOL>b_po = <NUM_LIT><EOL>b_is_bigger_side = False<EOL><DEDENT>elif a_score < b_score and p3 > a_score:<EOL><INDENT>a_score = p3<EOL>a_po = <NUM_LIT><EOL>a_is_bigger_side = False<EOL><DEDENT>p4 = <NUM_LIT:2> - in_sum + wins<EOL>if a_score >= b_score and p4 > b_score:<EOL><INDENT>b_po = <NUM_LIT><EOL>b_is_bigger_side = False<EOL><DEDENT>elif a_score < b_score and p4 > a_score:<EOL><INDENT>a_po = <NUM_LIT><EOL>a_is_bigger_side = False<EOL><DEDENT>if a_is_bigger_side == b_is_bigger_side:<EOL><INDENT>if a_is_bigger_side: <EOL><INDENT>c1 = (a_po | b_po)<EOL>c2 = (a_po & b_po)<EOL>if (c1 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>xsv_ext0 = xsb<EOL>xsv_ext1 = xsb - <NUM_LIT:1><EOL>dx_ext0 = dx0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dx_ext1 = dx0 + <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>xsv_ext0 = xsv_ext1 = xsb + <NUM_LIT:1><EOL>dx_ext0 = dx0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dx_ext1 = dx0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL><DEDENT>if (c1 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>ysv_ext0 = ysb<EOL>ysv_ext1 = ysb - <NUM_LIT:1><EOL>dy_ext0 = dy0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dy_ext1 = dy0 + <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysb + <NUM_LIT:1><EOL>dy_ext0 = dy0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dy_ext1 = dy0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL><DEDENT>if (c1 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 = zsb<EOL>zsv_ext1 = zsb - <NUM_LIT:1><EOL>dz_ext0 = dz0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dz_ext1 = dz0 + <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsb + <NUM_LIT:1><EOL>dz_ext0 = dz0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dz_ext1 = dz0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL><DEDENT>if (c1 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>wsv_ext0 = wsb<EOL>wsv_ext1 = wsb - <NUM_LIT:1><EOL>dw_ext0 = dw0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dw_ext1 = dw0 + <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>wsv_ext0 = wsv_ext1 = wsb + <NUM_LIT:1><EOL>dw_ext0 = dw0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dw_ext1 = dw0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL><DEDENT>xsv_ext2 = xsb<EOL>ysv_ext2 = ysb<EOL>zsv_ext2 = zsb<EOL>wsv_ext2 = wsb<EOL>dx_ext2 = dx0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy_ext2 = dy0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz_ext2 = dz0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw_ext2 = dw0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>if (c2 & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>xsv_ext2 += <NUM_LIT:2><EOL>dx_ext2 -= <NUM_LIT:2><EOL><DEDENT>elif (c2 & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>ysv_ext2 += <NUM_LIT:2><EOL>dy_ext2 -= <NUM_LIT:2><EOL><DEDENT>elif (c2 & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>zsv_ext2 += <NUM_LIT:2><EOL>dz_ext2 -= <NUM_LIT:2><EOL><DEDENT>else:<EOL><INDENT>wsv_ext2 += <NUM_LIT:2><EOL>dw_ext2 -= <NUM_LIT:2><EOL><DEDENT><DEDENT>else: <EOL><INDENT>xsv_ext2 = xsb<EOL>ysv_ext2 = ysb<EOL>zsv_ext2 = zsb<EOL>wsv_ext2 = wsb<EOL>dx_ext2 = dx0<EOL>dy_ext2 = dy0<EOL>dz_ext2 = dz0<EOL>dw_ext2 = dw0<EOL>c = (a_po | b_po)<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> - SQUISH_CONSTANT_4D<EOL>dx_ext1 = dx0 - SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>xsv_ext0 = xsv_ext1 = xsb + <NUM_LIT:1><EOL>dx_ext0 = dx_ext1 = dx0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL><DEDENT>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysb<EOL>dy_ext0 = dy_ext1 = dy0 - SQUISH_CONSTANT_4D<EOL>if (c & <NUM_LIT>) == <NUM_LIT>:<EOL><INDENT>ysv_ext0 -= <NUM_LIT:1><EOL>dy_ext0 += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>ysv_ext1 -= <NUM_LIT:1><EOL>dy_ext1 += <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> - SQUISH_CONSTANT_4D<EOL><DEDENT>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsb<EOL>dz_ext0 = dz_ext1 = dz0 - SQUISH_CONSTANT_4D<EOL>if (c & <NUM_LIT>) == <NUM_LIT>:<EOL><INDENT>zsv_ext0 -= <NUM_LIT:1><EOL>dz_ext0 += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>zsv_ext1 -= <NUM_LIT:1><EOL>dz_ext1 += <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsb + <NUM_LIT:1><EOL>dz_ext0 = dz_ext1 = dz0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL><DEDENT>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>wsv_ext0 = wsb<EOL>wsv_ext1 = wsb - <NUM_LIT:1><EOL>dw_ext0 = dw0 - SQUISH_CONSTANT_4D<EOL>dw_ext1 = dw0 + <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>wsv_ext0 = wsv_ext1 = wsb + <NUM_LIT:1><EOL>dw_ext0 = dw_ext1 = dw0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL><DEDENT><DEDENT><DEDENT>else: <EOL><INDENT>if a_is_bigger_side:<EOL><INDENT>c1 = a_po<EOL>c2 = b_po<EOL><DEDENT>else:<EOL><INDENT>c1 = b_po<EOL>c2 = a_po<EOL><DEDENT>if (c1 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>xsv_ext0 = xsb - <NUM_LIT:1><EOL>xsv_ext1 = xsb<EOL>dx_ext0 = dx0 + <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL>dx_ext1 = dx0 - SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>xsv_ext0 = xsv_ext1 = xsb + <NUM_LIT:1><EOL>dx_ext0 = dx_ext1 = dx0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL><DEDENT>if (c1 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>ysv_ext0 = ysv_ext1 = ysb<EOL>dy_ext0 = dy_ext1 = dy0 - SQUISH_CONSTANT_4D<EOL>if (c1 & <NUM_LIT>) == <NUM_LIT>:<EOL><INDENT>ysv_ext0 -= <NUM_LIT:1><EOL>dy_ext0 += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>ysv_ext1 -= <NUM_LIT:1><EOL>dy_ext1 += <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> - SQUISH_CONSTANT_4D<EOL><DEDENT>if (c1 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsb<EOL>dz_ext0 = dz_ext1 = dz0 - SQUISH_CONSTANT_4D<EOL>if (c1 & <NUM_LIT>) == <NUM_LIT>:<EOL><INDENT>zsv_ext0 -= <NUM_LIT:1><EOL>dz_ext0 += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>zsv_ext1 -= <NUM_LIT:1><EOL>dz_ext1 += <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsb + <NUM_LIT:1><EOL>dz_ext0 = dz_ext1 = dz0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL><DEDENT>if (c1 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>wsv_ext0 = wsb<EOL>wsv_ext1 = wsb - <NUM_LIT:1><EOL>dw_ext0 = dw0 - SQUISH_CONSTANT_4D<EOL>dw_ext1 = dw0 + <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>wsv_ext0 = wsv_ext1 = wsb + <NUM_LIT:1><EOL>dw_ext0 = dw_ext1 = dw0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL><DEDENT>xsv_ext2 = xsb<EOL>ysv_ext2 = ysb<EOL>zsv_ext2 = zsb<EOL>wsv_ext2 = wsb<EOL>dx_ext2 = dx0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy_ext2 = dy0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz_ext2 = dz0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw_ext2 = dw0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>if (c2 & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>xsv_ext2 += <NUM_LIT:2><EOL>dx_ext2 -= <NUM_LIT:2><EOL><DEDENT>elif (c2 & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>ysv_ext2 += <NUM_LIT:2><EOL>dy_ext2 -= <NUM_LIT:2><EOL><DEDENT>elif (c2 & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>zsv_ext2 += <NUM_LIT:2><EOL>dz_ext2 -= <NUM_LIT:2><EOL><DEDENT>else:<EOL><INDENT>wsv_ext2 += <NUM_LIT:2><EOL>dw_ext2 -= <NUM_LIT:2><EOL><DEDENT><DEDENT>dx1 = dx0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL>dy1 = dy0 - <NUM_LIT:0> - SQUISH_CONSTANT_4D<EOL>dz1 = dz0 - <NUM_LIT:0> - SQUISH_CONSTANT_4D<EOL>dw1 = dw0 - <NUM_LIT:0> - SQUISH_CONSTANT_4D<EOL>attn1 = <NUM_LIT:2> - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1<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>, wsb + <NUM_LIT:0>, dx1, dy1, dz1, dw1)<EOL><DEDENT>dx2 = dx0 - <NUM_LIT:0> - SQUISH_CONSTANT_4D<EOL>dy2 = dy0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL>dz2 = dz1<EOL>dw2 = dw1<EOL>attn2 = <NUM_LIT:2> - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2<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>, wsb + <NUM_LIT:0>, dx2, dy2, dz2, dw2)<EOL><DEDENT>dx3 = dx2<EOL>dy3 = dy1<EOL>dz3 = dz0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL>dw3 = dw1<EOL>attn3 = <NUM_LIT:2> - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3<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>, wsb + <NUM_LIT:0>, dx3, dy3, dz3, dw3)<EOL><DEDENT>dx4 = dx2<EOL>dy4 = dy1<EOL>dz4 = dz1<EOL>dw4 = dw0 - <NUM_LIT:1> - SQUISH_CONSTANT_4D<EOL>attn4 = <NUM_LIT:2> - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4<EOL>if attn4 > <NUM_LIT:0>:<EOL><INDENT>attn4 *= attn4<EOL>value += attn4 * attn4 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:0>, wsb + <NUM_LIT:1>, dx4, dy4, dz4, dw4)<EOL><DEDENT>dx5 = dx0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy5 = dy0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz5 = dz0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw5 = dw0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>attn5 = <NUM_LIT:2> - dx5 * dx5 - dy5 * dy5 - dz5 * dz5 - dw5 * dw5<EOL>if attn5 > <NUM_LIT:0>:<EOL><INDENT>attn5 *= attn5<EOL>value += attn5 * attn5 * extrapolate(xsb + <NUM_LIT:1>, ysb + <NUM_LIT:1>, zsb + <NUM_LIT:0>, wsb + <NUM_LIT:0>, dx5, dy5, dz5, dw5)<EOL><DEDENT>dx6 = dx0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy6 = dy0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz6 = dz0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw6 = dw0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>attn6 = <NUM_LIT:2> - dx6 * dx6 - dy6 * dy6 - dz6 * dz6 - dw6 * dw6<EOL>if attn6 > <NUM_LIT:0>:<EOL><INDENT>attn6 *= attn6<EOL>value += attn6 * attn6 * extrapolate(xsb + <NUM_LIT:1>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:1>, wsb + <NUM_LIT:0>, dx6, dy6, dz6, dw6)<EOL><DEDENT>dx7 = dx0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy7 = dy0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz7 = dz0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw7 = dw0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>attn7 = <NUM_LIT:2> - dx7 * dx7 - dy7 * dy7 - dz7 * dz7 - dw7 * dw7<EOL>if attn7 > <NUM_LIT:0>:<EOL><INDENT>attn7 *= attn7<EOL>value += attn7 * attn7 * extrapolate(xsb + <NUM_LIT:1>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:0>, wsb + <NUM_LIT:1>, dx7, dy7, dz7, dw7)<EOL><DEDENT>dx8 = dx0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy8 = dy0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz8 = dz0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw8 = dw0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>attn8 = <NUM_LIT:2> - dx8 * dx8 - dy8 * dy8 - dz8 * dz8 - dw8 * dw8<EOL>if attn8 > <NUM_LIT:0>:<EOL><INDENT>attn8 *= attn8<EOL>value += attn8 * attn8 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:1>, zsb + <NUM_LIT:1>, wsb + <NUM_LIT:0>, dx8, dy8, dz8, dw8)<EOL><DEDENT>dx9 = dx0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy9 = dy0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz9 = dz0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw9 = dw0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>attn9 = <NUM_LIT:2> - dx9 * dx9 - dy9 * dy9 - dz9 * dz9 - dw9 * dw9<EOL>if attn9 > <NUM_LIT:0>:<EOL><INDENT>attn9 *= attn9<EOL>value += attn9 * attn9 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:1>, zsb + <NUM_LIT:0>, wsb + <NUM_LIT:1>, dx9, dy9, dz9, dw9)<EOL><DEDENT>dx10 = dx0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy10 = dy0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz10 = dz0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw10 = dw0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>attn10 = <NUM_LIT:2> - dx10 * dx10 - dy10 * dy10 - dz10 * dz10 - dw10 * dw10<EOL>if attn10 > <NUM_LIT:0>:<EOL><INDENT>attn10 *= attn10<EOL>value += attn10 * attn10 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:1>, wsb + <NUM_LIT:1>, dx10, dy10, dz10, dw10)<EOL><DEDENT><DEDENT>else: <EOL><INDENT>a_is_bigger_side = True<EOL>b_is_bigger_side = True<EOL>if xins + yins < zins + wins:<EOL><INDENT>a_score = xins + yins<EOL>a_po = <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>a_score = zins + wins<EOL>a_po = <NUM_LIT><EOL><DEDENT>if xins + zins < yins + wins:<EOL><INDENT>b_score = xins + zins<EOL>b_po = <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>b_score = yins + wins<EOL>b_po = <NUM_LIT><EOL><DEDENT>if xins + wins < yins + zins:<EOL><INDENT>score = xins + wins<EOL>if a_score <= b_score and score < b_score:<EOL><INDENT>b_score = score<EOL>b_po = <NUM_LIT><EOL><DEDENT>elif a_score > b_score and score < a_score:<EOL><INDENT>a_score = score<EOL>a_po = <NUM_LIT><EOL><DEDENT><DEDENT>else:<EOL><INDENT>score = yins + zins<EOL>if a_score <= b_score and score < b_score:<EOL><INDENT>b_score = score<EOL>b_po = <NUM_LIT><EOL><DEDENT>elif a_score > b_score and score < a_score:<EOL><INDENT>a_score = score<EOL>a_po = <NUM_LIT><EOL><DEDENT><DEDENT>p1 = <NUM_LIT:3> - in_sum + xins<EOL>if a_score <= b_score and p1 < b_score:<EOL><INDENT>b_score = p1<EOL>b_po = <NUM_LIT><EOL>b_is_bigger_side = False<EOL><DEDENT>elif a_score > b_score and p1 < a_score:<EOL><INDENT>a_score = p1<EOL>a_po = <NUM_LIT><EOL>a_is_bigger_side = False<EOL><DEDENT>p2 = <NUM_LIT:3> - in_sum + yins<EOL>if a_score <= b_score and p2 < b_score:<EOL><INDENT>b_score = p2<EOL>b_po = <NUM_LIT><EOL>b_is_bigger_side = False<EOL><DEDENT>elif a_score > b_score and p2 < a_score:<EOL><INDENT>a_score = p2<EOL>a_po = <NUM_LIT><EOL>a_is_bigger_side = False<EOL><DEDENT>p3 = <NUM_LIT:3> - in_sum + zins<EOL>if a_score <= b_score and p3 < b_score:<EOL><INDENT>b_score = p3<EOL>b_po = <NUM_LIT><EOL>b_is_bigger_side = False<EOL><DEDENT>elif a_score > b_score and p3 < a_score:<EOL><INDENT>a_score = p3<EOL>a_po = <NUM_LIT><EOL>a_is_bigger_side = False<EOL><DEDENT>p4 = <NUM_LIT:3> - in_sum + wins<EOL>if a_score <= b_score and p4 < b_score:<EOL><INDENT>b_po = <NUM_LIT><EOL>b_is_bigger_side = False<EOL><DEDENT>elif a_score > b_score and p4 < a_score:<EOL><INDENT>a_po = <NUM_LIT><EOL>a_is_bigger_side = False<EOL><DEDENT>if a_is_bigger_side == b_is_bigger_side:<EOL><INDENT>if a_is_bigger_side: <EOL><INDENT>c1 = (a_po & b_po)<EOL>c2 = (a_po | b_po)<EOL>xsv_ext0 = xsv_ext1 = xsb<EOL>ysv_ext0 = ysv_ext1 = ysb<EOL>zsv_ext0 = zsv_ext1 = zsb<EOL>wsv_ext0 = wsv_ext1 = wsb<EOL>dx_ext0 = dx0 - SQUISH_CONSTANT_4D<EOL>dy_ext0 = dy0 - SQUISH_CONSTANT_4D<EOL>dz_ext0 = dz0 - SQUISH_CONSTANT_4D<EOL>dw_ext0 = dw0 - SQUISH_CONSTANT_4D<EOL>dx_ext1 = dx0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy_ext1 = dy0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz_ext1 = dz0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw_ext1 = dw0 - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>if (c1 & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>xsv_ext0 += <NUM_LIT:1><EOL>dx_ext0 -= <NUM_LIT:1><EOL>xsv_ext1 += <NUM_LIT:2><EOL>dx_ext1 -= <NUM_LIT:2><EOL><DEDENT>elif (c1 & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>ysv_ext0 += <NUM_LIT:1><EOL>dy_ext0 -= <NUM_LIT:1><EOL>ysv_ext1 += <NUM_LIT:2><EOL>dy_ext1 -= <NUM_LIT:2><EOL><DEDENT>elif (c1 & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 += <NUM_LIT:1><EOL>dz_ext0 -= <NUM_LIT:1><EOL>zsv_ext1 += <NUM_LIT:2><EOL>dz_ext1 -= <NUM_LIT:2><EOL><DEDENT>else:<EOL><INDENT>wsv_ext0 += <NUM_LIT:1><EOL>dw_ext0 -= <NUM_LIT:1><EOL>wsv_ext1 += <NUM_LIT:2><EOL>dw_ext1 -= <NUM_LIT:2><EOL><DEDENT>xsv_ext2 = xsb + <NUM_LIT:1><EOL>ysv_ext2 = ysb + <NUM_LIT:1><EOL>zsv_ext2 = zsb + <NUM_LIT:1><EOL>wsv_ext2 = wsb + <NUM_LIT:1><EOL>dx_ext2 = dx0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy_ext2 = dy0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz_ext2 = dz0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw_ext2 = dw0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>if (c2 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>xsv_ext2 -= <NUM_LIT:2><EOL>dx_ext2 += <NUM_LIT:2><EOL><DEDENT>elif (c2 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>ysv_ext2 -= <NUM_LIT:2><EOL>dy_ext2 += <NUM_LIT:2><EOL><DEDENT>elif (c2 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>zsv_ext2 -= <NUM_LIT:2><EOL>dz_ext2 += <NUM_LIT:2><EOL><DEDENT>else:<EOL><INDENT>wsv_ext2 -= <NUM_LIT:2><EOL>dw_ext2 += <NUM_LIT:2><EOL><DEDENT><DEDENT>else: <EOL><INDENT>xsv_ext2 = xsb + <NUM_LIT:1><EOL>ysv_ext2 = ysb + <NUM_LIT:1><EOL>zsv_ext2 = zsb + <NUM_LIT:1><EOL>wsv_ext2 = wsb + <NUM_LIT:1><EOL>dx_ext2 = dx0 - <NUM_LIT:1> - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL>dy_ext2 = dy0 - <NUM_LIT:1> - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL>dz_ext2 = dz0 - <NUM_LIT:1> - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL>dw_ext2 = dw0 - <NUM_LIT:1> - <NUM_LIT:4> * SQUISH_CONSTANT_4D<EOL>c = (a_po & b_po)<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_4D<EOL>dx_ext1 = dx0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>xsv_ext0 = xsv_ext1 = xsb<EOL>dx_ext0 = dx_ext1 = dx0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<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_4D<EOL>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>ysv_ext0 += <NUM_LIT:1><EOL>dy_ext0 -= <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>ysv_ext1 += <NUM_LIT:1><EOL>dy_ext1 -= <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_4D<EOL><DEDENT>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsb + <NUM_LIT:1><EOL>dz_ext0 = dz_ext1 = dz0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>if (c & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 += <NUM_LIT:1><EOL>dz_ext0 -= <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>zsv_ext1 += <NUM_LIT:1><EOL>dz_ext1 -= <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsb<EOL>dz_ext0 = dz_ext1 = dz0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT>if (c & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>wsv_ext0 = wsb + <NUM_LIT:1><EOL>wsv_ext1 = wsb + <NUM_LIT:2><EOL>dw_ext0 = dw0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dw_ext1 = dw0 - <NUM_LIT:2> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>wsv_ext0 = wsv_ext1 = wsb<EOL>dw_ext0 = dw_ext1 = dw0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT><DEDENT><DEDENT>else: <EOL><INDENT>if a_is_bigger_side:<EOL><INDENT>c1 = a_po<EOL>c2 = b_po<EOL><DEDENT>else:<EOL><INDENT>c1 = b_po<EOL>c2 = a_po<EOL><DEDENT>if (c1 & <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_4D<EOL>dx_ext1 = dx0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>xsv_ext0 = xsv_ext1 = xsb<EOL>dx_ext0 = dx_ext1 = dx0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT>if (c1 & <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_4D<EOL>if (c1 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>ysv_ext0 += <NUM_LIT:1><EOL>dy_ext0 -= <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>ysv_ext1 += <NUM_LIT:1><EOL>dy_ext1 -= <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_4D<EOL><DEDENT>if (c1 & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsb + <NUM_LIT:1><EOL>dz_ext0 = dz_ext1 = dz0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>if (c1 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>zsv_ext0 += <NUM_LIT:1><EOL>dz_ext0 -= <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>zsv_ext1 += <NUM_LIT:1><EOL>dz_ext1 -= <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>zsv_ext0 = zsv_ext1 = zsb<EOL>dz_ext0 = dz_ext1 = dz0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT>if (c1 & <NUM_LIT>) != <NUM_LIT:0>:<EOL><INDENT>wsv_ext0 = wsb + <NUM_LIT:1><EOL>wsv_ext1 = wsb + <NUM_LIT:2><EOL>dw_ext0 = dw0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dw_ext1 = dw0 - <NUM_LIT:2> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT>else:<EOL><INDENT>wsv_ext0 = wsv_ext1 = wsb<EOL>dw_ext0 = dw_ext1 = dw0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL><DEDENT>xsv_ext2 = xsb + <NUM_LIT:1><EOL>ysv_ext2 = ysb + <NUM_LIT:1><EOL>zsv_ext2 = zsb + <NUM_LIT:1><EOL>wsv_ext2 = wsb + <NUM_LIT:1><EOL>dx_ext2 = dx0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy_ext2 = dy0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz_ext2 = dz0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw_ext2 = dw0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>if (c2 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>xsv_ext2 -= <NUM_LIT:2><EOL>dx_ext2 += <NUM_LIT:2><EOL><DEDENT>elif (c2 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>ysv_ext2 -= <NUM_LIT:2><EOL>dy_ext2 += <NUM_LIT:2><EOL><DEDENT>elif (c2 & <NUM_LIT>) == <NUM_LIT:0>:<EOL><INDENT>zsv_ext2 -= <NUM_LIT:2><EOL>dz_ext2 += <NUM_LIT:2><EOL><DEDENT>else:<EOL><INDENT>wsv_ext2 -= <NUM_LIT:2><EOL>dw_ext2 += <NUM_LIT:2><EOL><DEDENT><DEDENT>dx4 = dx0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dy4 = dy0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dz4 = dz0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dw4 = dw0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>attn4 = <NUM_LIT:2> - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4<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:1>, wsb + <NUM_LIT:0>, dx4, dy4, dz4, dw4)<EOL><DEDENT>dx3 = dx4<EOL>dy3 = dy4<EOL>dz3 = dz0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dw3 = dw0 - <NUM_LIT:1> - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>attn3 = <NUM_LIT:2> - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3<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>, wsb + <NUM_LIT:1>, dx3, dy3, dz3, dw3)<EOL><DEDENT>dx2 = dx4<EOL>dy2 = dy0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dz2 = dz4<EOL>dw2 = dw3<EOL>attn2 = <NUM_LIT:2> - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2<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>, wsb + <NUM_LIT:1>, dx2, dy2, dz2, dw2)<EOL><DEDENT>dx1 = dx0 - <NUM_LIT:3> * SQUISH_CONSTANT_4D<EOL>dz1 = dz4<EOL>dy1 = dy4<EOL>dw1 = dw3<EOL>attn1 = <NUM_LIT:2> - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1<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>, wsb + <NUM_LIT:1>, dx1, dy1, dz1, dw1)<EOL><DEDENT>dx5 = dx0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy5 = dy0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz5 = dz0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw5 = dw0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>attn5 = <NUM_LIT:2> - dx5 * dx5 - dy5 * dy5 - dz5 * dz5 - dw5 * dw5<EOL>if attn5 > <NUM_LIT:0>:<EOL><INDENT>attn5 *= attn5<EOL>value += attn5 * attn5 * extrapolate(xsb + <NUM_LIT:1>, ysb + <NUM_LIT:1>, zsb + <NUM_LIT:0>, wsb + <NUM_LIT:0>, dx5, dy5, dz5, dw5)<EOL><DEDENT>dx6 = dx0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy6 = dy0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz6 = dz0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw6 = dw0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>attn6 = <NUM_LIT:2> - dx6 * dx6 - dy6 * dy6 - dz6 * dz6 - dw6 * dw6<EOL>if attn6 > <NUM_LIT:0>:<EOL><INDENT>attn6 *= attn6<EOL>value += attn6 * attn6 * extrapolate(xsb + <NUM_LIT:1>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:1>, wsb + <NUM_LIT:0>, dx6, dy6, dz6, dw6)<EOL><DEDENT>dx7 = dx0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy7 = dy0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz7 = dz0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw7 = dw0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>attn7 = <NUM_LIT:2> - dx7 * dx7 - dy7 * dy7 - dz7 * dz7 - dw7 * dw7<EOL>if attn7 > <NUM_LIT:0>:<EOL><INDENT>attn7 *= attn7<EOL>value += attn7 * attn7 * extrapolate(xsb + <NUM_LIT:1>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:0>, wsb + <NUM_LIT:1>, dx7, dy7, dz7, dw7)<EOL><DEDENT>dx8 = dx0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy8 = dy0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz8 = dz0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw8 = dw0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>attn8 = <NUM_LIT:2> - dx8 * dx8 - dy8 * dy8 - dz8 * dz8 - dw8 * dw8<EOL>if attn8 > <NUM_LIT:0>:<EOL><INDENT>attn8 *= attn8<EOL>value += attn8 * attn8 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:1>, zsb + <NUM_LIT:1>, wsb + <NUM_LIT:0>, dx8, dy8, dz8, dw8)<EOL><DEDENT>dx9 = dx0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy9 = dy0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz9 = dz0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw9 = dw0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>attn9 = <NUM_LIT:2> - dx9 * dx9 - dy9 * dy9 - dz9 * dz9 - dw9 * dw9<EOL>if attn9 > <NUM_LIT:0>:<EOL><INDENT>attn9 *= attn9<EOL>value += attn9 * attn9 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:1>, zsb + <NUM_LIT:0>, wsb + <NUM_LIT:1>, dx9, dy9, dz9, dw9)<EOL><DEDENT>dx10 = dx0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dy10 = dy0 - <NUM_LIT:0> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dz10 = dz0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>dw10 = dw0 - <NUM_LIT:1> - <NUM_LIT:2> * SQUISH_CONSTANT_4D<EOL>attn10 = <NUM_LIT:2> - dx10 * dx10 - dy10 * dy10 - dz10 * dz10 - dw10 * dw10<EOL>if attn10 > <NUM_LIT:0>:<EOL><INDENT>attn10 *= attn10<EOL>value += attn10 * attn10 * extrapolate(xsb + <NUM_LIT:0>, ysb + <NUM_LIT:0>, zsb + <NUM_LIT:1>, wsb + <NUM_LIT:1>, dx10, dy10, dz10, dw10)<EOL><DEDENT><DEDENT>attn_ext0 = <NUM_LIT:2> - dx_ext0 * dx_ext0 - dy_ext0 * dy_ext0 - dz_ext0 * dz_ext0 - dw_ext0 * dw_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, wsv_ext0, dx_ext0, dy_ext0, dz_ext0, dw_ext0)<EOL><DEDENT>attn_ext1 = <NUM_LIT:2> - dx_ext1 * dx_ext1 - dy_ext1 * dy_ext1 - dz_ext1 * dz_ext1 - dw_ext1 * dw_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, wsv_ext1, dx_ext1, dy_ext1, dz_ext1, dw_ext1)<EOL><DEDENT>attn_ext2 = <NUM_LIT:2> - dx_ext2 * dx_ext2 - dy_ext2 * dy_ext2 - dz_ext2 * dz_ext2 - dw_ext2 * dw_ext2<EOL>if attn_ext2 > <NUM_LIT:0>:<EOL><INDENT>attn_ext2 *= attn_ext2<EOL>value += attn_ext2 * attn_ext2 * extrapolate(xsv_ext2, ysv_ext2, zsv_ext2, wsv_ext2, dx_ext2, dy_ext2, dz_ext2, dw_ext2)<EOL><DEDENT>return value / NORM_CONSTANT_4D<EOL>

Generate 4D OpenSimplex noise from X,Y,Z,W coordinates.


def iter_items(self,  start_key=None, end_key=None, reverse=False):

<EOL>if self.is_empty():<EOL><INDENT>return []<EOL><DEDENT>if reverse:<EOL><INDENT>return self._iter_items_backward(start_key, end_key)<EOL><DEDENT>else:<EOL><INDENT>return self._iter_items_forward(start_key, end_key)<EOL><DEDENT>

Iterates over the (key, value) items of the associated tree,
        in ascending order if reverse is True, iterate in descending order,
        reverse defaults to False


try:<EOL><INDENT>self.get_value(key)<EOL>return True<EOL><DEDENT>except KeyError:<EOL><INDENT>return False<EOL><DEDENT>

k in T -> True if T has a key k, else False


item = self.max_item()<EOL>self.remove(item[<NUM_LIT:0>])<EOL>return item<EOL>

T.pop_max() -> (k, v), remove item with maximum key, raise ValueError
        if T is empty.


def key_slice(self, start_key, end_key, reverse=False):

return (k for k, v in self.iter_items(start_key, end_key, reverse=reverse))<EOL>

T.key_slice(start_key, end_key) -> key iterator:
        start_key <= key < end_key.

        Yields keys in ascending order if reverse is False else in descending order.


def succ_item(self, key, default=_sentinel):

<EOL>node = self._root<EOL>succ_node = None<EOL>while node is not None:<EOL><INDENT>cmp = self._cmp(self._cmp_data, key, node.key)<EOL>if cmp == <NUM_LIT:0>:<EOL><INDENT>break<EOL><DEDENT>elif cmp < <NUM_LIT:0>:<EOL><INDENT>if (succ_node is None) or self._cmp(self._cmp_data, node.key, succ_node.key) < <NUM_LIT:0>:<EOL><INDENT>succ_node = node<EOL><DEDENT>node = node.left<EOL><DEDENT>else:<EOL><INDENT>node = node.right<EOL><DEDENT><DEDENT>if node is None:  <EOL><INDENT>if default is _sentinel:<EOL><INDENT>raise KeyError(str(key))<EOL><DEDENT>return default<EOL><DEDENT>if node.right is not None:<EOL><INDENT>node = node.right<EOL>while node.left is not None:<EOL><INDENT>node = node.left<EOL><DEDENT>if succ_node is None:<EOL><INDENT>succ_node = node<EOL><DEDENT>elif self._cmp(self._cmp_data, node.key, succ_node.key) < <NUM_LIT:0>:<EOL><INDENT>succ_node = node<EOL><DEDENT><DEDENT>elif succ_node is None:  <EOL><INDENT>if default is _sentinel:<EOL><INDENT>raise KeyError(str(key))<EOL><DEDENT>return default<EOL><DEDENT>return succ_node.key, succ_node.value<EOL>

Get successor (k,v) pair of key, raises KeyError if key is max key
        or key does not exist. optimized for pypy.


if self._root is None:<EOL><INDENT>raise KeyError(str(key))<EOL><DEDENT>head = Node()  <EOL>node = head<EOL>node.right = self._root<EOL>parent = None<EOL>grand_parent = None<EOL>found = None  <EOL>direction = <NUM_LIT:1><EOL>while node[direction] is not None:<EOL><INDENT>last = direction<EOL>grand_parent = parent<EOL>parent = node<EOL>node = node[direction]<EOL>direction = <NUM_LIT:1> if (self._cmp(self._cmp_data, node.key, key) < <NUM_LIT:0>) else <NUM_LIT:0><EOL>if self._cmp(self._cmp_data, key, node.key) == <NUM_LIT:0>:<EOL><INDENT>found = node<EOL><DEDENT>if not RBTree.is_red(node) and not RBTree.is_red(node[direction]):<EOL><INDENT>if RBTree.is_red(node[<NUM_LIT:1> - direction]):<EOL><INDENT>parent[last] = RBTree.jsw_single(node, direction)<EOL>parent = parent[last]<EOL><DEDENT>elif not RBTree.is_red(node[<NUM_LIT:1> - direction]):<EOL><INDENT>sibling = parent[<NUM_LIT:1> - last]<EOL>if sibling is not None:<EOL><INDENT>if (not RBTree.is_red(sibling[<NUM_LIT:1> - last])) and (not RBTree.is_red(sibling[last])):<EOL><INDENT>parent.red = False<EOL>sibling.red = True<EOL>node.red = True<EOL><DEDENT>else:<EOL><INDENT>direction2 = <NUM_LIT:1> if grand_parent.right is parent else <NUM_LIT:0><EOL>if RBTree.is_red(sibling[last]):<EOL><INDENT>grand_parent[direction2] = RBTree.jsw_double(parent, last)<EOL><DEDENT>elif RBTree.is_red(sibling[<NUM_LIT:1>-last]):<EOL><INDENT>grand_parent[direction2] = RBTree.jsw_single(parent, last)<EOL><DEDENT>grand_parent[direction2].red = True<EOL>node.red = True<EOL>grand_parent[direction2].left.red = False<EOL>grand_parent[direction2].right.red = False<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>if found is not None:<EOL><INDENT>found.key = node.key<EOL>found.value = node.value<EOL>parent[int(parent.right is node)] = node[int(node.left is None)]<EOL>node.free()<EOL>self._count -= <NUM_LIT:1><EOL><DEDENT>self._root = head.right<EOL>if self._root is not None:<EOL><INDENT>self._root.red = False<EOL><DEDENT>if not found:<EOL><INDENT>raise KeyError(str(key))<EOL><DEDENT>

T.remove(key) <==> del T[key], remove item <key> from tree.


def _clear(node):<EOL><INDENT>if node is not None:<EOL><INDENT>_clear(node.left)<EOL>_clear(node.right)<EOL>node.free()<EOL><DEDENT><DEDENT>_clear(self._root)<EOL>self._count = <NUM_LIT:0><EOL>self._root = None<EOL>

T.clear() -> None.  Remove all items from T.


assert(len(self.events_scan) != <NUM_LIT:0>)<EOL>p, events_current = self.events_scan.pop_min()<EOL>return p, events_current<EOL>

Get, and remove, the first (lowest) item from this queue.

:return: the first (lowest) item from this queue.
:rtype: Point, Event pair.


def prev_item(self, key, default=_sentinel):

<EOL>node = self._root<EOL>prev_node = None<EOL>while node is not None:<EOL><INDENT>cmp = self._cmp(self._cmp_data, key, node.key)<EOL>if cmp == <NUM_LIT:0>:<EOL><INDENT>break<EOL><DEDENT>elif cmp < <NUM_LIT:0>:<EOL><INDENT>node = node.left<EOL><DEDENT>else:<EOL><INDENT>if (prev_node is None) or self._cmp(self._cmp_data, prev_node.key, node.key) < <NUM_LIT:0>:<EOL><INDENT>prev_node = node<EOL><DEDENT>node = node.right<EOL><DEDENT><DEDENT>if node is None:  <EOL><INDENT>if default is _sentinel:<EOL><INDENT>raise KeyError(str(key))<EOL><DEDENT>return default<EOL><DEDENT>if node.left is not None:<EOL><INDENT>node = node.left<EOL>while node.right is not None:<EOL><INDENT>node = node.right<EOL><DEDENT>if prev_node is None:<EOL><INDENT>prev_node = node<EOL><DEDENT>elif self._cmp(self._cmp_data, prev_node.key, node.key) < <NUM_LIT:0>:<EOL><INDENT>prev_node = node<EOL><DEDENT><DEDENT>elif prev_node is None:  <EOL><INDENT>if default is _sentinel:<EOL><INDENT>raise KeyError(str(key))<EOL><DEDENT>return default<EOL><DEDENT>return prev_node.key, prev_node.value<EOL>

Get predecessor (k,v) pair of key, raises KeyError if key is min key
        or key does not exist. optimized for pypy.


if self.is_empty():<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>node = self._root<EOL>while node.right is not None:<EOL><INDENT>node = node.right<EOL><DEDENT>return node.key, node.value<EOL>

Get item with max key of tree, raises ValueError if tree is empty.


def __init__(self, items=None, cmp=None, cmp_data=None):

self._root = None<EOL>self._count = <NUM_LIT:0><EOL>if cmp is None:<EOL><INDENT>def cmp(cmp_data, a, b):<EOL><INDENT>if a < b:<EOL><INDENT>return -<NUM_LIT:1><EOL><DEDENT>elif a > b:<EOL><INDENT>return <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT><DEDENT><DEDENT>self._cmp = cmp<EOL>self._cmp_data = cmp_data<EOL>if items is not None:<EOL><INDENT>self.update(items)<EOL><DEDENT>

T.__init__(...) initializes T; see T.__class__.__doc__ for signature


return self.count == <NUM_LIT:0><EOL>

T.is_empty() -> False if T contains any items else True


return self.count<EOL>


if Real is float:<EOL><INDENT>return [<EOL>(p, [event.segment for event in event_set])<EOL>for p, event_set in self.intersections.items()<EOL>]<EOL><DEDENT>else:<EOL><INDENT>return [<EOL>(<EOL>(float(p[<NUM_LIT:0>]), float(p[<NUM_LIT:1>])),<EOL>[((float(event.segment[<NUM_LIT:0>][<NUM_LIT:0>]), float(event.segment[<NUM_LIT:0>][<NUM_LIT:1>])),<EOL>(float(event.segment[<NUM_LIT:1>][<NUM_LIT:0>]), float(event.segment[<NUM_LIT:1>][<NUM_LIT:1>])))<EOL>for event in event_set],<EOL>)<EOL>for p, event_set in self.intersections.items()<EOL>]<EOL><DEDENT>

Return a list of unordered intersection '(point, segment)' pairs,
where segments may contain 2 or more values.


def set_default(self, key, default=None):

try:<EOL><INDENT>return self.get_value(key)<EOL><DEDENT>except KeyError:<EOL><INDENT>self.insert(key, default)<EOL>return default<EOL><DEDENT>

T.set_default(k[,d]) -> T.get(k,d), also set T[k]=d if k not in T


return self._count<EOL>


def isect_polygon__naive(points) -> list:

isect = []<EOL>n = len(points)<EOL>if Real is float:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>points = [(Real(p[<NUM_LIT:0>]), Real(p[<NUM_LIT:1>])) for p in points]<EOL><DEDENT>for i in range(n):<EOL><INDENT>a0, a1 = points[i], points[(i + <NUM_LIT:1>) % n]<EOL>for j in range(i + <NUM_LIT:1>, n):<EOL><INDENT>b0, b1 = points[j], points[(j + <NUM_LIT:1>) % n]<EOL>if a0 not in (b0, b1) and a1 not in (b0, b1):<EOL><INDENT>ix = isect_seg_seg_v2_point(a0, a1, b0, b1)<EOL>if ix is not None:<EOL><INDENT>if USE_IGNORE_SEGMENT_ENDINGS:<EOL><INDENT>if ((len_squared_v2v2(ix, a0) < NUM_EPS_SQ or<EOL>len_squared_v2v2(ix, a1) < NUM_EPS_SQ) and<EOL>(len_squared_v2v2(ix, b0) < NUM_EPS_SQ or<EOL>len_squared_v2v2(ix, b1) < NUM_EPS_SQ)):<EOL><INDENT>continue<EOL><DEDENT><DEDENT>isect.append(ix)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return isect<EOL>

Brute force O(n2) version of ``isect_polygon`` for test validation.


def compute_line_intersection_point(x1, y1, x2, y2, x3, y3, x4, y4):

def _make_line(p1, p2):<EOL><INDENT>A = (p1[<NUM_LIT:1>] - p2[<NUM_LIT:1>])<EOL>B = (p2[<NUM_LIT:0>] - p1[<NUM_LIT:0>])<EOL>C = (p1[<NUM_LIT:0>]*p2[<NUM_LIT:1>] - p2[<NUM_LIT:0>]*p1[<NUM_LIT:1>])<EOL>return A, B, -C<EOL><DEDENT>L1 = _make_line((x1, y1), (x2, y2))<EOL>L2 = _make_line((x3, y3), (x4, y4))<EOL>D = L1[<NUM_LIT:0>] * L2[<NUM_LIT:1>] - L1[<NUM_LIT:1>] * L2[<NUM_LIT:0>]<EOL>Dx = L1[<NUM_LIT:2>] * L2[<NUM_LIT:1>] - L1[<NUM_LIT:1>] * L2[<NUM_LIT:2>]<EOL>Dy = L1[<NUM_LIT:0>] * L2[<NUM_LIT:2>] - L1[<NUM_LIT:2>] * L2[<NUM_LIT:0>]<EOL>if D != <NUM_LIT:0>:<EOL><INDENT>x = Dx / D<EOL>y = Dy / D<EOL>return x, y<EOL><DEDENT>else:<EOL><INDENT>return False<EOL><DEDENT>

Compute the intersection point of two lines.

Taken from https://stackoverflow.com/a/20679579 .

Parameters
----------
x1 : number
    x coordinate of the first point on line 1. (The lines extends beyond this point.)

y1 : number
    y coordinate of the first point on line 1. (The lines extends beyond this point.)

x2 : number
    x coordinate of the second point on line 1. (The lines extends beyond this point.)

y2 : number
    y coordinate of the second point on line 1. (The lines extends beyond this point.)

x3 : number
    x coordinate of the first point on line 2. (The lines extends beyond this point.)

y3 : number
    y coordinate of the first point on line 2. (The lines extends beyond this point.)

x4 : number
    x coordinate of the second point on line 2. (The lines extends beyond this point.)

y4 : number
    y coordinate of the second point on line 2. (The lines extends beyond this point.)

Returns
-------
tuple of number or bool
    The coordinate of the intersection point as a tuple ``(x, y)``.
    If the lines are parallel (no intersection point or an infinite number of them), the result is False.


<EOL>from imgaug.augmentables.bbs import BoundingBox, BoundingBoxesOnImage<EOL>if extract == "<STR_LIT>":<EOL><INDENT>bb = BoundingBox(x1=<NUM_LIT:0>, y1=<NUM_LIT:0>, x2=<NUM_LIT>, y2=<NUM_LIT>)<EOL><DEDENT>elif isinstance(extract, tuple) and len(extract) == <NUM_LIT:4>:<EOL><INDENT>bb = BoundingBox(x1=extract[<NUM_LIT:0>], y1=extract[<NUM_LIT:1>], x2=extract[<NUM_LIT:2>], y2=extract[<NUM_LIT:3>])<EOL><DEDENT>elif isinstance(extract, BoundingBox):<EOL><INDENT>bb = extract<EOL><DEDENT>elif isinstance(extract, BoundingBoxesOnImage):<EOL><INDENT>do_assert(len(extract.bounding_boxes) == <NUM_LIT:1>)<EOL>do_assert(extract.shape[<NUM_LIT:0>:<NUM_LIT:2>] == (<NUM_LIT>, <NUM_LIT>))<EOL>bb = extract.bounding_boxes[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>"<EOL>+ "<STR_LIT>" % (type(extract),)<EOL>)<EOL><DEDENT>return bb<EOL>

Generate a normalized rectangle to be extract from the standard quokka image.

Parameters
----------
extract : 'square' or tuple of number or imgaug.BoundingBox or imgaug.BoundingBoxesOnImage
    Unnormalized representation of the image subarea to be extracted.

        * If string ``square``, then a squared area ``(x: 0 to max 643, y: 0 to max 643)``
          will be extracted from the image.
        * If a tuple, then expected to contain four numbers denoting ``x1``, ``y1``, ``x2``
          and ``y2``.
        * If a BoundingBox, then that bounding box's area will be extracted from the image.
        * If a BoundingBoxesOnImage, then expected to contain exactly one bounding box
          and a shape matching the full image dimensions (i.e. (643, 960, *)). Then the
          one bounding box will be used similar to BoundingBox.

Returns
-------
bb : imgaug.BoundingBox
    Normalized representation of the area to extract from the standard quokka image.


return derive_random_states(random_state, n=<NUM_LIT:1>)[<NUM_LIT:0>]<EOL>

Create a new random states based on an existing random state or seed.

Parameters
----------
random_state : numpy.random.RandomState
    Random state or seed from which to derive the new random state.

Returns
-------
numpy.random.RandomState
    Derived random state.


return isinstance(val, types.GeneratorType)<EOL>

Checks whether a variable is a generator.

Parameters
----------
val
    The variable to check.

Returns
-------
bool
    True is the variable is a generator. Otherwise False.


return isinstance(val, collections.Iterable)<EOL>

Checks whether a variable is iterable.

Parameters
----------
val
    The variable to check.

Returns
-------
bool
    True if the variable is an iterable. Otherwise False.


def imresize_many_images(images, sizes=None, interpolation=None):

<EOL>if len(images) == <NUM_LIT:0>:<EOL><INDENT>return images<EOL><DEDENT>do_assert(<EOL>all([image.shape[<NUM_LIT:0>] > <NUM_LIT:0> and image.shape[<NUM_LIT:1>] > <NUM_LIT:0> for image in images]),<EOL>("<STR_LIT>"<EOL>+ "<STR_LIT>") % (str([image.shape for image in images]),)<EOL>)<EOL>if is_single_number(sizes) and sizes <= <NUM_LIT:0>:<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>" % (sizes,))<EOL><DEDENT>elif isinstance(sizes, tuple) and (sizes[<NUM_LIT:0>] <= <NUM_LIT:0> or sizes[<NUM_LIT:1>] <= <NUM_LIT:0>):<EOL><INDENT>sizes_str = [<EOL>"<STR_LIT>" % (sizes[<NUM_LIT:0>],) if is_single_integer(sizes[<NUM_LIT:0>]) else "<STR_LIT>" % (sizes[<NUM_LIT:0>],),<EOL>"<STR_LIT>" % (sizes[<NUM_LIT:1>],) if is_single_integer(sizes[<NUM_LIT:1>]) else "<STR_LIT>" % (sizes[<NUM_LIT:1>],),<EOL>]<EOL>sizes_str = "<STR_LIT>" % (sizes_str[<NUM_LIT:0>], sizes_str[<NUM_LIT:1>])<EOL>raise Exception(<EOL>"<STR_LIT>" % (sizes_str,))<EOL><DEDENT>if is_single_number(sizes):<EOL><INDENT>sizes = (sizes, sizes)<EOL><DEDENT>else:<EOL><INDENT>do_assert(len(sizes) == <NUM_LIT:2>, "<STR_LIT>" % (len(sizes),))<EOL>do_assert(all([is_single_number(val) for val in sizes]),<EOL>"<STR_LIT>" % (str([type(val) for val in sizes]),))<EOL><DEDENT>if isinstance(images, list):<EOL><INDENT>nb_shapes = len(set([image.shape for image in images]))<EOL>if nb_shapes == <NUM_LIT:1>:<EOL><INDENT>return list(imresize_many_images(np.array(images), sizes=sizes, interpolation=interpolation))<EOL><DEDENT>else:<EOL><INDENT>return [imresize_many_images(image[np.newaxis, ...], sizes=sizes, interpolation=interpolation)[<NUM_LIT:0>, ...]<EOL>for image in images]<EOL><DEDENT><DEDENT>shape = images.shape<EOL>do_assert(images.ndim in [<NUM_LIT:3>, <NUM_LIT:4>], "<STR_LIT>" % (str(shape),))<EOL>nb_images = shape[<NUM_LIT:0>]<EOL>im_height, im_width = shape[<NUM_LIT:1>], shape[<NUM_LIT:2>]<EOL>nb_channels = shape[<NUM_LIT:3>] if images.ndim > <NUM_LIT:3> else None<EOL>height, width = sizes[<NUM_LIT:0>], sizes[<NUM_LIT:1>]<EOL>height = int(np.round(im_height * height)) if is_single_float(height) else height<EOL>width = int(np.round(im_width * width)) if is_single_float(width) else width<EOL>if height == im_height and width == im_width:<EOL><INDENT>return np.copy(images)<EOL><DEDENT>ip = interpolation<EOL>do_assert(ip is None or ip in IMRESIZE_VALID_INTERPOLATIONS)<EOL>if ip is None:<EOL><INDENT>if height > im_height or width > im_width:<EOL><INDENT>ip = cv2.INTER_AREA<EOL><DEDENT>else:<EOL><INDENT>ip = cv2.INTER_LINEAR<EOL><DEDENT><DEDENT>elif ip in ["<STR_LIT>", cv2.INTER_NEAREST]:<EOL><INDENT>ip = cv2.INTER_NEAREST<EOL><DEDENT>elif ip in ["<STR_LIT>", cv2.INTER_LINEAR]:<EOL><INDENT>ip = cv2.INTER_LINEAR<EOL><DEDENT>elif ip in ["<STR_LIT>", cv2.INTER_AREA]:<EOL><INDENT>ip = cv2.INTER_AREA<EOL><DEDENT>else:  <EOL><INDENT>ip = cv2.INTER_CUBIC<EOL><DEDENT>from . import dtypes as iadt<EOL>if ip == cv2.INTER_NEAREST:<EOL><INDENT>iadt.gate_dtypes(images,<EOL>allowed=["<STR_LIT:bool>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>disallowed=["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>augmenter=None)<EOL><DEDENT>else:<EOL><INDENT>iadt.gate_dtypes(images,<EOL>allowed=["<STR_LIT:bool>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>disallowed=["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>augmenter=None)<EOL><DEDENT>result_shape = (nb_images, height, width)<EOL>if nb_channels is not None:<EOL><INDENT>result_shape = result_shape + (nb_channels,)<EOL><DEDENT>result = np.zeros(result_shape, dtype=images.dtype)<EOL>for i, image in enumerate(images):<EOL><INDENT>input_dtype = image.dtype<EOL>if image.dtype.type == np.bool_:<EOL><INDENT>image = image.astype(np.uint8) * <NUM_LIT:255><EOL><DEDENT>elif image.dtype.type == np.int8 and ip != cv2.INTER_NEAREST:<EOL><INDENT>image = image.astype(np.int16)<EOL><DEDENT>elif image.dtype.type == np.float16:<EOL><INDENT>image = image.astype(np.float32)<EOL><DEDENT>result_img = cv2.resize(image, (width, height), interpolation=ip)<EOL>assert result_img.dtype == image.dtype<EOL>if len(result_img.shape) == <NUM_LIT:2> and nb_channels is not None and nb_channels == <NUM_LIT:1>:<EOL><INDENT>result_img = result_img[:, :, np.newaxis]<EOL><DEDENT>if input_dtype.type == np.bool_:<EOL><INDENT>result_img = result_img > <NUM_LIT><EOL><DEDENT>elif input_dtype.type == np.int8 and ip != cv2.INTER_NEAREST:<EOL><INDENT>from . import dtypes as iadt<EOL>result_img = iadt.restore_dtypes_(result_img, np.int8)<EOL><DEDENT>elif input_dtype.type == np.float16:<EOL><INDENT>from . import dtypes as iadt<EOL>result_img = iadt.restore_dtypes_(result_img, np.float16)<EOL><DEDENT>result[i] = result_img<EOL><DEDENT>return result<EOL>

Resize many images to a specified size.

dtype support::

    * ``uint8``: yes; fully tested
    * ``uint16``: yes; tested
    * ``uint32``: no (1)
    * ``uint64``: no (2)
    * ``int8``: yes; tested (3)
    * ``int16``: yes; tested
    * ``int32``: limited; tested (4)
    * ``int64``: no (2)
    * ``float16``: yes; tested (5)
    * ``float32``: yes; tested
    * ``float64``: yes; tested
    * ``float128``: no (1)
    * ``bool``: yes; tested (6)

    - (1) rejected by ``cv2.imresize``
    - (2) results too inaccurate
    - (3) mapped internally to ``int16`` when interpolation!="nearest"
    - (4) only supported for interpolation="nearest", other interpolations lead to cv2 error
    - (5) mapped internally to ``float32``
    - (6) mapped internally to ``uint8``

Parameters
----------
images : (N,H,W,[C]) ndarray or list of (H,W,[C]) ndarray
    Array of the images to resize.
    Usually recommended to be of dtype uint8.

sizes : float or iterable of int or iterable of float
    The new size of the images, given either as a fraction (a single float) or as
    a ``(height, width)`` tuple of two integers or as a ``(height fraction, width fraction)``
    tuple of two floats.

interpolation : None or str or int, optional
    The interpolation to use during resize.
    If int, then expected to be one of:

        * ``cv2.INTER_NEAREST`` (nearest neighbour interpolation)
        * ``cv2.INTER_LINEAR`` (linear interpolation)
        * ``cv2.INTER_AREA`` (area interpolation)
        * ``cv2.INTER_CUBIC`` (cubic interpolation)

    If string, then expected to be one of:

        * ``nearest`` (identical to ``cv2.INTER_NEAREST``)
        * ``linear`` (identical to ``cv2.INTER_LINEAR``)
        * ``area`` (identical to ``cv2.INTER_AREA``)
        * ``cubic`` (identical to ``cv2.INTER_CUBIC``)

    If None, the interpolation will be chosen automatically. For size
    increases, area interpolation will be picked and for size decreases,
    linear interpolation will be picked.

Returns
-------
result : (N,H',W',[C]) ndarray
    Array of the resized images.

Examples
--------
>>> imresize_many_images(np.zeros((2, 16, 16, 3), dtype=np.uint8), 2.0)

Converts 2 RGB images of height and width 16 to images of height and width 16*2 = 32.

>>> imresize_many_images(np.zeros((2, 16, 16, 3), dtype=np.uint8), (16, 32))

Converts 2 RGB images of height and width 16 to images of height 16 and width 32.

>>> imresize_many_images(np.zeros((2, 16, 16, 3), dtype=np.uint8), (2.0, 4.0))

Converts 2 RGB images of height and width 16 to images of height 32 and width 64.


<EOL>from imgaug.augmentables.bbs import BoundingBox, BoundingBoxesOnImage<EOL>left, top = <NUM_LIT:0>, <NUM_LIT:0><EOL>if extract is not None:<EOL><INDENT>bb_extract = _quokka_normalize_extract(extract)<EOL>left = bb_extract.x1<EOL>top = bb_extract.y1<EOL><DEDENT>with open(QUOKKA_ANNOTATIONS_FP, "<STR_LIT:r>") as f:<EOL><INDENT>json_dict = json.load(f)<EOL><DEDENT>bbs = []<EOL>for bb_dict in json_dict["<STR_LIT>"]:<EOL><INDENT>bbs.append(<EOL>BoundingBox(<EOL>x1=bb_dict["<STR_LIT>"] - left,<EOL>y1=bb_dict["<STR_LIT>"] - top,<EOL>x2=bb_dict["<STR_LIT>"] - left,<EOL>y2=bb_dict["<STR_LIT>"] - top<EOL>)<EOL>)<EOL><DEDENT>if extract is not None:<EOL><INDENT>shape = (bb_extract.height, bb_extract.width, <NUM_LIT:3>)<EOL><DEDENT>else:<EOL><INDENT>shape = (<NUM_LIT>, <NUM_LIT>, <NUM_LIT:3>)<EOL><DEDENT>bbsoi = BoundingBoxesOnImage(bbs, shape=shape)<EOL>if size is not None:<EOL><INDENT>shape_resized = _compute_resized_shape(shape, size)<EOL>bbsoi = bbsoi.on(shape_resized)<EOL><DEDENT>return bbsoi<EOL>

Returns example bounding boxes on the standard example quokke image.

Currently only a single bounding box is returned that covers the quokka.

Parameters
----------
size : None or float or tuple of int or tuple of float, optional
    Size of the output image on which the BBs are placed. If None, then the BBs
    are not projected to any new size (positions on the original image are used).
    Floats lead to relative size changes, ints to absolute sizes in pixels.

extract : None or 'square' or tuple of number or imgaug.BoundingBox or imgaug.BoundingBoxesOnImage
    Subarea to extract from the image. See :func:`imgaug.quokka`.

Returns
-------
bbsoi : imgaug.BoundingBoxesOnImage
    Example BBs on the quokka image.


seed_ = random_state.randint(SEED_MIN_VALUE, SEED_MAX_VALUE, <NUM_LIT:1>)[<NUM_LIT:0>]<EOL>return [new_random_state(seed_+i) for i in sm.xrange(n)]<EOL>

Create N new random states based on an existing random state or seed.

Parameters
----------
random_state : numpy.random.RandomState
    Random state or seed from which to derive new random states.

n : int, optional
    Number of random states to derive.

Returns
-------
list of numpy.random.RandomState
    Derived random states.


def show_grid(images, rows=None, cols=None):

grid = draw_grid(images, rows=rows, cols=cols)<EOL>imshow(grid)<EOL>

Converts the input images to a grid image and shows it in a new window.

dtype support::

    minimum of (
        :func:`imgaug.imgaug.draw_grid`,
        :func:`imgaug.imgaug.imshow`
    )

Parameters
----------
images : (N,H,W,3) ndarray or iterable of (H,W,3) array
    See :func:`imgaug.draw_grid`.

rows : None or int, optional
    See :func:`imgaug.draw_grid`.

cols : None or int, optional
    See :func:`imgaug.draw_grid`.


return is_single_integer(val) or is_single_float(val)<EOL>

Checks whether a variable is a number, i.e. an integer or float.

Parameters
----------
val
    The variable to check.

Returns
-------
bool
    True if the variable is a number. Otherwise False.


Set the seed used by the global random state and thereby all randomness
in the library.

This random state is by default by all augmenters. Under special
circumstances (e.g. when an augmenter is switched to deterministic mode),
the global random state is replaced by another -- local -- one.
The replacement is dependent on the global random state.

Parameters
----------
seedval : int
    The seed to use.


do_assert(backend in ["<STR_LIT>", "<STR_LIT>"], "<STR_LIT>" % (backend,))<EOL>if backend == "<STR_LIT>":<EOL><INDENT>image_bgr = image<EOL>if image.ndim == <NUM_LIT:3> and image.shape[<NUM_LIT:2>] in [<NUM_LIT:3>, <NUM_LIT:4>]:<EOL><INDENT>image_bgr = image[..., <NUM_LIT:0>:<NUM_LIT:3>][..., ::-<NUM_LIT:1>]<EOL><DEDENT>win_name = "<STR_LIT>"<EOL>cv2.namedWindow(win_name, cv2.WINDOW_NORMAL)<EOL>cv2.imshow(win_name, image_bgr)<EOL>cv2.waitKey(<NUM_LIT:0>)<EOL>cv2.destroyWindow(win_name)<EOL><DEDENT>else:<EOL><INDENT>import matplotlib.pyplot as plt<EOL>dpi = <NUM_LIT><EOL>h, w = image.shape[<NUM_LIT:0>] / dpi, image.shape[<NUM_LIT:1>] / dpi<EOL>w = max(w, <NUM_LIT:6>)  <EOL>fig, ax = plt.subplots(figsize=(w, h), dpi=dpi)<EOL>fig.canvas.set_window_title("<STR_LIT>" % (image.shape,))<EOL>ax.imshow(image, cmap="<STR_LIT>")  <EOL>plt.show()<EOL><DEDENT>

Shows an image in a window.

dtype support::

    * ``uint8``: yes; not tested
    * ``uint16``: ?
    * ``uint32``: ?
    * ``uint64``: ?
    * ``int8``: ?
    * ``int16``: ?
    * ``int32``: ?
    * ``int64``: ?
    * ``float16``: ?
    * ``float32``: ?
    * ``float64``: ?
    * ``float128``: ?
    * ``bool``: ?

Parameters
----------
image : (H,W,3) ndarray
    Image to show.

backend : {'matplotlib', 'cv2'}, optional
    Library to use to show the image. May be either matplotlib or OpenCV ('cv2').
    OpenCV tends to be faster, but apparently causes more technical issues.


if is_np_array(from_shape):<EOL><INDENT>from_shape = from_shape.shape<EOL><DEDENT>if is_np_array(to_shape):<EOL><INDENT>to_shape = to_shape.shape<EOL><DEDENT>to_shape_computed = list(from_shape)<EOL>if to_shape is None:<EOL><INDENT>pass<EOL><DEDENT>elif isinstance(to_shape, tuple):<EOL><INDENT>do_assert(len(from_shape) in [<NUM_LIT:2>, <NUM_LIT:3>])<EOL>do_assert(len(to_shape) in [<NUM_LIT:2>, <NUM_LIT:3>])<EOL>if len(from_shape) == <NUM_LIT:3> and len(to_shape) == <NUM_LIT:3>:<EOL><INDENT>do_assert(from_shape[<NUM_LIT:2>] == to_shape[<NUM_LIT:2>])<EOL><DEDENT>elif len(to_shape) == <NUM_LIT:3>:<EOL><INDENT>to_shape_computed.append(to_shape[<NUM_LIT:2>])<EOL><DEDENT>do_assert(all([v is None or is_single_number(v) for v in to_shape[<NUM_LIT:0>:<NUM_LIT:2>]]),<EOL>"<STR_LIT>"<EOL>+ "<STR_LIT>" % (str([type(v) for v in to_shape[<NUM_LIT:0>:<NUM_LIT:2>]]),))<EOL>for i, from_shape_i in enumerate(from_shape[<NUM_LIT:0>:<NUM_LIT:2>]):<EOL><INDENT>if to_shape[i] is None:<EOL><INDENT>to_shape_computed[i] = from_shape_i<EOL><DEDENT>elif is_single_integer(to_shape[i]):<EOL><INDENT>to_shape_computed[i] = to_shape[i]<EOL><DEDENT>else:  <EOL><INDENT>to_shape_computed[i] = int(np.round(from_shape_i * to_shape[i]))<EOL><DEDENT><DEDENT><DEDENT>elif is_single_integer(to_shape) or is_single_float(to_shape):<EOL><INDENT>to_shape_computed = _compute_resized_shape(from_shape, (to_shape, to_shape))<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>"<EOL>+ "<STR_LIT>" % (type(to_shape),))<EOL><DEDENT>return tuple(to_shape_computed)<EOL>

Computes the intended new shape of an image-like array after resizing.

Parameters
----------
from_shape : tuple or ndarray
    Old shape of the array. Usually expected to be a tuple of form ``(H, W)`` or ``(H, W, C)`` or
    alternatively an array with two or three dimensions.

to_shape : None or tuple of ints or tuple of floats or int or float or ndarray
    New shape of the array.

        * If None, then `from_shape` will be used as the new shape.
        * If an int ``V``, then the new shape will be ``(V, V, [C])``, where ``C`` will be added if it
          is part of `from_shape`.
        * If a float ``V``, then the new shape will be ``(H*V, W*V, [C])``, where ``H`` and ``W`` are the old
          height/width.
        * If a tuple ``(H', W', [C'])`` of ints, then ``H'`` and ``W'`` will be used as the new height
          and width.
        * If a tuple ``(H', W', [C'])`` of floats (except ``C``), then ``H'`` and ``W'`` will
          be used as the new height and width.
        * If a numpy array, then the array's shape will be used.

Returns
-------
to_shape_computed : tuple of int
    New shape.


img = imageio.imread(QUOKKA_FP, pilmode="<STR_LIT>")<EOL>if extract is not None:<EOL><INDENT>bb = _quokka_normalize_extract(extract)<EOL>img = bb.extract_from_image(img)<EOL><DEDENT>if size is not None:<EOL><INDENT>shape_resized = _compute_resized_shape(img.shape, size)<EOL>img = imresize_single_image(img, shape_resized[<NUM_LIT:0>:<NUM_LIT:2>])<EOL><DEDENT>return img<EOL>

Returns an image of a quokka as a numpy array.

Parameters
----------
size : None or float or tuple of int, optional
    Size of the output image. Input into :func:`imgaug.imgaug.imresize_single_image`.
    Usually expected to be a tuple ``(H, W)``, where ``H`` is the desired height
    and ``W`` is the width. If None, then the image will not be resized.

extract : None or 'square' or tuple of number or imgaug.BoundingBox or imgaug.BoundingBoxesOnImage
    Subarea of the quokka image to extract:

        * If None, then the whole image will be used.
        * If string ``square``, then a squared area ``(x: 0 to max 643, y: 0 to max 643)`` will
          be extracted from the image.
        * If a tuple, then expected to contain four numbers denoting ``x1``, ``y1``, ``x2``
          and ``y2``.
        * If a BoundingBox, then that bounding box's area will be extracted from the image.
        * If a BoundingBoxesOnImage, then expected to contain exactly one bounding box
          and a shape matching the full image dimensions (i.e. ``(643, 960, *)``). Then the
          one bounding box will be used similar to BoundingBox.

Returns
-------
img : (H,W,3) ndarray
    The image array of dtype uint8.


def is_activated(self, images, augmenter, parents, default):

if self.activator is None:<EOL><INDENT>return default<EOL><DEDENT>else:<EOL><INDENT>return self.activator(images, augmenter, parents, default)<EOL><DEDENT>

Returns whether an augmenter may be executed.

Returns
-------
bool
    If True, the augmenter may be executed. If False, it may not be executed.


if seed is None:<EOL><INDENT>if not fully_random:<EOL><INDENT>seed = CURRENT_RANDOM_STATE.randint(SEED_MIN_VALUE, SEED_MAX_VALUE, <NUM_LIT:1>)[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>return np.random.RandomState(seed)<EOL>

Returns a new random state.

Parameters
----------
seed : None or int, optional
    Optional seed value to use.
    The same datatypes are allowed as for ``numpy.random.RandomState(seed)``.

fully_random : bool, optional
    Whether to use numpy's random initialization for the
    RandomState (used if set to True). If False, a seed is sampled from
    the global random state, which is a bit faster and hence the default.

Returns
-------
numpy.random.RandomState
    The new random state.


return is_np_array(val) and issubclass(val.dtype.type, np.integer)<EOL>

Checks whether a variable is a numpy integer array.

Parameters
----------
val
    The variable to check.

Returns
-------
bool
    True if the variable is a numpy integer array. Otherwise False.


return sys._getframe(<NUM_LIT:1>).f_code.co_name<EOL>

Returns the name of the caller, e.g. a function.

Returns
-------
str
    The name of the caller as a string


def pad(arr, top=<NUM_LIT:0>, right=<NUM_LIT:0>, bottom=<NUM_LIT:0>, left=<NUM_LIT:0>, mode="<STR_LIT>", cval=<NUM_LIT:0>):

do_assert(arr.ndim in [<NUM_LIT:2>, <NUM_LIT:3>])<EOL>do_assert(top >= <NUM_LIT:0>)<EOL>do_assert(right >= <NUM_LIT:0>)<EOL>do_assert(bottom >= <NUM_LIT:0>)<EOL>do_assert(left >= <NUM_LIT:0>)<EOL>if top > <NUM_LIT:0> or right > <NUM_LIT:0> or bottom > <NUM_LIT:0> or left > <NUM_LIT:0>:<EOL><INDENT>mapping_mode_np_to_cv2 = {<EOL>"<STR_LIT>": cv2.BORDER_CONSTANT,<EOL>"<STR_LIT>": cv2.BORDER_REPLICATE,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": cv2.BORDER_REFLECT_101,<EOL>"<STR_LIT>": cv2.BORDER_REFLECT,<EOL>"<STR_LIT>": None,<EOL>cv2.BORDER_CONSTANT: cv2.BORDER_CONSTANT,<EOL>cv2.BORDER_REPLICATE: cv2.BORDER_REPLICATE,<EOL>cv2.BORDER_REFLECT_101: cv2.BORDER_REFLECT_101,<EOL>cv2.BORDER_REFLECT: cv2.BORDER_REFLECT<EOL>}<EOL>bad_mode_cv2 = mapping_mode_np_to_cv2.get(mode, None) is None<EOL>bad_datatype_cv2 = arr.dtype.name in ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT:bool>"]<EOL>if not bad_datatype_cv2 and not bad_mode_cv2:<EOL><INDENT>cval = float(cval) if arr.dtype.kind == "<STR_LIT:f>" else int(cval)  <EOL>if arr.ndim == <NUM_LIT:2> or arr.shape[<NUM_LIT:2>] <= <NUM_LIT:4>:<EOL><INDENT>if arr.ndim == <NUM_LIT:3>:<EOL><INDENT>cval = tuple([cval] * arr.shape[<NUM_LIT:2>])<EOL><DEDENT>arr_pad = cv2.copyMakeBorder(arr, top=top, bottom=bottom, left=left, right=right,<EOL>borderType=mapping_mode_np_to_cv2[mode], value=cval)<EOL>if arr.ndim == <NUM_LIT:3> and arr_pad.ndim == <NUM_LIT:2>:<EOL><INDENT>arr_pad = arr_pad[..., np.newaxis]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>result = []<EOL>channel_start_idx = <NUM_LIT:0><EOL>while channel_start_idx < arr.shape[<NUM_LIT:2>]:<EOL><INDENT>arr_c = arr[..., channel_start_idx:channel_start_idx+<NUM_LIT:4>]<EOL>cval_c = tuple([cval] * arr_c.shape[<NUM_LIT:2>])<EOL>arr_pad_c = cv2.copyMakeBorder(arr_c, top=top, bottom=bottom, left=left, right=right,<EOL>borderType=mapping_mode_np_to_cv2[mode], value=cval_c)<EOL>arr_pad_c = np.atleast_3d(arr_pad_c)<EOL>result.append(arr_pad_c)<EOL>channel_start_idx += <NUM_LIT:4><EOL><DEDENT>arr_pad = np.concatenate(result, axis=<NUM_LIT:2>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>paddings_np = [(top, bottom), (left, right)]  <EOL>if arr.ndim == <NUM_LIT:3>:<EOL><INDENT>paddings_np.append((<NUM_LIT:0>, <NUM_LIT:0>))  <EOL><DEDENT>if mode == "<STR_LIT>":<EOL><INDENT>arr_pad = np.pad(arr, paddings_np, mode=mode, constant_values=cval)<EOL><DEDENT>elif mode == "<STR_LIT>":<EOL><INDENT>arr_pad = np.pad(arr, paddings_np, mode=mode, end_values=cval)<EOL><DEDENT>else:<EOL><INDENT>arr_pad = np.pad(arr, paddings_np, mode=mode)<EOL><DEDENT><DEDENT>return arr_pad<EOL><DEDENT>return np.copy(arr)<EOL>

Pad an image-like array on its top/right/bottom/left side.

This function is a wrapper around :func:`numpy.pad`.

dtype support::

    * ``uint8``: yes; fully tested (1)
    * ``uint16``: yes; fully tested (1)
    * ``uint32``: yes; fully tested (2) (3)
    * ``uint64``: yes; fully tested (2) (3)
    * ``int8``: yes; fully tested (1)
    * ``int16``: yes; fully tested (1)
    * ``int32``: yes; fully tested (1)
    * ``int64``: yes; fully tested (2) (3)
    * ``float16``: yes; fully tested (2) (3)
    * ``float32``: yes; fully tested (1)
    * ``float64``: yes; fully tested (1)
    * ``float128``: yes; fully tested (2) (3)
    * ``bool``: yes; tested (2) (3)

    - (1) Uses ``cv2`` if `mode` is one of: ``"constant"``, ``"edge"``, ``"reflect"``, ``"symmetric"``.
          Otherwise uses ``numpy``.
    - (2) Uses ``numpy``.
    - (3) Rejected by ``cv2``.

Parameters
----------
arr : (H,W) ndarray or (H,W,C) ndarray
    Image-like array to pad.

top : int, optional
    Amount of pixels to add at the top side of the image. Must be 0 or greater.

right : int, optional
    Amount of pixels to add at the right side of the image. Must be 0 or greater.

bottom : int, optional
    Amount of pixels to add at the bottom side of the image. Must be 0 or greater.

left : int, optional
    Amount of pixels to add at the left side of the image. Must be 0 or greater.

mode : str, optional
    Padding mode to use. See :func:`numpy.pad` for details.
    In case of mode ``constant``, the parameter `cval` will be used as the ``constant_values``
    parameter to :func:`numpy.pad`.
    In case of mode ``linear_ramp``, the parameter `cval` will be used as the ``end_values``
    parameter to :func:`numpy.pad`.

cval : number, optional
    Value to use for padding if `mode` is ``constant``. See :func:`numpy.pad` for details.
    The cval is expected to match the input array's dtype and value range.

Returns
-------
arr_pad : (H',W') ndarray or (H',W',C) ndarray
    Padded array with height ``H'=H+top+bottom`` and width ``W'=W+left+right``.


def draw_grid(images, rows=None, cols=None):

nb_images = len(images)<EOL>do_assert(nb_images > <NUM_LIT:0>)<EOL>if is_np_array(images):<EOL><INDENT>do_assert(images.ndim == <NUM_LIT:4>)<EOL><DEDENT>else:<EOL><INDENT>do_assert(is_iterable(images) and is_np_array(images[<NUM_LIT:0>]) and images[<NUM_LIT:0>].ndim == <NUM_LIT:3>)<EOL>dts = [image.dtype.name for image in images]<EOL>nb_dtypes = len(set(dts))<EOL>do_assert(nb_dtypes == <NUM_LIT:1>, ("<STR_LIT>"<EOL>+ "<STR_LIT>") % (nb_dtypes, "<STR_LIT:U+002CU+0020>".join(dts)))<EOL><DEDENT>cell_height = max([image.shape[<NUM_LIT:0>] for image in images])<EOL>cell_width = max([image.shape[<NUM_LIT:1>] for image in images])<EOL>channels = set([image.shape[<NUM_LIT:2>] for image in images])<EOL>do_assert(<EOL>len(channels) == <NUM_LIT:1>,<EOL>"<STR_LIT>"<EOL>+ "<STR_LIT>" % (str(channels), len(channels))<EOL>)<EOL>nb_channels = list(channels)[<NUM_LIT:0>]<EOL>if rows is None and cols is None:<EOL><INDENT>rows = cols = int(math.ceil(math.sqrt(nb_images)))<EOL><DEDENT>elif rows is not None:<EOL><INDENT>cols = int(math.ceil(nb_images / rows))<EOL><DEDENT>elif cols is not None:<EOL><INDENT>rows = int(math.ceil(nb_images / cols))<EOL><DEDENT>do_assert(rows * cols >= nb_images)<EOL>width = cell_width * cols<EOL>height = cell_height * rows<EOL>dt = images.dtype if is_np_array(images) else images[<NUM_LIT:0>].dtype<EOL>grid = np.zeros((height, width, nb_channels), dtype=dt)<EOL>cell_idx = <NUM_LIT:0><EOL>for row_idx in sm.xrange(rows):<EOL><INDENT>for col_idx in sm.xrange(cols):<EOL><INDENT>if cell_idx < nb_images:<EOL><INDENT>image = images[cell_idx]<EOL>cell_y1 = cell_height * row_idx<EOL>cell_y2 = cell_y1 + image.shape[<NUM_LIT:0>]<EOL>cell_x1 = cell_width * col_idx<EOL>cell_x2 = cell_x1 + image.shape[<NUM_LIT:1>]<EOL>grid[cell_y1:cell_y2, cell_x1:cell_x2, :] = image<EOL><DEDENT>cell_idx += <NUM_LIT:1><EOL><DEDENT><DEDENT>return grid<EOL>

Converts multiple input images into a single image showing them in a grid.

dtype support::

    * ``uint8``: yes; fully tested
    * ``uint16``: yes; fully tested
    * ``uint32``: yes; fully tested
    * ``uint64``: yes; fully tested
    * ``int8``: yes; fully tested
    * ``int16``: yes; fully tested
    * ``int32``: yes; fully tested
    * ``int64``: yes; fully tested
    * ``float16``: yes; fully tested
    * ``float32``: yes; fully tested
    * ``float64``: yes; fully tested
    * ``float128``: yes; fully tested
    * ``bool``: yes; fully tested

Parameters
----------
images : (N,H,W,3) ndarray or iterable of (H,W,3) array
    The input images to convert to a grid.

rows : None or int, optional
    The number of rows to show in the grid.
    If None, it will be automatically derived.

cols : None or int, optional
    The number of cols to show in the grid.
    If None, it will be automatically derived.

Returns
-------
grid : (H',W',3) ndarray
    Image of the generated grid.


return type(val) == type(True)<EOL>

Checks whether a variable is a boolean.

Parameters
----------
val
    The variable to check.

Returns
-------
bool
    True if the variable is a boolean. Otherwise False.


def pad_to_aspect_ratio(arr, aspect_ratio, mode="<STR_LIT>", cval=<NUM_LIT:0>, return_pad_amounts=False):

pad_top, pad_right, pad_bottom, pad_left = compute_paddings_for_aspect_ratio(arr, aspect_ratio)<EOL>arr_padded = pad(<EOL>arr,<EOL>top=pad_top,<EOL>right=pad_right,<EOL>bottom=pad_bottom,<EOL>left=pad_left,<EOL>mode=mode,<EOL>cval=cval<EOL>)<EOL>if return_pad_amounts:<EOL><INDENT>return arr_padded, (pad_top, pad_right, pad_bottom, pad_left)<EOL><DEDENT>else:<EOL><INDENT>return arr_padded<EOL><DEDENT>

Pad an image-like array on its sides so that it matches a target aspect ratio.

Depending on which dimension is smaller (height or width), only the corresponding
sides (left/right or top/bottom) will be padded. In each case, both of the sides will
be padded equally.

dtype support::

    See :func:`imgaug.imgaug.pad`.

Parameters
----------
arr : (H,W) ndarray or (H,W,C) ndarray
    Image-like array to pad.

aspect_ratio : float
    Target aspect ratio, given as width/height. E.g. 2.0 denotes the image having twice
    as much width as height.

mode : str, optional
    Padding mode to use. See :func:`numpy.pad` for details.

cval : number, optional
    Value to use for padding if `mode` is ``constant``. See :func:`numpy.pad` for details.

return_pad_amounts : bool, optional
    If False, then only the padded image will be returned. If True, a tuple with two
    entries will be returned, where the first entry is the padded image and the second
    entry are the amounts by which each image side was padded. These amounts are again a
    tuple of the form (top, right, bottom, left), with each value being an integer.

Returns
-------
arr_padded : (H',W') ndarray or (H',W',C) ndarray
    Padded image as (H',W') or (H',W',C) ndarray, fulfulling the given aspect_ratio.

tuple of int
    Amounts by which the image was padded on each side, given as a tuple ``(top, right, bottom, left)``.
    This tuple is only returned if `return_pad_amounts` was set to True.
    Otherwise only ``arr_padded`` is returned.


def _augment_images_worker(self, augseq, queue_source, queue_result, seedval):

np.random.seed(seedval)<EOL>random.seed(seedval)<EOL>augseq.reseed(seedval)<EOL>ia.seed(seedval)<EOL>loader_finished = False<EOL>while not loader_finished:<EOL><INDENT>try:<EOL><INDENT>batch_str = queue_source.get(timeout=<NUM_LIT:0.1>)<EOL>batch = pickle.loads(batch_str)<EOL>if batch is None:<EOL><INDENT>loader_finished = True<EOL>queue_source.put(pickle.dumps(None, protocol=-<NUM_LIT:1>))<EOL><DEDENT>else:<EOL><INDENT>batch_aug = augseq.augment_batch(batch)<EOL>batch_str = pickle.dumps(batch_aug, protocol=-<NUM_LIT:1>)<EOL>queue_result.put(batch_str)<EOL><DEDENT><DEDENT>except QueueEmpty:<EOL><INDENT>time.sleep(<NUM_LIT>)<EOL><DEDENT><DEDENT>queue_result.put(pickle.dumps(None, protocol=-<NUM_LIT:1>))<EOL>time.sleep(<NUM_LIT>)<EOL>

Augment endlessly images in the source queue.

This is a worker function for that endlessly queries the source queue (input batches),
augments batches in it and sends the result to the output queue.


def imap_batches_unordered(self, batches, chunksize=<NUM_LIT:1>):

assert ia.is_generator(batches), ("<STR_LIT>"<EOL>+ "<STR_LIT>") % (type(batches),)<EOL>gen = self.pool.imap_unordered(_Pool_starworker, self._handle_batch_ids_gen(batches), chunksize=chunksize)<EOL>for batch in gen:<EOL><INDENT>yield batch<EOL><DEDENT>

Augment batches from a generator in a way that does not guarantee to preserve order.

Parameters
----------
batches : generator of imgaug.augmentables.batches.Batch
    The batches to augment, provided as a generator. Each call to the generator should yield exactly one
    batch.

chunksize : None or int, optional
    Rough indicator of how many tasks should be sent to each worker. Increasing this number can improve
    performance.

Yields
------
imgaug.augmentables.batches.Batch
    Augmented batch.


def map_batches_async(self, batches, chunksize=None, callback=None, error_callback=None):

assert isinstance(batches, list), ("<STR_LIT>"<EOL>+ "<STR_LIT>") % (type(batches),)<EOL>return self.pool.map_async(_Pool_starworker, self._handle_batch_ids(batches),<EOL>chunksize=chunksize, callback=callback, error_callback=error_callback)<EOL>

Augment batches asynchonously.

Parameters
----------
batches : list of imgaug.augmentables.batches.Batch
    The batches to augment.

chunksize : None or int, optional
    Rough indicator of how many tasks should be sent to each worker. Increasing this number can improve
    performance.

callback : None or callable, optional
    Function to call upon finish. See `multiprocessing.Pool`.

error_callback : None or callable, optional
    Function to call upon errors. See `multiprocessing.Pool`.

Returns
-------
multiprocessing.MapResult
    Asynchonous result. See `multiprocessing.Pool`.


if self._pool is not None:<EOL><INDENT>self._pool.join()<EOL><DEDENT>

Wait for the workers to exit.

This may only be called after calling :func:`imgaug.multicore.Pool.join` or
:func:`imgaug.multicore.Pool.terminate`.


if not self.join_signal.is_set():<EOL><INDENT>self.join_signal.set()<EOL><DEDENT>time.sleep(<NUM_LIT>)<EOL>if self.main_worker_thread.is_alive():<EOL><INDENT>self.main_worker_thread.join()<EOL><DEDENT>if self.threaded:<EOL><INDENT>for worker in self.workers:<EOL><INDENT>if worker.is_alive():<EOL><INDENT>worker.join()<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for worker in self.workers:<EOL><INDENT>if worker.is_alive():<EOL><INDENT>worker.terminate()<EOL>worker.join()<EOL><DEDENT><DEDENT>while not self.all_finished():<EOL><INDENT>time.sleep(<NUM_LIT>)<EOL><DEDENT><DEDENT>if self.queue.full():<EOL><INDENT>self.queue.get()<EOL><DEDENT>self.queue.put(pickle.dumps(None, protocol=-<NUM_LIT:1>))<EOL>time.sleep(<NUM_LIT>)<EOL>while True:<EOL><INDENT>try:<EOL><INDENT>self._queue_internal.get(timeout=<NUM_LIT>)<EOL><DEDENT>except QueueEmpty:<EOL><INDENT>break<EOL><DEDENT><DEDENT>if not self._queue_internal._closed:<EOL><INDENT>self._queue_internal.close()<EOL><DEDENT>if not self.queue._closed:<EOL><INDENT>self.queue.close()<EOL><DEDENT>self._queue_internal.join_thread()<EOL>self.queue.join_thread()<EOL>time.sleep(<NUM_LIT>)<EOL>


if self._pool is None:<EOL><INDENT>processes = self.processes<EOL>if processes is not None and processes < <NUM_LIT:0>:<EOL><INDENT>try:<EOL><INDENT>processes = multiprocessing.cpu_count() - abs(processes)<EOL>processes = max(processes, <NUM_LIT:1>)<EOL><DEDENT>except (ImportError, NotImplementedError):<EOL><INDENT>processes = None<EOL><DEDENT><DEDENT>self._pool = multiprocessing.Pool(processes,<EOL>initializer=_Pool_initialize_worker,<EOL>initargs=(self.augseq, self.seed),<EOL>maxtasksperchild=self.maxtasksperchild)<EOL><DEDENT>return self._pool<EOL>

Return the multiprocessing.Pool instance or create it if not done yet.

        Returns
        -------
        multiprocessing.Pool
            The multiprocessing.Pool used internally by this imgaug.multicore.Pool.


def generate_similar_points_manhattan(self, nb_steps, step_size, return_array=False):

<EOL>points = np.zeros((nb_steps + <NUM_LIT:1> + nb_steps + <NUM_LIT:2>*(nb_steps**<NUM_LIT:2>), <NUM_LIT:2>), dtype=np.float32)<EOL>yy = np.linspace(self.y - nb_steps * step_size, self.y + nb_steps * step_size, nb_steps + <NUM_LIT:1> + nb_steps)<EOL>width = <NUM_LIT:1><EOL>nth_point = <NUM_LIT:0><EOL>for i_y, y in enumerate(yy):<EOL><INDENT>if width == <NUM_LIT:1>:<EOL><INDENT>xx = [self.x]<EOL><DEDENT>else:<EOL><INDENT>xx = np.linspace(self.x - (width-<NUM_LIT:1>)//<NUM_LIT:2> * step_size, self.x + (width-<NUM_LIT:1>)//<NUM_LIT:2> * step_size, width)<EOL><DEDENT>for x in xx:<EOL><INDENT>points[nth_point] = [x, y]<EOL>nth_point += <NUM_LIT:1><EOL><DEDENT>if i_y < nb_steps:<EOL><INDENT>width += <NUM_LIT:2><EOL><DEDENT>else:<EOL><INDENT>width -= <NUM_LIT:2><EOL><DEDENT><DEDENT>if return_array:<EOL><INDENT>return points<EOL><DEDENT>return [self.deepcopy(x=points[i, <NUM_LIT:0>], y=points[i, <NUM_LIT:1>]) for i in sm.xrange(points.shape[<NUM_LIT:0>])]<EOL>

Generate nearby points to this keypoint based on manhattan distance.

To generate the first neighbouring points, a distance of S (step size) is moved from the
center point (this keypoint) to the top, right, bottom and left, resulting in four new
points. From these new points, the pattern is repeated. Overlapping points are ignored.

The resulting points have a shape similar to a square rotated by 45 degrees.

Parameters
----------
nb_steps : int
    The number of steps to move from the center point. nb_steps=1 results in a total of
    5 output points (1 center point + 4 neighbours).

step_size : number
    The step size to move from every point to its neighbours.

return_array : bool, optional
    Whether to return the generated points as a list of keypoints or an array
    of shape ``(N,2)``, where ``N`` is the number of generated points and the second axis contains
    the x- (first value) and y- (second value) coordinates.

Returns
-------
points : list of imgaug.Keypoint or (N,2) ndarray
    If return_array was False, then a list of Keypoint.
    Otherwise a numpy array of shape ``(N,2)``, where ``N`` is the number of generated points and
    the second axis contains the x- (first value) and y- (second value) coordinates.
    The center keypoint (the one on which this function was called) is always included.


return int(np.round(self.x))<EOL>

Return the keypoint's x-coordinate, rounded to the closest integer.

Returns
-------
result : int
    Keypoint's x-coordinate, rounded to the closest integer.


def shift(self, x=<NUM_LIT:0>, y=<NUM_LIT:0>):

keypoints = [keypoint.shift(x=x, y=y) for keypoint in self.keypoints]<EOL>return self.deepcopy(keypoints)<EOL>

Move the keypoints around on an image.

Parameters
----------
x : number, optional
    Move each keypoint by this value on the x axis.

y : number, optional
    Move each keypoint by this value on the y axis.

Returns
-------
out : KeypointsOnImage
    Keypoints after moving them.


@classmethod<EOL><INDENT>def from_xy_array(cls, xy, shape):<DEDENT>

keypoints = [Keypoint(x=coord[<NUM_LIT:0>], y=coord[<NUM_LIT:1>]) for coord in xy]<EOL>return KeypointsOnImage(keypoints, shape)<EOL>

Convert an array (N,2) with a given image shape to a KeypointsOnImage object.

Parameters
----------
xy : (N, 2) ndarray
    Coordinates of ``N`` keypoints on the original image, given
    as ``(N,2)`` array of xy-coordinates.

shape : tuple of int or ndarray
    Shape tuple of the image on which the keypoints are placed.

Returns
-------
KeypointsOnImage
    KeypointsOnImage object that contains all keypoints from the array.


def project(self, from_shape, to_shape):

xy_proj = project_coords([(self.x, self.y)], from_shape, to_shape)<EOL>return self.deepcopy(x=xy_proj[<NUM_LIT:0>][<NUM_LIT:0>], y=xy_proj[<NUM_LIT:0>][<NUM_LIT:1>])<EOL>

Project the keypoint onto a new position on a new image.

E.g. if the keypoint is on its original image at x=(10 of 100 pixels)
and y=(20 of 100 pixels) and is projected onto a new image with
size (width=200, height=200), its new position will be (20, 40).

This is intended for cases where the original image is resized.
It cannot be used for more complex changes (e.g. padding, cropping).

Parameters
----------
from_shape : tuple of int
    Shape of the original image. (Before resize.)

to_shape : tuple of int
    Shape of the new image. (After resize.)

Returns
-------
imgaug.Keypoint
    Keypoint object with new coordinates.


return len(self.keypoints) == <NUM_LIT:0><EOL>

Returns whether this object contains zero keypoints.

Returns
-------
result : bool
    True if this object contains zero keypoints.


def copy(self, keypoints=None, shape=None):

result = copy.copy(self)<EOL>if keypoints is not None:<EOL><INDENT>result.keypoints = keypoints<EOL><DEDENT>if shape is not None:<EOL><INDENT>result.shape = shape<EOL><DEDENT>return result<EOL>

Create a shallow copy of the KeypointsOnImage object.

Parameters
----------
keypoints : None or list of imgaug.Keypoint, optional
    List of keypoints on the image. If ``None``, the instance's
    keypoints will be copied.

shape : tuple of int, optional
    The shape of the image on which the keypoints are placed.
    If ``None``, the instance's shape will be copied.

Returns
-------
imgaug.KeypointsOnImage
    Shallow copy.


def draw_on_image(self, image, color=(<NUM_LIT:0>, <NUM_LIT:255>, <NUM_LIT:0>), alpha=<NUM_LIT:1.0>, size=<NUM_LIT:3>,<EOL>copy=True, raise_if_out_of_image=False):

if copy:<EOL><INDENT>image = np.copy(image)<EOL><DEDENT>if image.ndim == <NUM_LIT:2>:<EOL><INDENT>assert ia.is_single_number(color), (<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % (str(color),))<EOL><DEDENT>elif image.ndim == <NUM_LIT:3> and ia.is_single_number(color):<EOL><INDENT>color = [color] * image.shape[-<NUM_LIT:1>]<EOL><DEDENT>input_dtype = image.dtype<EOL>alpha_color = color<EOL>if alpha < <NUM_LIT>:<EOL><INDENT>return image<EOL><DEDENT>elif alpha > <NUM_LIT>:<EOL><INDENT>alpha = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>image = image.astype(np.float32, copy=False)<EOL>alpha_color = alpha * np.array(color)<EOL><DEDENT>height, width = image.shape[<NUM_LIT:0>:<NUM_LIT:2>]<EOL>y, x = self.y_int, self.x_int<EOL>x1 = max(x - size//<NUM_LIT:2>, <NUM_LIT:0>)<EOL>x2 = min(x + <NUM_LIT:1> + size//<NUM_LIT:2>, width)<EOL>y1 = max(y - size//<NUM_LIT:2>, <NUM_LIT:0>)<EOL>y2 = min(y + <NUM_LIT:1> + size//<NUM_LIT:2>, height)<EOL>x1_clipped, x2_clipped = np.clip([x1, x2], <NUM_LIT:0>, width)<EOL>y1_clipped, y2_clipped = np.clip([y1, y2], <NUM_LIT:0>, height)<EOL>x1_clipped_ooi = (x1_clipped < <NUM_LIT:0> or x1_clipped >= width)<EOL>x2_clipped_ooi = (x2_clipped < <NUM_LIT:0> or x2_clipped >= width+<NUM_LIT:1>)<EOL>y1_clipped_ooi = (y1_clipped < <NUM_LIT:0> or y1_clipped >= height)<EOL>y2_clipped_ooi = (y2_clipped < <NUM_LIT:0> or y2_clipped >= height+<NUM_LIT:1>)<EOL>x_ooi = (x1_clipped_ooi and x2_clipped_ooi)<EOL>y_ooi = (y1_clipped_ooi and y2_clipped_ooi)<EOL>x_zero_size = (x2_clipped - x1_clipped) < <NUM_LIT:1>  <EOL>y_zero_size = (y2_clipped - y1_clipped) < <NUM_LIT:1><EOL>if not x_ooi and not y_ooi and not x_zero_size and not y_zero_size:<EOL><INDENT>if alpha == <NUM_LIT:1>:<EOL><INDENT>image[y1_clipped:y2_clipped, x1_clipped:x2_clipped] = color<EOL><DEDENT>else:<EOL><INDENT>image[y1_clipped:y2_clipped, x1_clipped:x2_clipped] = (<EOL>(<NUM_LIT:1> - alpha)<EOL>* image[y1_clipped:y2_clipped, x1_clipped:x2_clipped]<EOL>+ alpha_color<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if raise_if_out_of_image:<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % (y, x, image.shape))<EOL><DEDENT><DEDENT>if image.dtype.name != input_dtype.name:<EOL><INDENT>if input_dtype.name == "<STR_LIT>":<EOL><INDENT>image = np.clip(image, <NUM_LIT:0>, <NUM_LIT:255>, out=image)<EOL><DEDENT>image = image.astype(input_dtype, copy=False)<EOL><DEDENT>return image<EOL>

Draw the keypoint onto a given image.

The keypoint is drawn as a square.

Parameters
----------
image : (H,W,3) ndarray
    The image onto which to draw the keypoint.

color : int or list of int or tuple of int or (3,) ndarray, optional
    The RGB color of the keypoint. If a single int ``C``, then that is
    equivalent to ``(C,C,C)``.

alpha : float, optional
    The opacity of the drawn keypoint, where ``1.0`` denotes a fully
    visible keypoint and ``0.0`` an invisible one.

size : int, optional
    The size of the keypoint. If set to ``S``, each square will have
    size ``S x S``.

copy : bool, optional
    Whether to copy the image before drawing the keypoint.

raise_if_out_of_image : bool, optional
    Whether to raise an exception if the keypoint is outside of the
    image.

Returns
-------
image : (H,W,3) ndarray
    Image with drawn keypoint.


x = self.x if x is None else x<EOL>y = self.y if y is None else y<EOL>return Keypoint(x=x, y=y)<EOL>

Create a deep copy of the Keypoint object.

Parameters
----------
x : None or number, optional
    Coordinate of the keypoint on the x axis.
    If ``None``, the instance's value will be copied.

y : None or number, optional
    Coordinate of the keypoint on the y axis.
    If ``None``, the instance's value will be copied.

Returns
-------
imgaug.Keypoint
    Deep copy.


result = np.zeros((len(self.keypoints), <NUM_LIT:2>), dtype=np.float32)<EOL>for i, keypoint in enumerate(self.keypoints):<EOL><INDENT>result[i, <NUM_LIT:0>] = keypoint.x<EOL>result[i, <NUM_LIT:1>] = keypoint.y<EOL><DEDENT>return result<EOL>

Convert keypoint coordinates to ``(N,2)`` array.

Returns
-------
(N, 2) ndarray
    Array containing the coordinates of all keypoints.
    Shape is ``(N,2)`` with coordinates in xy-form.


return self.deepcopy(x=x, y=y)<EOL>

Create a shallow copy of the Keypoint object.

Parameters
----------
x : None or number, optional
    Coordinate of the keypoint on the x axis.
    If ``None``, the instance's value will be copied.

y : None or number, optional
    Coordinate of the keypoint on the y axis.
    If ``None``, the instance's value will be copied.

Returns
-------
imgaug.Keypoint
    Shallow copy.