invert -> inplace_inverse to avoid name clash with iterators.

This commit is contained in:
Sébastien Crozet 2013-07-13 13:34:41 +00:00
parent 7f05cc5977
commit 8918cb5d7e
6 changed files with 15 additions and 15 deletions

View File

@ -193,7 +193,7 @@ impl<V, M: LMul<V>> LMul<V> for Rotmat<M>
impl<M: Transpose> Inv for Rotmat<M>
{
#[inline]
fn invert(&mut self) -> bool
fn inplace_inverse(&mut self) -> bool
{
self.transpose();

View File

@ -218,9 +218,9 @@ impl<M: Copy + Inv + RMul<V>, V: Copy + Neg<V>>
Inv for Transform<M, V>
{
#[inline]
fn invert(&mut self) -> bool
fn inplace_inverse(&mut self) -> bool
{
if !self.submat.invert()
if !self.submat.inplace_inverse()
{ false }
else
{
@ -234,7 +234,7 @@ Inv for Transform<M, V>
{
let mut res = copy *self;
if res.invert()
if res.inplace_inverse()
{ Some(res) }
else
{ None }

View File

@ -141,13 +141,13 @@ Inv for DMat<N>
{
let mut res : DMat<N> = copy *self;
if res.invert()
if res.inplace_inverse()
{ Some(res) }
else
{ None }
}
fn invert(&mut self) -> bool
fn inplace_inverse(&mut self) -> bool
{
let dim = self.dim;
let mut res = one_mat_with_dim::<N>(dim);

View File

@ -226,13 +226,13 @@ macro_rules! inv_impl(
{
let mut res : $t<N> = self.clone();
if res.invert()
if res.inplace_inverse()
{ Some(res) }
else
{ None }
}
fn invert(&mut self) -> bool
fn inplace_inverse(&mut self) -> bool
{
let mut res: $t<N> = One::one();
let _0N: N = Zero::zero();

View File

@ -12,14 +12,14 @@ Inv for Mat1<N>
{
let mut res : Mat1<N> = copy *self;
if res.invert()
if res.inplace_inverse()
{ Some(res) }
else
{ None }
}
#[inline]
fn invert(&mut self) -> bool
fn inplace_inverse(&mut self) -> bool
{
if self.mij[0].is_zero()
{ false }
@ -39,14 +39,14 @@ Inv for Mat2<N>
{
let mut res : Mat2<N> = copy *self;
if res.invert()
if res.inplace_inverse()
{ Some(res) }
else
{ None }
}
#[inline]
fn invert(&mut self) -> bool
fn inplace_inverse(&mut self) -> bool
{
let det = self.mij[0 * 2 + 0] * self.mij[1 * 2 + 1] - self.mij[1 * 2 + 0] * self.mij[0 * 2 + 1];
@ -70,14 +70,14 @@ Inv for Mat3<N>
{
let mut res = copy *self;
if res.invert()
if res.inplace_inverse()
{ Some(res) }
else
{ None }
}
#[inline]
fn invert(&mut self) -> bool
fn inplace_inverse(&mut self) -> bool
{
let minor_m12_m23 = self.mij[1 * 3 + 1] * self.mij[2 * 3 + 2] - self.mij[2 * 3 + 1] * self.mij[1 * 3 + 2];
let minor_m11_m23 = self.mij[1 * 3 + 0] * self.mij[2 * 3 + 2] - self.mij[2 * 3 + 0] * self.mij[1 * 3 + 2];

View File

@ -6,5 +6,5 @@ pub trait Inv
/// Returns the inverse of an element.
fn inverse(&self) -> Option<Self>;
/// Inplace version of `inverse`.
fn invert(&mut self) -> bool;
fn inplace_inverse(&mut self) -> bool;
}