Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd methods to create various matrix types. #76
Merged
+85
−8
Conversation
|
r? @pcwalton |
src/matrix.rs
Outdated
| Div<T, Output=T> + | ||
| Sub<T, Output=T> + | ||
| NumCast + | ||
| Float>( |
This comment has been minimized.
This comment has been minimized.
pcwalton
May 27, 2015
Contributor
I wonder if we should make a trait that encompasses all of these to avoid repeating ourselves so much…
This comment has been minimized.
This comment has been minimized.
glennw
May 27, 2015
Author
Member
Good idea. I intend to do a general cleanup / refactor of this matrix class as a follow up - to make method names and the API consistent.
src/matrix.rs
Outdated
| _0.clone(), _0.clone(), _0.clone(), _1.clone()) | ||
| } | ||
|
|
||
| pub fn create_rotation(x: T, y: T, z: T, theta: T) -> Matrix4<T> { |
This comment has been minimized.
This comment has been minimized.
pcwalton
May 27, 2015
Contributor
I guess x, y, and z are supposed to be normalized here? Might want to document that.
This comment has been minimized.
This comment has been minimized.
pcwalton
May 27, 2015
Contributor
Also I'd mention that this is an axis/angle rotation in a doc comment.
| let sq = half_theta.sin() * half_theta.sin(); | ||
|
|
||
| Matrix4( | ||
| _1.clone() - _2.clone() * (yy + zz) * sq, |
This comment has been minimized.
This comment has been minimized.
pcwalton
May 27, 2015
Contributor
I'm going to assume that 1 - 2 (y² + z²) (sin(θ/2))² = x² (1 - cos θ) + cos θ (comparing against glRotate), and likewise for the others on the diagonal.
|
@pcwalton Updated to address those comments. |
pcwalton
added a commit
that referenced
this pull request
May 28, 2015
Add methods to create various matrix types.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
glennw commentedMay 27, 2015
No description provided.