# Centroid Transforms For ZPL II Language

**Nathaniel Nesler**Jul 26, 2016 12:51 PM

Hello Support,

Our company has a label designer built into our over all software solution. We are using the commonly used technique of transform matrices for doing position, rotation, and scale for text and barcode objects. We are setting the upper left corner of the text or barcode as our centroid pivot point for the transform operations, however when we pass these correct position values into ZPL language with the rotation tag of N, R, I, or B a standard centroid point is not maintained and the position printed is not as expected. It seems that the centroid is changing for each and every rotation point along each 90 degree rotation. We are also encountering an issue with the ^BY scaling tag where when scaling the centroid point is at a different position than the rotation points. So far the behavior we are getting is a different centroid position for each mathematical operation for each rotational position.

Is there a setting in ZPL where we can set the centroid point for rotations, positions, and scaling? If there is not a way of setting the centroid position for transform operations then we will have to derive a formula for each rotation position with respect to position and scaling. Is there any other tags that could change the position of a barcode or a text element other than that of scaling and rotating? I ask because I do not want to redevelop these algorithms over and over again if other things need to be included in my formula for these calculations. The end result should be what we position on the screen should match what gets printed.

Matrix Transforms Mathematics:

Euler Rotations:

Euler angles - Wikipedia, the free encyclopedia

Euler Angles -- from Wolfram MathWorld

Quaternion Rotations:

Quaternions and spatial rotation - Wikipedia, the free encyclopedia

Changing the barcode from I to R, N, B will help illustrate the issue of the changing centriod. Also changing the value on the BY tag from 4 to another number will also illustrate the position changing as the scale changes in a completely different centroid position and direction.

^XA

^LH0,0^LRN

^FO100,403

^BY4^BCI,300,Y,N

^FDSDGAD_0100001323^FS

^FT75,901

^A0B,100,100

^FH^FDSTUFF^FS

^XZ

Cheers,

Nathaniel Nesler