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

Add methods to create various matrix types. #76

Merged
merged 1 commit into from May 28, 2015
Merged

Conversation

@glennw
Copy link
Member

glennw commented May 27, 2015

No description provided.

@glennw
Copy link
Member Author

glennw commented May 27, 2015

Div<T, Output=T> +
Sub<T, Output=T> +
NumCast +
Float>(

This comment has been minimized.

@pcwalton

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.

@glennw

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.

_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.

@pcwalton

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.

@pcwalton

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.

@pcwalton

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.

@glennw
Copy link
Member Author

glennw commented May 28, 2015

@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.
@pcwalton pcwalton merged commit 270d024 into servo:master May 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.