I'm guessing how to adapt this to qgsAffine, butTo use the results are odd. The tool's "Undo" button is brokenqgsAffine tool, so it is difficultyou need to get an understandingunderstand where the values of what's going onthe matrix flow to. HereA good spreadsheet template is what I'm tryingalso required to do pre-calculations. The qgsAffine dialog looks something like this:
X Y
+---+---+
Scale | a | e |
+---+---+
Rotation | d | b |
+---+---+
Translation | c | f |
+---+---+
where:
- a : cos(θ)
- b : -sin(θ)
- c : x0 - cos(θ) * x0 + sin(θ) * y0
- d : sin(θ)
- e : cos(θ)
- f : y0 - sin(θ) * x0 - cos(θ) * y0
For example, if you want to rotate a polygon 30° clockwise around 42°S, 174°E, here are your inputs to your spreadsheet:
- x0 = 174; 174
- y0 = -42; 42
- θ=-30 degrees or -0.523598776 radians
- Scale X = 1
Then, copy/paste the results from a spreadsheet to the right box. Using the tab order in the from the dialog:
- Scale Y = 1a : 0.866025404
- Rotation X =d : -0.5235987765
- Rotation Y = 0c : 44.52359877631157974
- Translation X = x0 - cos(θ) * x0 + sin(θ) *e y0 = 44: 0.31157974866025404
- Translation Y = y0 - sin(θ) * x0b - cos(θ) *: 0.5
- f y0 =: 81.37306696
But the offsets are slightly off, and I can't figure it out. I would trust the
The same example from PostGIS method though.would look something like:
SELECT ST_Rotate(geom, -30*pi()/180, 174.0, -42.0)