Diagrams defines the core library of primitives forming the basis of an embedded domain-specific language for describing and rendering diagrams. General (affine) transformations, represented by an invertible linear map, its transpose, and a vector representing a translation component. By the transpose of a linear map we mean simply the linear map corresponding to the transpose of the map's matrix representation. For example, any scale is its own transpose, since scales are represented by matrices with zeros everywhere except the diagonal. The transpose of a rotation is the same as its inverse. The reason we need to keep track of transposes is because it turns out that when transforming a shape according to some linear map L, the shape's normal vectors transform according to L's inverse transpose. (For a more detailed explanation and proof, see https://wiki.haskell.org/Diagrams/Dev/Transformations.) This is exactly what we need when transforming bounding functions, which are defined in terms of perpendicular (i.e. normal) hyperplanes. Transformations are closed under composition, t1 <,>, t2 is the transformation which performs first t2, then t1. Apply a transformation to a vector. Note that any translational component of the transformation will not affect the vector, since vectors are invariant under translation. Create a general affine transformation from an invertible linear transformation and its transpose. The translational component is assumed to be zero. Produce a default basis for a vector space. If the dimensionality of the vector space is not statically known, see basisFor. Get the dimension of an object whose vector space is an instance of HasLinearMap, e.g. transformations, paths, diagrams, etc. Get the matrix equivalent of the linear transform, (as a list of columns) and the translation vector. This is mostly useful for implementing backends. Convert the linear part of a Transformation to a matrix representation as a list of column vectors which are also lists. Convert a `Transformation v` to a homogeneous matrix representation. The final list is the translation. The representation leaves off the last row of the matrix as it is always [0,0, ... 1] and this representation is the defacto standard for backends. Determine whether a Transformation includes a reflection component, that is, whether it reverses orientation. HasLinearMap is a poor man's class constraint synonym, just to help shorten some of the ridiculously long constraint sets. TAttributes are transformed directly, MAttributes have their local scale multiplied by the average scale of the transform. Plain Attributes are unaffected. The Transformable instance for Prim just pushes calls to transform down through the Prim constructor. TransInv is a wrapper which makes a transformable type translationally invariant, the translational component of transformations will no longer affect things wrapped in TransInv. Most transformations are specific to a particular vector space, but a few can be defined generically over any vector space. Source.


Яндекс.Метрика Рейтинг@Mail.ru Free Web Counter
page counter
Last Modified: April 18, 2016 @ 2:09 am