[Ipe-discuss] Ellipse: transformation matrix must be transposed?

Otfried Cheong ipe at otfried.org
Sun Aug 27 21:52:54 CEST 2023


On Wed, Aug 23, 2023, at 07:23, Pennings, Gijs via Ipe-discuss wrote:
> I'm using IPE to draw ellipses, but I don't fully understand the path 
> representation.
>
> Consider the ellipse described by x^2/4 + y^2/36 = 1, and rotate it 
> counterclockwise by pi/6. Then, we compute the transformation matrix by 
> multiplying the rotation matrix with the scale matrix (the operations 
> are applied right to left). I find A = ((1.732, -3), (1, 5.196)). This 
> seems correct; see the attached screenshot.
>
> However, to get the desired result in IPE, it seems that this matrix 
> must be transposed (i.e., specified as the path "1.732 1 -3 5.196 0 0 
> e"). Otherwise, the ellipse isn't rotated (since rotation would be 
> applied first, which has no effect on a unit circle?).
> Is this observation correct and is it intended behavior? 

Your observation is indeed entirely correct - but there is a very simple explanation.

The PDF (or Postscript) format for a matrix is a sequence of six numbers a b c d tx ty,
which represent that linear transformation
x' = a x + c y + tx
y' = b x + d y + ty
(See Section 4.2.3 Transformation Matrices in the PDF reference manual.)

Ipe uses the same format (so that we don't have to distinguish between writing to XML and writing to PDF), so the path specification "1.732 1 -3 5.196 0 0 e" uses exactly the matrix A you computed correctly.

This clearly needs to be added to the manual somewhere!

Otfried


More information about the Ipe-discuss mailing list