Linear2D
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Wed Dec 3 02:45:18 EST 2008
I've decided to give Github a go, with a simple project containing some
routines for performing 2D linear transformations
<http://github.com/ldo/linear2d/tree>.
This takes a functional rather than procedural approach. For example, a
function to construct a matrix that maps a source rectangle to a
destination rectangle is
def MapRect(SrcRect, DstRect) :
return \
(
Matrix.translation(- SrcRect.topleft())
*
Matrix.scaling(DstRect.dimensions() / SrcRect.dimensions())
*
Matrix.translation(DstRect.topleft())
)
#end MapRect
More information about the Python-list
mailing list