Utility functions for processing diagram element transformations
"""
Sets the rotation part so that the base vectors defined by `u=[sx shx]` and `v=[shy sy]`
are of length `scale`. This effectively sets the scaling of the elements without
touching their rotation/shear.
`su = scale / |u|`
`sv = scale / |v|`
`[sx shy tx] => [su*sx sv*shy tx]`
`[shx sy ty] [su*shx sv*sy ty]`
"""
withScale scale (Position sx shx shy sy tx ty) = Position sx' shx' shy' sy' tx ty
where
su = scale / (sqrt (sx*sx + shx*shx))
sv = scale / (sqrt (shy*shy + sy*sy))
sx' = sx * su
shx' = shx * su
shy' = shy * sv
sy' = sy * sv
//-----------------------------------------------------------------------------
// Front-end for performing diagram element scaling
"""
Performs the affine transformation encapsulated by `transformer` for each specified diagram diagram in `elements`
"""
transformElements :: (Position -> Position) -> [Resource] -> <WriteGraph> ()
Edited by Tuukka Lehtonen