All visible elements in a structure (or document) are held by transforms. Transforms itself are not directly visible. However, the pivot of the Manipulation Tools indicates the location of a transform in the structure. Transforms in smile2 are responsible for placing elements in the structure .
Each transform can contain a leaf that holds the visible part of an object (in local coordinates), eg. a polygon. It can also contain references to other transforms as children. In this manner, the ‘visible’ part of smile2 documents are built up from a hierarchical structure of transform nodes.
References of each transform can be placed as a child in more than one “parent* transform. Here care has to be taken that, a transform is not at the same time it’s parent and child, since this would lead to an infinite recursion. Therefore, mathematically spoken, transforms form a directed acyclic graph. A consequence of this, is that the absolute location of an element cannot be determined from a single transform, but only from a path of transforms.
More about the working principle of transforms can be found in the plugs chapter.
Transforms have in total 6 (linearly independent) parameters to set the position, size, and orientation of an object . Additionally, transforms node have an additional (relative) translation parameter, called origin.
The main output of a transform is a 3x3 matrix, computed in the following way:
where, T is the translation matrix, TO the local origin translation, TOC an internal origin compensation translation , R the rotation, S*shear* the shear matrix, and Sscale the scale matrix. In detail:
▷ niceName (⇨ wstring) ,
▷ translation (⇨ vec2) ,
The translation, relative to the transforms parent (in “parent” coordinates).
▷ scale (⇨ vec2) ,
The scale, relative to the transforms local axes.
▷ rotation (⇨ double) ,
The rotation, relative to the transforms parent axes.
▷ shear (⇨ double) ,
The shear, relative to the transforms local axes.
▷ origin (⇨ vec2) ,
A shift of the origin, in local (object) coordinates.
▷ visible (⇨ bool) ,
If on the leaf and all children are visible, if off the leaf and all children are hidden (And not exposed as well).
- Overwrite child layer
▷ overwriteLayer (⇨ bool) ,
If on, the layer from this (topmost) transform determines the layer membership of the instance (or transform path).
If off, the layer membership is defined by the root transform.
This option has only effect, if the hierarchy depth is >=2 and child and parent have a different layer membership.
Deriving from Transform¶
Usually it is not necessary to derive from this class. However, if you think it is, please let us know about your user case.
The following methods can be overwritten in a subclass;
|||If you are familiar with GDSII: smile2s Transforms compare best to GDSIIs SREF.|
|||Internally, transformations are described in 3-dimensional space.|
|||This translation is necessary to keep things “at the same place”, whenever the origin is changed with non trival rotation/scale/shear parameters already applied. This translation is fully managed “under the hood”.|