coordinate-transformation
How to calculate SVG transform matrix from rotate/translate/scale values?
translate(tx, ty) can be written as the matrix: 1 0 tx 0 1 ty 0 0 1 scale(sx, sy) can be written as the matrix: sx 0 0 0 sy 0 0 0 1 rotate(a) can be written as the matrix: cos(a) -sin(a) 0 sin(a) cos(a) 0 0 0 1 rotate(a, cx, cy) is the … Read more
Converting longitude/latitude to X/Y coordinate
The big issue with plotting maps is that the spherical surface of the Earth cannot be conveniently converted into a flat representation. There are a bunch of different projections that attempt to resolve this. Mercator is one of the simplest: it assumes that lines of equal latitude are parallel horizontals, while lines of equal longitude … Read more
How to make stroke width immune to the current transformation matrix
Edit: There is an attribute you can add to your rect to get exactly this behavior: vector-effect=”non-scaling-stroke” This was wrong: This will work if you apply the transform directly to the shape, not the group it is in. Of course, if you wanted to group several items and scale them all together, that approach won’t … Read more
Blender: Walk around sphere
The consensus seems to be that you should accomplish such rotations using quaternions. See this for the api: http://www.blender.org/documentation/249PythonDoc/Mathutils.Quaternion-class.html See this for an introduction to the maths: http://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions#Quaternions
How to set transform origin in SVG
To rotate use transform=”rotate(deg, cx, cy)”, where deg is the degree you want to rotate and (cx, cy) define the centre of rotation. For scaling/resizing, you have to translate by (-cx, -cy), then scale and then translate back to (cx, cy). You can do this with a matrix transform: transform=”matrix(sx, 0, 0, sy, cx-sx*cx, cy-sy*cy)” … Read more