Skip to content

Conversation

@ronhippler
Copy link

No description provided.

@malgorithms
Copy link
Owner

I think the change to transformVec is wrong:

transformVec: (a) ->
     # transforms a 2-item array in place
    @transformPair(a[0], a[1])

It wouldn't change it "in place" as the function is supposed to do. transformVec is supposed to modify the array that's passed to it, not return the result.

Here's the original:

transformVec: (a) ->
     # transforms a 2-item array in place
    t0 = @m00 * a[0] + @m01 * a[1] + @v0
    t1 = @m10 * a[0] + @m11 * a[1] + @v1
    a[0] = t0
    a[1] = t1

If you want it to return the modified array, you could add one more line to the bottom setting the return value to the input.

@ronhippler
Copy link
Author

yes i know. I tried it again and now it works, don't know what I missed first.

@ronhippler
Copy link
Author

now its again in place and the summery is fixed.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused about this change. The printout says "scale = " and then it was previously printing getXScale() and getYScale(), but after your change it says "scale =" and then prints the center. Can you explain?

@ronhippler
Copy link
Author

There is no function getXScale(), so I thought it was a typo. But now I think its unnecessary or rather not possible to print the scale from the matrix. Wouldn't it be better to leave the printing of the scale?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants