Minor comments/formatting/imports cleanup
This commit is contained in:
parent
44ab57cb43
commit
c92771a2ae
3 changed files with 10 additions and 25 deletions
22
src/mat.rs
22
src/mat.rs
|
@ -1,7 +1,5 @@
|
|||
use std::cmp::FuzzyEq;
|
||||
use cmp::Eq;
|
||||
use ops::{Neg, Index};
|
||||
// use to_str::ToStr;
|
||||
use math::Sqrt;
|
||||
use quat::Quat;
|
||||
use vec::*;
|
||||
|
@ -47,7 +45,7 @@ pub trait Matrix3<V3> {
|
|||
// 4x4 Matrix
|
||||
//
|
||||
pub trait Matrix4<V3, V4> {
|
||||
pure fn scale(vec: &V3) -> self; // I don't like the use of `Vec3` here
|
||||
pure fn scale(vec: &V3) -> self;
|
||||
pure fn translate(vec: &V3) -> self;
|
||||
}
|
||||
|
||||
|
@ -475,22 +473,22 @@ pub impl Mat3: FuzzyEq {
|
|||
pub struct Mat4 { data:[Vec4 * 4] }
|
||||
|
||||
pub const mat4_zero :Mat4 = Mat4 { data: [ vec4_zero,
|
||||
vec4_zero,
|
||||
vec4_zero,
|
||||
vec4_zero ] };
|
||||
vec4_zero,
|
||||
vec4_zero,
|
||||
vec4_zero ] };
|
||||
pub const mat4_identity :Mat4 = Mat4 { data: [ vec4_unit_x,
|
||||
vec4_unit_y,
|
||||
vec4_unit_z,
|
||||
vec4_unit_w ] };
|
||||
vec4_unit_y,
|
||||
vec4_unit_z,
|
||||
vec4_unit_w ] };
|
||||
|
||||
//
|
||||
// Mat4 Constructor
|
||||
//
|
||||
#[inline]
|
||||
pub pure fn Mat4(m00:float, m01:float, m02:float, m03:float,
|
||||
m10:float, m11:float, m12:float, m13:float,
|
||||
m20:float, m21:float, m22:float, m23:float,
|
||||
m30:float, m31:float, m32:float, m33:float) -> Mat4 {
|
||||
m10:float, m11:float, m12:float, m13:float,
|
||||
m20:float, m21:float, m22:float, m23:float,
|
||||
m30:float, m31:float, m32:float, m33:float) -> Mat4 {
|
||||
Mat4 { data: [ Vec4(m00, m01, m02, m03),
|
||||
Vec4(m10, m11, m12, m13),
|
||||
Vec4(m20, m21, m22, m23),
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
use std::cmp::FuzzyEq;
|
||||
use cmp::Eq;
|
||||
use ops::{Neg, Index};
|
||||
use to_str::ToStr;
|
||||
use math::Sqrt;
|
||||
use mat::{Mat3, Mat4};
|
||||
use vec::Vec3;
|
||||
|
||||
// TODO: Unittests
|
||||
|
||||
//
|
||||
// Quaternion
|
||||
//
|
||||
|
@ -204,9 +200,6 @@ pub impl Quat: FuzzyEq {
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Convert To String
|
||||
//
|
||||
pub impl Quat: ToStr {
|
||||
pure fn to_str() -> ~str {
|
||||
fmt!("Quat[ %f, %f, %f, %f ]", self.w, self.x, self.y, self.z)
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
use std::cmp::FuzzyEq;
|
||||
use cmp::Eq;
|
||||
use ops::{Neg, Index};
|
||||
use math::{Abs, abs, min, max, Sqrt};
|
||||
use to_str::ToStr;
|
||||
|
||||
//
|
||||
// N-dimensional Vector
|
||||
|
@ -234,10 +232,6 @@ pub impl Vec3: Vector3<float> {
|
|||
(self[2] * other[0]) - (self[0] * other[2]),
|
||||
(self[0] * other[1]) - (self[1] * other[0]))
|
||||
}
|
||||
|
||||
// #[inline] static pure fn unit_x() -> Vec3 { Vec3(1f, 0f, 0f) }
|
||||
// #[inline] static pure fn unit_y() -> Vec3 { Vec3(0f, 1f, 0f) }
|
||||
// #[inline] static pure fn unit_z() -> Vec3 { Vec3(0f, 0f, 1f) }
|
||||
}
|
||||
|
||||
pub impl Vec3: Vector<float> {
|
||||
|
|
Loading…
Reference in a new issue