Merge pull request #139 from bjz/update

Update for rustc 0.13.0-nightly
This commit is contained in:
Brendan Zabarauskas 2014-11-16 02:03:07 +11:00
commit ce4ec62798
9 changed files with 13 additions and 5 deletions

View file

@ -16,7 +16,7 @@
//! Angle units for type-safe, self-documenting code.
use std::fmt;
use std::num::{One, one, Zero, zero, cast};
use std::num::{One, one, Zero, zero, cast, Float};
use approx::ApproxEq;
use num::BaseFloat;

View file

@ -14,6 +14,7 @@
// limitations under the License.
use std::num;
use std::num::Float;
pub trait ApproxEq<T: Float> {
fn approx_epsilon(_hack: Option<Self>) -> T {
@ -34,7 +35,7 @@ macro_rules! approx_float(
impl ApproxEq<$S> for $S {
#[inline]
fn approx_eq_eps(&self, other: &$S, epsilon: &$S) -> bool {
num::abs(*self - *other) < *epsilon
(*self - *other).abs() < *epsilon
}
}
)

View file

@ -17,6 +17,7 @@ use approx::ApproxEq;
use std::cmp;
use std::fmt;
use std::num::{FloatMath, Int, Primitive};
/// A trait providing a [partial ordering](http://mathworld.wolfram.com/PartialOrder.html).
pub trait PartialOrd {

View file

@ -15,7 +15,7 @@
use std::fmt;
use std::mem;
use std::num::{zero, one, cast};
use std::num::{zero, one, cast, Float};
use angle::{Angle, Rad, acos, sin, sin_cos, rad};
use approx::ApproxEq;
@ -266,7 +266,7 @@ impl<S: BaseFloat> Quaternion<S> {
/// Convert a Quaternion to Eular angles
/// This is a polar singularity aware conversion
///
///
/// Based on:
/// - [Maths - Conversion Quaternion to Euler]
/// (http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/)
@ -280,7 +280,7 @@ impl<S: BaseFloat> Quaternion<S> {
let unit = sqx + sqy + sqz + sqw;
let test = qx*qy + qz*qw;
if test > sig * unit {
(
rad(zero::<S>()),

View file

@ -138,6 +138,7 @@ pub trait Rotation3<S: BaseNum>: Rotation<S, Vector3<S>, Point3<S>>
/// use cgmath::{Matrix, ToMatrix2};
/// use cgmath::{Rotation, Rotation2, Basis2};
/// use cgmath::ApproxEq;
/// use std::num::Float;
///
/// // For simplicity, we will rotate the unit x vector to the unit y vector --
/// // so the angle is 90 degrees, or π/2.

View file

@ -18,6 +18,7 @@
extern crate cgmath;
use cgmath::*;
use std::num::Float;
pub mod matrix2 {
use cgmath::*;

View file

@ -23,6 +23,8 @@ use cgmath::Quaternion;
use cgmath::{Rad, rad, ApproxEq};
use cgmath::Rotation3;
use std::num::Float;
#[test]
fn to_matrix4()
{

View file

@ -18,6 +18,7 @@
extern crate cgmath;
use cgmath::*;
use std::num::FloatMath;
#[test]
fn test_intersection() {

View file

@ -18,6 +18,7 @@
extern crate cgmath;
use cgmath::*;
use std::num::{Float, FloatMath};
#[test]
fn test_from_value() {