Closed matthewphilyaw closed 8 years ago
Vec2d.rotate here I believe is slightly off.
I believe it should be this for CCW, but I'm not 100% sure according to this here.
def rotate( a, theta) do { x,y } = a ct = :math.cos(theta) st = :math.sin(theta) { x*ct - y*st, x*st + y*ct } # this line changed end
The issue I'm having is that Graphmath.rotate({0,1}, :math.pi) produces {0,1} instead of {0,-1}.
Graphmath.rotate({0,1}, :math.pi)
Reviewing the tests, I noticed there is no case for testing the y axis, so adding something like this
@tag :vec2 @tag :rotate test "rotate( {0,1}, :math.pi) returns {0,-1}" do {x,y} = Graphmath.Vec2.rotate( {0,1}, :math.pi) assert {0,-1} == { Float.round(x,6), Float.round(y,6)} end
should fail. I can issue a PR for it, tomorrow just noting it. Again maybe completely wrong, not exactly the strongest in math.
This is addrssed in PR #9
PR #9 fixed this. :)
Vec2d.rotate here I believe is slightly off.
I believe it should be this for CCW, but I'm not 100% sure according to this here.
The issue I'm having is that
Graphmath.rotate({0,1}, :math.pi)
produces {0,1} instead of {0,-1}.Reviewing the tests, I noticed there is no case for testing the y axis, so adding something like this
should fail. I can issue a PR for it, tomorrow just noting it. Again maybe completely wrong, not exactly the strongest in math.