# Overlap Measure

Aus de_evolutionary_art_org

Is it possible to make an overlap measure that can be computed given the result pattern image and the command list without the intermediate steps?

Sketch of an induction prove that this is possible for the case that only one prototile type exists and for the case that n > 1 prototile types exists.

**Case 1**: __One prototile type__

__Given:__

- one prototile in an image $S with width $w_S and height $h_S on a transparent background with no borders;

- number of pixel in $S: $wh_S = $w_S * $h_S

- number of non-transparent pixel in $S: $s

- Pattern image $P with width $w_P and height $h_P

- number of pixel in $P: $wh_P = $w_P * $h_P

- command list with m 5-tuples ($S, $r, $m, $x, $y)

__Countable:__

- number of transparent pixel in $P in step t: $gap_t

- number of non-transparent pixel in $P in step t: $p_t

__Compute:__

- number of non-transparent pixel in $P in step t that are covered more than one time: $overlap_t

__Compositing process:__

- step 0: $P is still empty => $gap_0 = $wh_P and $overlap_0 = $p_0 = 0

- step 1: $S is composed over $P according to the first 5-tuple => $gap_1 = $wh_P - $s and $overlap_1 = 0 and $p_1 = $s

- step 2: $S is composed over $P according to the second 5-tuple: $overlap_2 = 2 * $s - $p_2

...

- step k: $S is composed over $P according to the k'th 5-tuple: $overlap_k = k * $s - $p_k

...

- step m: $S is composed over $P according to the m'th 5-tuple: $overlap_m = m * $s - $p_m

**Case 2**: __n > 1 prototile types__

__Given:__

- A set of n > 1 different prototile types @S = ($S_i | i = 1, …, n) with width $w_S_i and height $h_S_i each on a transparent background with no borders

- number of pixel in $S_i: $wh_S_i = $w_S_i * $h_S_i

- number of non-transparent pixel in $S_i: $s_i

- Pattern image $P with width $w_P and height $h_P

- number of pixel in $P: $wh_P = $w_P * $h_P

- command list with m 5-tuples ($S_i, $r, $m, $x, $y). From the command list the sequence @C_S = ($S_i_j | j = 1, …, m) of prototiles is extracted as the list of shapes that will be step by step composed.

__Countable:__

- number of transparent pixel in $P in step t: $gap_t

- number of non-transparent pixel in $P in step t: $p_t

__Compute:__

- number of non-transparent pixel in $P in step t that are covered more than one time: $overlap_t

__Compositing process:__

- step 0: $P is still empty => $gap_0 = $wh_P and $overlap_0 = $p_0 = 0

- step 1: $S_i_1 is composed over $P according to the first 5-tuple: $p_1 = $s_i_1 and $overlap_1 = 0

- step 2: $S_i_2 is composed over $P according to the second 5-tuple: $overlap_2 = ($s_i_1 + $s_i_2) - $p_2

...

- step k: $S_i_k is composed over $P according to the k'th 5-tuple: $overlap_k = ($s_i_1 + ... + $s_i_k) - $p_k

...

- step m: $S_i_m is composed over $P according to the m'th 5-tuple: <math> $overlap_m = \sum_{j=1}^{m}$s_i_j - $p_m </math>