- From: Jeff Rafter <lists@jeffrafter.com>
- Date: Mon, 07 Feb 2005 13:06:32 -0800
- To: www-svg@w3.org
I have been having trouble understanding some of the basic matrix operations in the SVG 1.1 specification. As an example I will use the operation: matrix.Scale(scaleFactor) According to the specification, it says "Post-multiplies a uniform scale transformation on the current matrix and returns the resulting matrix." [1] Without any doubt the uniform scale matrix will look like: [ scale 0 0 ] [ 0 scale 0 ] [ 0 0 1 ] We will call this matrix "scaleMatrix." My area of confusion comes when you talk about postmultiply versus premultiply. Clearly there are only two options for the operation matrix.Scale(scaleFactor): resultMatrix = scaleMatrix * matrix or resultMatrix = matrix * scaleMatrix According to Chris Liley's document[2], "Premultiply corresponds to postconcatenate and postmultiply corresponds to preconcatenate.". Then in his example he shows the following: "Alternatively, M2 may be preconcatenated with M1. This will cause M2 to be applied first: p' = M1 • M2 • p So, if "M2 is preconcatenated with M1" and in the example the places M1 to the left (pre) side of the multiplication operator, I assume this means that when a uniform scale is post-multiplied onto an existing matrix that the operation would look like: resultMatrix = scaleMatrix * matrix Or in matrices: [ scale 0 0 ] [ matrix.a matrix.c matrix.e ] [ 0 scale 0 ] * [ matrix.b matrix.d matrix.f ] [ 0 0 1 ] [ 0 0 1 ] Which results in: [ (scale * matrix.a) (scale * matrix.c) (scale * matrix.e) ] [ (scale * matrix.b) (scale * matrix.d) (scale * matrix.f) ] [ 0 0 1 ] But ASV6 and Batik do not agree with this interpretation. Clearly I must be wrong, so am I simply misunderstanding pre versus post multiply-- or is my matrix math wacky? [1] http://www.w3.org/TR/SVG/coords.html#DOMInterfaces [2] http://www.ii.uib.no/undervisning/kurs/v01/i291/i291/geom_sn.pdf Thanks, Jeff Rafter
Received on Monday, 7 February 2005 21:07:03 UTC