Fix ambiguous trait call; Remove deprecated Float calls.

This commit is contained in:
Jameson Ernst 2014-11-24 20:04:34 -08:00
parent 23f14b701b
commit 08f9354efc
4 changed files with 7 additions and 5 deletions

View file

@ -16,6 +16,7 @@
//! Angle units for type-safe, self-documenting code.
use std::fmt;
use std::f64;
use std::num::{cast, Float};
use approx::ApproxEq;
@ -212,7 +213,7 @@ Equiv<Deg<S>> for Deg<S> {
impl<S: BaseFloat>
Angle<S> for Rad<S> {
#[inline] fn from<A: Angle<S>>(theta: A) -> Rad<S> { theta.to_rad() }
#[inline] fn full_turn() -> Rad<S> { rad(Float::two_pi()) }
#[inline] fn full_turn() -> Rad<S> { rad(cast(f64::consts::PI_2).unwrap()) }
}
impl<S: BaseFloat>

View file

@ -15,6 +15,7 @@
use std::fmt;
use std::mem;
use std::f64;
use std::num::{cast, Float};
use angle::{Angle, Rad, acos, sin, sin_cos, rad};
@ -284,11 +285,11 @@ impl<S: BaseFloat> Quaternion<S> {
if test > sig * unit {
(
rad(zero::<S>()),
rad(Float::frac_pi_2()),
rad(cast(f64::consts::FRAC_PI_2).unwrap()),
rad(two * qx.atan2(qw)),
)
} else if test < -sig * unit {
let y: S = Float::frac_pi_2();
let y: S = cast(f64::consts::FRAC_PI_2).unwrap();
(
rad(zero::<S>()),
rad(-y),

View file

@ -63,7 +63,7 @@ pub trait Rotation<S: BaseNum, V: Vector<S>, P: Point<S, V>>: PartialEq + Approx
/// Modify this rotation in-place by combining it with another.
#[inline]
fn concat_self(&mut self, other: &Self) {
*self = self.concat(other);
*self = Rotation::concat(self, other);
}
/// Invert this rotation in-place.

View file

@ -63,7 +63,7 @@ pub trait Transform<S: BaseNum, V: Vector<S>, P: Point<S,V>> {
/// Combine this transform with another, in-place.
#[inline]
fn concat_self(&mut self, other: &Self) {
*self = self.concat(other);
*self = Transform::concat(self, other);
}
/// Invert this transform in-place, failing if the transformation is not