### 2D Local Parameters instead of Offsets

Edge and offset local space addressing as discussed in the previous post introduces is redundant whereby two operations from the opposite edges produce the same result. For example you could either take edge 0 or 2 and count parameter from the other end (1-p for edge 2) and use the same offset to locate the same position.

We introduce several local addressing modes based on x and y coordinates. This is intuitive and directly maps to the xz plane in 3D world.

#### Corner-based Addressing/Parametrisation

We have the concept of a corner instead of a vertex, because vertex refers to the geometric rather than semantic element. For instance there could be an arbitrary number of vertices between some two corners – depending on the geometric detail.

##### 2×2 Grid Case

Let us again return to the previous post where the symmetry is achieved by labelling edges. All operations including offset are mapped to achieve symmetry against x and y axes.

Instead we map the local coordinates to [0..1], based on the proximity to the corner of iregion.

Hence **origin** is *the nearest iregion corner.*

Above we see the 2×1 (or top of the 2×2) grid. The circles (tree ground areas) are placed at (0.8, 0.1), where the origin is top left corner for first cell and top right corner for the second cell.

This way we can easily place items symmetrically in all quadrants of the 2×2 grid. For now we will ignore the cases where park centres are larger the path junctions.

##### 3xn Grid Case

In the case of the 3×2 grid the question is what to do with the subregions in the middle? Or even grids of the higher dimensions, or the odd ones?

We have two approaches:

- To apply a different rule (number 2) to the middle row elements

(will deal in the next section of edge parametrisation) - Automatically adjust the erroneous coordinate – one of x axis in the case above.

Let us consider the second approach. Then there are four options:

- No centre axis coordinates. In x axis case (picture above) x coordinates are mapped to the centre – the blue circle in the top middle cell.
- Extended right. The coordinates are extended left to right as seen in the middle block below. Because the rules tells us to draw at (0.8, 0.1) and current cell coordinates are out of the range – nothing is drawn
- Extend left. The opposite of the above case.
- Local to right. Also left to right but the counter is reset. In this case the left most block duplicated. Here symmetry is broken so this technique is not favourable.

Auto-centering axis as in (1) may result in park like this:

However this is too of a simple example and with a few elements there maybe a conflict where they are nested together.

##### 4xn Grid Case

Again we consider x axis, operations for y axis can be adapted appropriately.

- Pair mirror. Simply repeat the 2-cell pairing.
- Mirror against centre. Repeat the boundary elements to the centre.
- Extended addressing. The rule that draws to (0.8, 0.1) will not draw anything, but another rule can be used to draw there.

#### Edge-based Addressing

Automatic symmetry is the most desired solution as it does not require different treatment of the cell depending on the position, however I anticipate that it is hard to achieve it correctly, especially with a large number of elements.

Now we consider perhaps a more practical approach that takes into account symmetry, where each of the cells that are not symmetric to each other are considered separately. Each cell type will have a different set of rules, perhaps using a case/switch statement.

In 3×3 grid as considered below there are 4 different types of cells. Type 2a and 2b may be different without violating symmetry constraints – both types have a single boundary edge, one lays on the x and the other on the y axes.

The number in the picture is used to count the boundary relations or a boundary metric distance.

A 4×4 grid can also have 4 different classes and 4 types as the four cells in the middle should be symmetric with each other.

For grids of higher degree the number elements is certainly higher. For example 5×5 grid may have 9 different regions and 6 boundary metric distance classes (2, 3 and 5 may be doubled).

It is possible to have various scenarios where symmetry has to be complied with, but perhaps it would often be easier to use a recursive application of grid rule. In an example below complicated conditional testing for 4×4 grid – it is easier to just use 3×3 grid and nested grids 1×2 for A and 2×2 grid for B.

##### Boundary Metric

In addition to corner-based addressing we require indexing of the whole cell based on their type.

Elements of the same type are symmetrically identical – under {x, y} mirror and translate operations.

All elements of one type shall have the same boundary metric index which is a 2-vector value (or attribute) – *least distance to the iregion boundary*.

Index of the corner cells is (0, 0). Corner values also have two edges lying on (coinciding with?) the iregion boundary.

Index of the cells grows as they get further away from the iregion corners. For instance top left cell is at index (0, 0), cell (1, 0) is directly *to the right* and cell (0, 1) is directly *downwards*, as can be seen on the picture below. Type index is in fact Distance from Outer Edge (DOE).

The concept of symmetry is upheld, in that is the indexes only grow as high as the middle of the grid in terms of x and y axes and decrease as you go further away from the middle.