Placement
Placement()
Tools for placing tiles in model space
To start, add matched pairs using the addmatch method.
Then, fix tiles in model space using either the rigid
or affine methods.
addmatch(tile1, tile2, p1, p2, weight=1)
Add a pair of matching points that connect two tiles
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tile1
|
Tuple
|
tile ID in which the first point lives |
required |
tile2
|
Tuple
|
tile ID in which the second point lives |
required |
p1
|
Tuple
|
a point in tile1 that should occupy the same location in model space as... |
required |
p2
|
Tuple
|
... this point in tile2 |
required |
weight
|
float
|
an optional weighting factor for this connection |
1
|
Matching points are commonly obtained using the refine
function of `Matcher.
affine(fix=None)
Rigid solution with affine transformations
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fix
|
optional tile ID that will have unity transformation |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
afms |
Dict[Tuple, Affine]
|
a dict mapping tile IDs to |
This places all tiles in model space and returns a dictionary that maps tile IDs to affine transformations for the tile.
The inherent ambiguities in scale and overall position are resolved by enforcing the average of all tile positions to lie at (0, 0) and that the average transformation matrix is unity. This works best if the expected transformations are distributed near unity to begin with. For instance, rotations greater than 90° generally do not lead to good results, because averaging matrices is not reasonable in that case. (A theoretically better constraint might be to demand that the determinants of the transforms average to one, but that does not lead to a linear Lagrange multiplier.)
As an alternative, you can fix one of the transforms to unity
using the fix parameter. This is only recommended if every
tile is strongly connected to the fixed tile with matching
points. Otherwise, the solution will bias toward reduced scale
for tiles farther from the fixed one.
rigid(fix=None)
Rigid solution with only translation
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fix
|
optional tile ID that will have unity transformation |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
pos |
Dict[Tuple, Tuple]
|
a dict mapping tile IDs to (x,y) positions for the tile |
This places all tiles in model space and returns a dictionary that maps tile IDs to (x, y) positions for the tile.
The inherent ambiguity in overall position is resolved by enforcing the average of all tile positions to lie at (0, 0).
As an alternative, the fix parameter may be used to
specify that one particular tile lies at (0, 0).