# PyNomo transformations

In PyNomo, scales and blocks are first built and transformation is applied in the final stage. This approach is due to the idea, that blocks should be easy to align with respect to each other. If tranformations are applied to individual blocks, one has to be careful that scalings of the aligned blocks still match. Only block of type 9 can be transformed initially. In retaining wall example transformation is applied initially to the block.

In general translations, rotations, shear and projective transformations can be applied to the nomograph. PyNomo does not support transformations yet extensively, but has only limited number of transformations available.

Transformation is applied in the final definion (dict) of nomograph (main_params below):

...
# define nomograph
main_params={
'filename':'filename_of_nomograph.pdf',
'block_params':[block_1,block_2],
'transformations':[('scale paper',)],    # <-- HERE are transformations as a list of tuples
}
# create nomograph
Nomographer(main_params)

Transformation are applied from "left" to the "right" in the list.

## Transformations

The following transformations are implemented:

### 'scale paper'

This transformation scales the nomograph to the defined paper size in 'paper_height' and 'paper_width'. An example:

...
# define nomograph
main_params={
...
'paper_height':20.0,
'paper_width':20.0,
'transformations':[('scale paper',)],
}
# create nomograph
Nomographer(main_params)

### 'rotate'

This transformation rotates the nomograph the given angle in degrees. This is often used in examples in order to make angles definite for axis title directions (to be corrected later). An example:

...
# define nomograph
main_params={
...
'transformations':[('rotate',10)], # rotates nomographs 10 degrees
}
# create nomograph
Nomographer(main_params)

### 'polygon'

'Polygon' transformation is explained best with the following figure. Imagine green line drops from above vertically until hits one one scale (top left point). After polygon rotates smallest angle before hitting second point. These defines top two points. Same applies for red line come up and defining two additional points. These four points are transformated to the corners of rectangle as illustrated in bottom picture. It is to be noted as example that the straing (purple) index line passes same points at both figures.

An example:

...
# define nomograph
main_params={
...
'transformations':[('polygon',)], # does polygon transformation
}
# create nomograph
Nomographer(main_params)

### 'optimize'

'Optimize' transformation finds transformation that optimizes numerically sum squared lengths of axes with respect to paper area. This has not turned out to be very much used transformation. It is also slow currently.

An example:

...
# define nomograph
main_params={
...
'transformations':[('optimize',], # does optimize transformation
}
# create nomograph
Nomographer(main_params)