[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft] python_freetype Design: Vector & Matrix Operations
From: |
Lawrence D'Oliveiro |
Subject: |
Re: [ft] python_freetype Design: Vector & Matrix Operations |
Date: |
Sun, 15 Feb 2015 11:34:21 +1300 |
I’ve been wondering why FreeType uses only 2×2 matrices, so it has to
express translations with a separate vector. It is common in
graphics libraries to use homogeneous matrices (3×3 for 2D, 4×4 for 3D)
so all linear transformations can be encapsulated in a single matrix.
I know FreeType can’t handle non-affine transformations—presumably
that is by design. But you could do what PostScript did, and have a 3×2
matrix that can only express affine transformations.
In any case, I’m thinking of changing my Python binding so its Matrix
type becomes a homogeneous 3×3 matrix. Then my wrapper methods will
decompose this into a non-homogeneous matrix and a separate vector, as
appropriate (and simply discard any non-affine part).
And maybe make my Vector type homogeneous as well...
Thoughts?