-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-3941] AffineTransform.rotate(byRadians:) can be wrong #4105
Labels
Comments
Comment by Matt Rajca (JIRA) |
Comment by Matt Rajca (JIRA) Merged: swiftlang/swift#9481 |
Comment by Takafumi Akutagawa (JIRA) let point = NSPoint(x: CGFloat(10), y: CGFloat(10))
let tx: CGFloat = 20
let ty: CGFloat = -30
let radian: CGFloat = .pi / 2
var translateThenRotate = AffineTransform(translationByX: tx, byY: ty)
translateThenRotate.rotate(byRadians: radian)
print(translateThenRotate.transform(point))// output: (20.0, 30.0)
var translateThenRotate2 = NSAffineTransform()
translateThenRotate2.translateX(by: tx, yBy: ty)
translateThenRotate2.rotate(byRadians: radian)
print(translateThenRotate2.transform(point))// output: (10.0, -20.0) Should be same Test Code var translateThenRotate = AffineTransform(translationByX: 20, byY: -30)
translateThenRotate.rotate(byRadians: .pi / 2)
checkPointTransformation(translateThenRotate, point: point, expectedPoint: NSPoint(x: CGFloat(10), y: CGFloat(-20))) |
Comment by Matt Rajca (JIRA) Looks fixed in both the core libs (I added a test for this case 00562542e5a7fe6e403dba5dbbfee17a0b51673d) as well as Swift 4.0.1 on macOS. |
Foundation's AffineTransform seems to have the same issue. |
Resolved here. |
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
macOS
Additional Detail from JIRA
md5: e970db366b17d050e3e21a3f0cbd7b11
Issue Description:
Prints: {m11:0.707106781186548, m12:0.707106781186547, m21:-0.707106781186547, m22:0.707106781186548, tX:0.0, tY:0.0}
Expected Result: {m11:1.4142135623731, m12:1.41421356237309, m21:-1.41421356237309, m22:1.4142135623731, tX:0.0, tY:0.0}
I'll tell you what
The text was updated successfully, but these errors were encountered: