Update formatting
This commit is contained in:
parent
64ae5fbd9a
commit
7c11ec250a
7 changed files with 170 additions and 173 deletions
|
@ -133,7 +133,7 @@ Matrix3<S> {
|
||||||
pub fn from_angle_x(theta: Rad<S>) -> Matrix3<S> {
|
pub fn from_angle_x(theta: Rad<S>) -> Matrix3<S> {
|
||||||
// http://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations
|
// http://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations
|
||||||
let (s, c) = sin_cos(theta);
|
let (s, c) = sin_cos(theta);
|
||||||
Matrix3::new(one(), zero(), zero(),
|
Matrix3::new( one(), zero(), zero(),
|
||||||
zero(), c.clone(), s.clone(),
|
zero(), c.clone(), s.clone(),
|
||||||
zero(), -s.clone(), c.clone())
|
zero(), -s.clone(), c.clone())
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ Matrix3<S> {
|
||||||
pub fn from_angle_z(theta: Rad<S>) -> Matrix3<S> {
|
pub fn from_angle_z(theta: Rad<S>) -> Matrix3<S> {
|
||||||
// http://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations
|
// http://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations
|
||||||
let (s, c) = sin_cos(theta);
|
let (s, c) = sin_cos(theta);
|
||||||
Matrix3::new(c.clone(), s.clone(), zero(),
|
Matrix3::new( c.clone(), s.clone(), zero(),
|
||||||
-s.clone(), c.clone(), zero(),
|
-s.clone(), c.clone(), zero(),
|
||||||
zero(), zero(), one())
|
zero(), zero(), one())
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ Matrix3<S> {
|
||||||
let (sy, cy) = sin_cos(y);
|
let (sy, cy) = sin_cos(y);
|
||||||
let (sz, cz) = sin_cos(z);
|
let (sz, cz) = sin_cos(z);
|
||||||
|
|
||||||
Matrix3::new(cy * cz, cy * sz, -sy,
|
Matrix3::new( cy * cz, cy * sz, -sy,
|
||||||
-cx * sz + sx * sy * cz, cx * cz + sx * sy * sz, sx * cy,
|
-cx * sz + sx * sy * cz, cx * cz + sx * sy * sz, sx * cy,
|
||||||
sx * sz + cx * sy * cz, -sx * cz + cx * sy * sz, cx * cy)
|
sx * sz + cx * sy * cz, -sx * cz + cx * sy * sz, cx * cy)
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ Matrix4<S> {
|
||||||
let s = f.cross(up).normalize();
|
let s = f.cross(up).normalize();
|
||||||
let u = s.cross(&f);
|
let u = s.cross(&f);
|
||||||
|
|
||||||
Matrix4::new(s.x.clone(), u.x.clone(), -f.x.clone(), zero(),
|
Matrix4::new( s.x.clone(), u.x.clone(), -f.x.clone(), zero(),
|
||||||
s.y.clone(), u.y.clone(), -f.y.clone(), zero(),
|
s.y.clone(), u.y.clone(), -f.y.clone(), zero(),
|
||||||
s.z.clone(), u.z.clone(), -f.z.clone(), zero(),
|
s.z.clone(), u.z.clone(), -f.z.clone(), zero(),
|
||||||
-eye.dot(&s), -eye.dot(&u), eye.dot(&f), one())
|
-eye.dot(&s), -eye.dot(&u), eye.dot(&f), one())
|
||||||
|
|
|
@ -125,9 +125,6 @@ ApproxEq<S> for Plane<S> {
|
||||||
impl<S: Clone + fmt::Float> fmt::Show for Plane<S> {
|
impl<S: Clone + fmt::Float> fmt::Show for Plane<S> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f.buf, "{:f}x + {:f}y + {:f}z - {:f} = 0",
|
write!(f.buf, "{:f}x + {:f}y + {:f}z - {:f} = 0",
|
||||||
self.n.x,
|
self.n.x, self.n.y, self.n.z, self.d)
|
||||||
self.n.y,
|
|
||||||
self.n.z,
|
|
||||||
self.d)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue