forked from M-Labs/nalgebra
Add Vec0.
This commit is contained in:
parent
831f561441
commit
c37d58f3fb
38
src/vec.rs
38
src/vec.rs
@ -19,6 +19,44 @@ use traits::indexable::Indexable;
|
||||
|
||||
mod vec_impl;
|
||||
|
||||
#[deriving(Ord, ToStr)]
|
||||
pub struct Vec0<N>
|
||||
{ at: [N, ..0] }
|
||||
|
||||
impl<N: Clone> Vec0<N>
|
||||
{
|
||||
#[inline]
|
||||
pub fn new_repeat(_: N) -> Vec0<N>
|
||||
{ Vec0 { at: [ ] } }
|
||||
}
|
||||
|
||||
clone_impl!(Vec0)
|
||||
deep_clone_impl!(Vec0)
|
||||
new_impl!(Vec0, 0)
|
||||
indexable_impl!(Vec0)
|
||||
dim_impl!(Vec0, 0)
|
||||
eq_impl!(Vec0)
|
||||
// (specialized) basis_impl!(Vec0, 0)
|
||||
add_impl!(Vec0)
|
||||
sub_impl!(Vec0)
|
||||
neg_impl!(Vec0)
|
||||
dot_impl!(Vec0, 0)
|
||||
sub_dot_impl!(Vec0, 0)
|
||||
scalar_mul_impl!(Vec0, 0)
|
||||
scalar_div_impl!(Vec0, 0)
|
||||
scalar_add_impl!(Vec0, 0)
|
||||
scalar_sub_impl!(Vec0, 0)
|
||||
translation_impl!(Vec0)
|
||||
translatable_impl!(Vec0)
|
||||
norm_impl!(Vec0, 0)
|
||||
approx_eq_impl!(Vec0)
|
||||
zero_impl!(Vec0)
|
||||
one_impl!(Vec0)
|
||||
bounded_impl!(Vec0)
|
||||
iterable_impl!(Vec0)
|
||||
iterable_mut_impl!(Vec0)
|
||||
to_homogeneous_impl!(Vec0, Vec1)
|
||||
from_homogeneous_impl!(Vec1, Vec0, 1)
|
||||
|
||||
#[deriving(Ord, ToStr)]
|
||||
pub struct Vec1<N>
|
||||
|
@ -1,10 +1,28 @@
|
||||
use std::vec::{VecIterator, VecMutIterator};
|
||||
use std::iterator::FromIterator;
|
||||
use std::num::{Zero, One, abs};
|
||||
use traits::basis::Basis;
|
||||
use traits::cross::Cross;
|
||||
use traits::division_ring::DivisionRing;
|
||||
use traits::norm::Norm;
|
||||
use traits::sample::UniformSphereSample;
|
||||
use vec::{Vec1, Vec2, Vec3};
|
||||
use traits::iterable::FromAnyIterator;
|
||||
use vec::{Vec0, Vec1, Vec2, Vec3};
|
||||
|
||||
impl<N: Clone> FromAnyIterator<N> for Vec0<N>
|
||||
{
|
||||
fn from_iterator<'l>(_: &mut VecIterator<'l, N>) -> Vec0<N>
|
||||
{ Vec0 { at: [ ] } }
|
||||
|
||||
fn from_mut_iterator<'l>(_: &mut VecMutIterator<'l, N>) -> Vec0<N>
|
||||
{ Vec0 { at: [ ] } }
|
||||
}
|
||||
|
||||
impl<N, Iter: Iterator<N>> FromIterator<N, Iter> for Vec0<N>
|
||||
{
|
||||
fn from_iterator(_: &mut Iter) -> Vec0<N>
|
||||
{ Vec0 { at: [ ] } }
|
||||
}
|
||||
|
||||
impl<N: Mul<N, N> + Sub<N, N>> Cross<Vec1<N>> for Vec2<N>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user