Merge pull request #121 from sebcrozet/remove_deprecated
Remove all deprecated functions/traits.
This commit is contained in:
commit
c98de73e30
25
src/lib.rs
25
src/lib.rs
|
@ -144,8 +144,7 @@ pub use traits::{
|
|||
Transform, Transformation,
|
||||
Translate, Translation,
|
||||
Transpose,
|
||||
UniformSphereSample,
|
||||
VecAsPnt,
|
||||
UniformSphereSample
|
||||
};
|
||||
|
||||
pub use structs::{
|
||||
|
@ -335,28 +334,6 @@ pub fn sqdist<N: BaseFloat, P: FloatPnt<N, V>, V: Norm<N>>(a: &P, b: &P) -> N {
|
|||
a.sqdist(b)
|
||||
}
|
||||
|
||||
/*
|
||||
* Perspective
|
||||
*/
|
||||
/// Computes a projection matrix given the frustrum near plane width, height, the field of
|
||||
/// view, and the distance to the clipping planes (`znear` and `zfar`).
|
||||
#[deprecated = "Use `Persp3::new(width / height, fov, znear, zfar).as_mat()` instead"]
|
||||
pub fn perspective3d<N: BaseFloat + Cast<f64> + Zero + One>(width: N, height: N, fov: N, znear: N, zfar: N) -> Mat4<N> {
|
||||
let aspect = width / height;
|
||||
|
||||
let _1: N = one();
|
||||
let sy = _1 / (fov * cast(0.5)).tan();
|
||||
let sx = -sy / aspect;
|
||||
let sz = -(zfar + znear) / (znear - zfar);
|
||||
let tz = zfar * znear * cast(2.0) / (znear - zfar);
|
||||
|
||||
Mat4::new(
|
||||
sx, zero(), zero(), zero(),
|
||||
zero(), sy, zero(), zero(),
|
||||
zero(), zero(), sz, tz,
|
||||
zero(), zero(), one(), zero())
|
||||
}
|
||||
|
||||
/*
|
||||
* Translation<V>
|
||||
*/
|
||||
|
|
|
@ -199,20 +199,6 @@ impl<N> DMat<N> {
|
|||
}
|
||||
|
||||
impl<N: Copy> Indexable<(usize, usize), N> for DMat<N> {
|
||||
/// Changes the value of a component of the matrix.
|
||||
///
|
||||
/// # Arguments
|
||||
/// * `rowcol` - 0-based tuple (row, col) to be changed
|
||||
#[inline]
|
||||
fn set(&mut self, rowcol: (usize, usize), val: N) {
|
||||
let (row, col) = rowcol;
|
||||
assert!(row < self.nrows);
|
||||
assert!(col < self.ncols);
|
||||
|
||||
let offset = self.offset(row, col);
|
||||
self.mij[offset] = val
|
||||
}
|
||||
|
||||
/// Just like `set` without bounds checking.
|
||||
#[inline]
|
||||
unsafe fn unsafe_set(&mut self, rowcol: (usize, usize), val: N) {
|
||||
|
@ -221,18 +207,6 @@ impl<N: Copy> Indexable<(usize, usize), N> for DMat<N> {
|
|||
*self.mij[..].get_unchecked_mut(offset) = val
|
||||
}
|
||||
|
||||
/// Reads the value of a component of the matrix.
|
||||
///
|
||||
/// # Arguments
|
||||
/// * `rowcol` - 0-based tuple (row, col) to be read
|
||||
#[inline]
|
||||
fn at(&self, rowcol: (usize, usize)) -> N {
|
||||
let (row, col) = rowcol;
|
||||
assert!(row < self.nrows);
|
||||
assert!(col < self.ncols);
|
||||
unsafe { self.unsafe_at((row, col)) }
|
||||
}
|
||||
|
||||
/// Just like `at` without bounds checking.
|
||||
#[inline]
|
||||
unsafe fn unsafe_at(&self, rowcol: (usize, usize)) -> N {
|
||||
|
|
|
@ -42,22 +42,6 @@ macro_rules! dvec_impl(
|
|||
}
|
||||
|
||||
impl<N: Copy> Indexable<usize, N> for $dvec<N> {
|
||||
#[inline]
|
||||
fn at(&self, i: usize) -> N {
|
||||
assert!(i < self.len());
|
||||
unsafe {
|
||||
self.unsafe_at(i)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn set(&mut self, i: usize, val: N) {
|
||||
assert!(i < self.len());
|
||||
unsafe {
|
||||
self.unsafe_set(i, val);
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn swap(&mut self, i: usize, j: usize) {
|
||||
assert!(i < self.len());
|
||||
|
@ -147,7 +131,7 @@ macro_rules! dvec_impl(
|
|||
for i in 0..dim {
|
||||
let mut basis_element : $dvec<N> = $dvec::new_zeros(dim);
|
||||
|
||||
basis_element.set(i, ::one());
|
||||
basis_element[i] = ::one();
|
||||
|
||||
res.push(basis_element);
|
||||
}
|
||||
|
@ -166,7 +150,7 @@ macro_rules! dvec_impl(
|
|||
for i in 0..dim {
|
||||
let mut basis_element : $dvec<N> = $dvec::new_zeros(self.len());
|
||||
|
||||
basis_element.set(i, ::one());
|
||||
basis_element[i] = ::one();
|
||||
|
||||
if res.len() == dim - 1 {
|
||||
break;
|
||||
|
|
|
@ -264,20 +264,6 @@ macro_rules! indexable_impl(
|
|||
}
|
||||
|
||||
impl<N: Copy> Indexable<(usize, usize), N> for $t<N> {
|
||||
#[inline]
|
||||
fn at(&self, (i, j): (usize, usize)) -> N {
|
||||
unsafe {
|
||||
mem::transmute::<&$t<N>, &[N; $dim * $dim]>(self)[i + j * $dim]
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn set(&mut self, (i, j): (usize, usize), val: N) {
|
||||
unsafe {
|
||||
mem::transmute::<&mut $t<N>, &mut [N; $dim * $dim]>(self)[i + j * $dim] = val
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn swap(&mut self, (i1, j1): (usize, usize), (i2, j2): (usize, usize)) {
|
||||
unsafe {
|
||||
|
@ -344,7 +330,7 @@ macro_rules! row_impl(
|
|||
#[inline]
|
||||
fn set_row(&mut self, row: usize, v: $tv<N>) {
|
||||
for (i, e) in v.iter().enumerate() {
|
||||
self.set((row, i), *e);
|
||||
self[(row, i)] = *e;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -353,7 +339,7 @@ macro_rules! row_impl(
|
|||
let mut res: $tv<N> = ::zero();
|
||||
|
||||
for (i, e) in res.iter_mut().enumerate() {
|
||||
*e = self.at((row, i));
|
||||
*e = self[(row, i)];
|
||||
}
|
||||
|
||||
res
|
||||
|
@ -385,7 +371,7 @@ macro_rules! col_impl(
|
|||
#[inline]
|
||||
fn set_col(&mut self, col: usize, v: $tv<N>) {
|
||||
for (i, e) in v.iter().enumerate() {
|
||||
self.set((i, col), *e);
|
||||
self[(i, col)] = *e;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -394,7 +380,7 @@ macro_rules! col_impl(
|
|||
let mut res: $tv<N> = ::zero();
|
||||
|
||||
for (i, e) in res.iter_mut().enumerate() {
|
||||
*e = self.at((i, col));
|
||||
*e = self[(i, col)];
|
||||
}
|
||||
|
||||
res
|
||||
|
@ -552,7 +538,7 @@ macro_rules! inv_impl(
|
|||
let mut n0 = k; // index of a non-zero entry
|
||||
|
||||
while n0 != $dim {
|
||||
if self.at((n0, k)) != ::zero() {
|
||||
if self[(n0, k)] != ::zero() {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -571,30 +557,30 @@ macro_rules! inv_impl(
|
|||
}
|
||||
}
|
||||
|
||||
let pivot = self.at((k, k));
|
||||
let pivot = self[(k, k)];
|
||||
|
||||
for j in k..$dim {
|
||||
let selfval = self.at((k, j)) / pivot;
|
||||
self.set((k, j), selfval);
|
||||
let selfval = self[(k, j)] / pivot;
|
||||
self[(k, j)] = selfval;
|
||||
}
|
||||
|
||||
for j in 0..$dim {
|
||||
let resval = res.at((k, j)) / pivot;
|
||||
res.set((k, j), resval);
|
||||
let resval = res[(k, j)] / pivot;
|
||||
res[(k, j)] = resval;
|
||||
}
|
||||
|
||||
for l in 0..$dim {
|
||||
if l != k {
|
||||
let normalizer = self.at((l, k));
|
||||
let normalizer = self[(l, k)];
|
||||
|
||||
for j in k..$dim {
|
||||
let selfval = self.at((l, j)) - self.at((k, j)) * normalizer;
|
||||
self.set((l, j), selfval);
|
||||
let selfval = self[(l, j)] - self[(k, j)] * normalizer;
|
||||
self[(l, j)] = selfval;
|
||||
}
|
||||
|
||||
for j in 0..$dim {
|
||||
let resval = res.at((l, j)) - res.at((k, j)) * normalizer;
|
||||
res.set((l, j), resval);
|
||||
let resval = res[(l, j)] - res[(k, j)] * normalizer;
|
||||
res[(l, j)] = resval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -668,7 +654,7 @@ macro_rules! to_homogeneous_impl(
|
|||
|
||||
for i in 0..$dim {
|
||||
for j in 0..$dim {
|
||||
res.set((i, j), self.at((i, j)))
|
||||
res[(i, j)] = self[(i, j)]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -687,7 +673,7 @@ macro_rules! from_homogeneous_impl(
|
|||
|
||||
for i in 0..$dim2 {
|
||||
for j in 0..$dim2 {
|
||||
res.set((i, j), m.at((i, j)))
|
||||
res[(i, j)] = m[(i, j)]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -708,7 +694,7 @@ macro_rules! outer_impl(
|
|||
let mut res: $m<N> = ::zero();
|
||||
for i in 0..Dim::dim(None::<$t<N>>) {
|
||||
for j in 0..Dim::dim(None::<$t<N>>) {
|
||||
res.set((i, j), self.at(i) * other.at(j))
|
||||
res[(i, j)] = self[i] * other[j]
|
||||
}
|
||||
}
|
||||
res
|
||||
|
|
|
@ -46,15 +46,6 @@ impl<N> Shape<usize> for vec::Vec0<N> {
|
|||
}
|
||||
|
||||
impl<N> Indexable<usize, N> for vec::Vec0<N> {
|
||||
#[inline]
|
||||
fn at(&self, _: usize) -> N {
|
||||
panic!("Cannot index a Vec0.")
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn set(&mut self, _: usize, _: N) {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn swap(&mut self, _: usize, _: usize) {
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ use traits::operations::{ApproxEq, POrd, POrdering, Axpy, ScalarAdd, ScalarSub,
|
|||
ScalarDiv, Absolute};
|
||||
use traits::geometry::{Transform, Rotate, FromHomogeneous, ToHomogeneous, Dot, Norm,
|
||||
Translation, Translate};
|
||||
use traits::structure::{Basis, Cast, Dim, Indexable, Iterable, IterableMut, VecAsPnt, Shape,
|
||||
NumVec, FloatVec, BaseFloat, BaseNum, Bounded};
|
||||
use traits::structure::{Basis, Cast, Dim, Indexable, Iterable, IterableMut, Shape, NumVec,
|
||||
FloatVec, BaseFloat, BaseNum, Bounded};
|
||||
use structs::pnt::{Pnt1, Pnt2, Pnt3, Pnt4, Pnt5, Pnt6};
|
||||
|
||||
#[cfg(feature="arbitrary")]
|
||||
|
|
|
@ -189,20 +189,6 @@ macro_rules! indexable_impl(
|
|||
}
|
||||
|
||||
impl<N: Copy> Indexable<usize, N> for $t<N> {
|
||||
#[inline]
|
||||
fn at(&self, i: usize) -> N {
|
||||
unsafe {
|
||||
mem::transmute::<&$t<N>, &[N; $dim]>(self)[i]
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn set(&mut self, i: usize, val: N) {
|
||||
unsafe {
|
||||
mem::transmute::<&mut $t<N>, &mut [N; $dim]>(self)[i] = val
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn swap(&mut self, i1: usize, i2: usize) {
|
||||
unsafe {
|
||||
|
@ -792,7 +778,6 @@ macro_rules! transform_impl(
|
|||
macro_rules! vec_as_pnt_impl(
|
||||
($tv: ident, $t: ident, $($compN: ident),+) => (
|
||||
impl<N> $tv<N> {
|
||||
#[deprecated = "use `na::orig() + this_vector` instead."]
|
||||
#[inline]
|
||||
pub fn to_pnt(self) -> $t<N> {
|
||||
$t::new(
|
||||
|
@ -800,7 +785,6 @@ macro_rules! vec_as_pnt_impl(
|
|||
)
|
||||
}
|
||||
|
||||
#[deprecated = "use `&(na::orig() + *this_vector)` instead."]
|
||||
#[inline]
|
||||
pub fn as_pnt(&self) -> &$t<N> {
|
||||
unsafe {
|
||||
|
@ -808,18 +792,6 @@ macro_rules! vec_as_pnt_impl(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<N> VecAsPnt<$t<N>> for $tv<N> {
|
||||
#[inline]
|
||||
fn to_pnt(self) -> $t<N> {
|
||||
self.to_pnt()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn as_pnt(&self) -> &$t<N> {
|
||||
self.as_pnt()
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ pub use traits::geometry::{AbsoluteRotate, Cross, CrossMatrix, Dot, FromHomogene
|
|||
Transform, Transformation, Translate, Translation, UniformSphereSample};
|
||||
|
||||
pub use traits::structure::{FloatVec, FloatPnt, Basis, Cast, Col, Dim, Indexable, Iterable,
|
||||
IterableMut, Mat, SquareMat, Row, NumVec, NumPnt, PntAsVec, VecAsPnt,
|
||||
ColSlice, RowSlice, Diag, Eye, Shape, BaseFloat, BaseNum, Bounded};
|
||||
IterableMut, Mat, SquareMat, Row, NumVec, NumPnt, PntAsVec, ColSlice,
|
||||
RowSlice, Diag, Eye, Shape, BaseFloat, BaseNum, Bounded};
|
||||
|
||||
pub use traits::operations::{Absolute, ApproxEq, Axpy, Cov, Det, Inv, LMul, Mean, Outer, POrd,
|
||||
RMul, ScalarAdd, ScalarSub, ScalarMul, ScalarDiv, Transpose, EigenQR};
|
||||
|
|
|
@ -173,12 +173,6 @@ pub trait Shape<I>: Index<I> {
|
|||
/// Thus, this is the same as the `I` trait but without the syntactic sugar and with a method
|
||||
/// to write to a specific index.
|
||||
pub trait Indexable<I, N>: Shape<I> + IndexMut<I, Output = N> {
|
||||
#[deprecated = "use the Index `[]` overloaded operator instead"]
|
||||
/// Reads the `i`-th element of `self`.
|
||||
fn at(&self, i: I) -> N;
|
||||
#[deprecated = "use the IndexMut `[]` overloaded operator instead"]
|
||||
/// Writes to the `i`-th element of `self`.
|
||||
fn set(&mut self, i: I, N);
|
||||
/// Swaps the `i`-th element of `self` with its `j`-th element.
|
||||
fn swap(&mut self, i: I, j: I);
|
||||
|
||||
|
@ -211,16 +205,6 @@ pub trait IterableMut<N> {
|
|||
/*
|
||||
* Vec related traits.
|
||||
*/
|
||||
/// Trait that relates a point of an affine space to a vector of the associated vector space.
|
||||
#[deprecated = "This will be removed in the future. Use point + vector operations instead."]
|
||||
pub trait VecAsPnt<P> {
|
||||
/// Converts this point to its associated vector.
|
||||
fn to_pnt(self) -> P;
|
||||
|
||||
/// Converts a reference to this point to a reference to its associated vector.
|
||||
fn as_pnt<'a>(&'a self) -> &'a P;
|
||||
}
|
||||
|
||||
/// Trait grouping most common operations on vectors.
|
||||
pub trait NumVec<N>: Dim +
|
||||
Sub<Self, Output = Self> + Add<Self, Output = Self> +
|
||||
|
|
Loading…
Reference in New Issue