Skip to content
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

vec2 and mat2 #27

Merged
merged 20 commits into from
May 3, 2012
Merged

vec2 and mat2 #27

merged 20 commits into from
May 3, 2012

Conversation

sinisterchipmunk
Copy link
Collaborator

Some operations to assist in 2D operations. I'm fairly new to 2D so hopefully this is of use. I'll understand if this pull request is rejected. :)

Adds the following, which function the same as their vec3/mat4 counterparts, as well as corresponding tests:

vec2.create
vec2.add
vec2.subtract
vec2.multiply
vec2.divide
vec2.scale
vec2.dist
vec2.set
vec2.negate
vec2.normalize
vec2.cross
vec2.length
vec2.dot
vec2.direction
vec2.lerp
vec2.str
mat2.create
mat2.set
mat2.identity
mat2.transpose
mat2.determinant
mat2.inverse
mat2.rotate
mat2.scale
mat2.str
mat2.multiply
mat2.multiplyVec2
mat3.multiplyVec2

@toji
Copy link
Owner

toji commented May 3, 2012

Looks great! The only one that I somewhat question is the vec2.cross, but you've been pretty thorough about explaining where the logic from that one comes from.

toji added a commit that referenced this pull request May 3, 2012
@toji toji merged commit 9c117cb into toji:master May 3, 2012
@sinisterchipmunk
Copy link
Collaborator Author

Thanks :) My first impulse was to have vec2.cross always return a vec3 but since two components are guaranteed to be zero, I thought having the option of receiving a scalar would be more useful from a performance perspective.

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