Closed sgillies closed 8 years ago
This PR has the __mul__
bug fix found by @ToddSmall and also gets the right-handed sense of rotation right. Here's a 90 degree ccw rotation of a unit vector example using numpy:
>>> from affine import Affine
>>> import numpy as np
>>> am = np.array(Affine.rotation(90.0)).reshape(3,3)
>>> am
array([[ 0., -1., 0.],
[ 1., 0., 0.],
[ 0., 0., 1.]])
>>> point = np.array([1.0, 0.0, 1.0])
>>> np.dot(am, point)
array([ 0., 1., 1.])
/cc @perrygeo @ToddSmall @mwtoews
Looks good. Here is one suggestion to consider for affine/__init__.py
, line 229:
:param angle: Rotation angle in degrees, counter-clockwise about the pivot.
@sgillies Looks great - it's nice to have the rotation direction defined explicitly.
Could we also add @ToddSmall's test for associativity? https://github.com/sgillies/affine/pull/24/files#diff-3ebc029e55f312af9ae346c6433cd770R364
The dot product of a rotation matrix and vector was right, but separately these were wrong.