Merge pull request #49 from sebcrozet/multidispatch
Replace the double dispatch trick by multidispatch!
This commit is contained in:
commit
b7af46377d
35
src/lib.rs
35
src/lib.rs
@ -193,41 +193,6 @@ mod macros;
|
||||
// mod lower_triangular;
|
||||
// mod chol;
|
||||
|
||||
/*
|
||||
* Reexport everything.
|
||||
*/
|
||||
/// Traits to work around the language limitations related to operator overloading.
|
||||
///
|
||||
/// The trait names are formed by:
|
||||
///
|
||||
/// * a type name (eg. Vec1, Vec2, Mat3, Mat4, etc.).
|
||||
/// * the name of a binary operation (eg. Mul, Div, Add, Sub, etc.).
|
||||
/// * the word `Rhs`.
|
||||
///
|
||||
/// When implemented by the type `T`, the trait makes it possible to overload the binary operator
|
||||
/// between `T` and the type name given by the trait.
|
||||
///
|
||||
/// # Examples:
|
||||
///
|
||||
/// * `Vec3MulRhs` will allow the overload of the `*` operator between the implementor type and
|
||||
/// `Vec3`. The `Vec3` being the first argument of the multiplication.
|
||||
/// * `Mat4DivRhs` will allow the overload of the `/` operator between the implementor type and
|
||||
/// `Mat4`. The `Mat4` being the first argument of the division.
|
||||
pub mod overload {
|
||||
pub use structs::{Vec1MulRhs, Vec2MulRhs, Vec3MulRhs, Vec4MulRhs, Vec5MulRhs, Vec6MulRhs,
|
||||
Vec1DivRhs, Vec2DivRhs, Vec3DivRhs, Vec4DivRhs, Vec5DivRhs, Vec6DivRhs,
|
||||
Vec1AddRhs, Vec2AddRhs, Vec3AddRhs, Vec4AddRhs, Vec5AddRhs, Vec6AddRhs,
|
||||
Vec1SubRhs, Vec2SubRhs, Vec3SubRhs, Vec4SubRhs, Vec5SubRhs, Vec6SubRhs,
|
||||
Pnt1MulRhs, Pnt2MulRhs, Pnt3MulRhs, Pnt4MulRhs, Pnt5MulRhs, Pnt6MulRhs,
|
||||
Pnt1DivRhs, Pnt2DivRhs, Pnt3DivRhs, Pnt4DivRhs, Pnt5DivRhs, Pnt6DivRhs,
|
||||
Pnt1AddRhs, Pnt2AddRhs, Pnt3AddRhs, Pnt4AddRhs, Pnt5AddRhs, Pnt6AddRhs,
|
||||
Pnt1SubRhs, Pnt2SubRhs, Pnt3SubRhs, Pnt4SubRhs, Pnt5SubRhs, Pnt6SubRhs,
|
||||
Mat1MulRhs, Mat2MulRhs, Mat3MulRhs, Mat4MulRhs, Mat5MulRhs, Mat6MulRhs,
|
||||
Mat1DivRhs, Mat2DivRhs, Mat3DivRhs, Mat4DivRhs, Mat5DivRhs, Mat6DivRhs,
|
||||
Mat1AddRhs, Mat2AddRhs, Mat3AddRhs, Mat4AddRhs, Mat5AddRhs, Mat6AddRhs,
|
||||
Mat1SubRhs, Mat2SubRhs, Mat3SubRhs, Mat4SubRhs, Mat5SubRhs, Mat6SubRhs};
|
||||
}
|
||||
|
||||
/// Change the input value to ensure it is on the range `[min, max]`.
|
||||
#[inline(always)]
|
||||
pub fn clamp<T: PartialOrd>(val: T, min: T, max: T) -> T {
|
||||
|
@ -7,7 +7,7 @@ use std::rand::Rand;
|
||||
use std::rand;
|
||||
use traits::operations::ApproxEq;
|
||||
use std::mem;
|
||||
use structs::dvec::{DVec, DVecMulRhs};
|
||||
use structs::dvec::DVec;
|
||||
use traits::operations::{Inv, Transpose, Mean, Cov};
|
||||
use traits::structure::{Cast, ColSlice, RowSlice, Diag, Eye, Indexable, Shape, Zero, One, BaseNum};
|
||||
use std::fmt::{Show, Formatter, Result};
|
||||
@ -21,16 +21,6 @@ pub struct DMat<N> {
|
||||
mij: Vec<N>
|
||||
}
|
||||
|
||||
double_dispatch_binop_decl_trait!(DMat, DMatMulRhs)
|
||||
double_dispatch_binop_decl_trait!(DMat, DMatDivRhs)
|
||||
double_dispatch_binop_decl_trait!(DMat, DMatAddRhs)
|
||||
double_dispatch_binop_decl_trait!(DMat, DMatSubRhs)
|
||||
|
||||
mul_redispatch_impl!(DMat, DMatMulRhs)
|
||||
div_redispatch_impl!(DMat, DMatDivRhs)
|
||||
add_redispatch_impl!(DMat, DMatAddRhs)
|
||||
sub_redispatch_impl!(DMat, DMatSubRhs)
|
||||
|
||||
impl<N> DMat<N> {
|
||||
/// Creates an uninitialized matrix.
|
||||
#[inline]
|
||||
@ -293,20 +283,20 @@ impl<N> IndexMut<(uint, uint), N> for DMat<N> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Clone + Mul<N, N> + Add<N, N> + Zero> DMatMulRhs<N, DMat<N>> for DMat<N> {
|
||||
fn binop(left: &DMat<N>, right: &DMat<N>) -> DMat<N> {
|
||||
assert!(left.ncols == right.nrows);
|
||||
impl<N: Clone + Mul<N, N> + Add<N, N> + Zero> Mul<DMat<N>, DMat<N>> for DMat<N> {
|
||||
fn mul(&self, right: &DMat<N>) -> DMat<N> {
|
||||
assert!(self.ncols == right.nrows);
|
||||
|
||||
let mut res = unsafe { DMat::new_uninitialized(left.nrows, right.ncols) };
|
||||
let mut res = unsafe { DMat::new_uninitialized(self.nrows, right.ncols) };
|
||||
|
||||
for i in range(0u, left.nrows) {
|
||||
for i in range(0u, self.nrows) {
|
||||
for j in range(0u, right.ncols) {
|
||||
let mut acc: N = ::zero();
|
||||
|
||||
unsafe {
|
||||
for k in range(0u, left.ncols) {
|
||||
for k in range(0u, self.ncols) {
|
||||
acc = acc
|
||||
+ left.unsafe_at((i, k)) * right.unsafe_at((k, j));
|
||||
+ self.unsafe_at((i, k)) * right.unsafe_at((k, j));
|
||||
}
|
||||
|
||||
res.unsafe_set((i, j), acc);
|
||||
@ -318,19 +308,18 @@ impl<N: Clone + Mul<N, N> + Add<N, N> + Zero> DMatMulRhs<N, DMat<N>> for DMat<N>
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Clone + Add<N, N> + Mul<N, N> + Zero>
|
||||
DMatMulRhs<N, DVec<N>> for DVec<N> {
|
||||
fn binop(left: &DMat<N>, right: &DVec<N>) -> DVec<N> {
|
||||
assert!(left.ncols == right.at.len());
|
||||
impl<N: Clone + Add<N, N> + Mul<N, N> + Zero> Mul<DVec<N>, DVec<N>> for DMat<N> {
|
||||
fn mul(&self, right: &DVec<N>) -> DVec<N> {
|
||||
assert!(self.ncols == right.at.len());
|
||||
|
||||
let mut res : DVec<N> = unsafe { DVec::new_uninitialized(left.nrows) };
|
||||
let mut res : DVec<N> = unsafe { DVec::new_uninitialized(self.nrows) };
|
||||
|
||||
for i in range(0u, left.nrows) {
|
||||
for i in range(0u, self.nrows) {
|
||||
let mut acc: N = ::zero();
|
||||
|
||||
for j in range(0u, left.ncols) {
|
||||
for j in range(0u, self.ncols) {
|
||||
unsafe {
|
||||
acc = acc + left.unsafe_at((i, j)) * right.unsafe_at(j);
|
||||
acc = acc + self.unsafe_at((i, j)) * right.unsafe_at(j);
|
||||
}
|
||||
}
|
||||
|
||||
@ -342,10 +331,9 @@ DMatMulRhs<N, DVec<N>> for DVec<N> {
|
||||
}
|
||||
|
||||
|
||||
impl<N: Clone + Add<N, N> + Mul<N, N> + Zero>
|
||||
DVecMulRhs<N, DVec<N>> for DMat<N> {
|
||||
fn binop(left: &DVec<N>, right: &DMat<N>) -> DVec<N> {
|
||||
assert!(right.nrows == left.at.len());
|
||||
impl<N: Clone + Add<N, N> + Mul<N, N> + Zero> Mul<DMat<N>, DVec<N>> for DVec<N> {
|
||||
fn mul(&self, right: &DMat<N>) -> DVec<N> {
|
||||
assert!(right.nrows == self.at.len());
|
||||
|
||||
let mut res : DVec<N> = unsafe { DVec::new_uninitialized(right.ncols) };
|
||||
|
||||
@ -354,7 +342,7 @@ DVecMulRhs<N, DVec<N>> for DMat<N> {
|
||||
|
||||
for j in range(0u, right.nrows) {
|
||||
unsafe {
|
||||
acc = acc + left.unsafe_at(j) * right.unsafe_at((j, i));
|
||||
acc = acc + self.unsafe_at(j) * right.unsafe_at((j, i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -516,7 +504,7 @@ impl<N: BaseNum + Cast<f64> + Zero + Clone> Mean<DVec<N>> for DMat<N> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Clone + BaseNum + Cast<f64> + DMatDivRhs<N, DMat<N>>> Cov<DMat<N>> for DMat<N> {
|
||||
impl<N: Clone + BaseNum + Cast<f64> + Div<N, N>> Cov<DMat<N>> for DMat<N> {
|
||||
// FIXME: this could be heavily optimized, removing all temporaries by merging loops.
|
||||
fn cov(m: &DMat<N>) -> DMat<N> {
|
||||
assert!(m.nrows > 1);
|
||||
@ -642,114 +630,46 @@ impl<N: Show + Clone> Show for DMat<N> {
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! scalar_mul_impl (
|
||||
($n: ident) => (
|
||||
impl DMatMulRhs<$n, DMat<$n>> for $n {
|
||||
#[inline]
|
||||
fn binop(left: &DMat<$n>, right: &$n) -> DMat<$n> {
|
||||
DMat {
|
||||
nrows: left.nrows,
|
||||
ncols: left.ncols,
|
||||
mij: left.mij.iter().map(|a| *a * *right).collect()
|
||||
}
|
||||
}
|
||||
impl<N: Mul<N, N>> Mul<N, DMat<N>> for DMat<N> {
|
||||
#[inline]
|
||||
fn mul(&self, right: &N) -> DMat<N> {
|
||||
DMat {
|
||||
nrows: self.nrows,
|
||||
ncols: self.ncols,
|
||||
mij: self.mij.iter().map(|a| *a * *right).collect()
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! scalar_div_impl (
|
||||
($n: ident) => (
|
||||
impl DMatDivRhs<$n, DMat<$n>> for $n {
|
||||
#[inline]
|
||||
fn binop(left: &DMat<$n>, right: &$n) -> DMat<$n> {
|
||||
DMat {
|
||||
nrows: left.nrows,
|
||||
ncols: left.ncols,
|
||||
mij: left.mij.iter().map(|a| *a / *right).collect()
|
||||
}
|
||||
}
|
||||
impl<N: Div<N, N>> Div<N, DMat<N>> for DMat<N> {
|
||||
#[inline]
|
||||
fn div(&self, right: &N) -> DMat<N> {
|
||||
DMat {
|
||||
nrows: self.nrows,
|
||||
ncols: self.ncols,
|
||||
mij: self.mij.iter().map(|a| *a / *right).collect()
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! scalar_add_impl (
|
||||
($n: ident) => (
|
||||
impl DMatAddRhs<$n, DMat<$n>> for $n {
|
||||
#[inline]
|
||||
fn binop(left: &DMat<$n>, right: &$n) -> DMat<$n> {
|
||||
DMat {
|
||||
nrows: left.nrows,
|
||||
ncols: left.ncols,
|
||||
mij: left.mij.iter().map(|a| *a + *right).collect()
|
||||
}
|
||||
}
|
||||
impl<N: Add<N, N>> Add<N, DMat<N>> for DMat<N> {
|
||||
#[inline]
|
||||
fn add(&self, right: &N) -> DMat<N> {
|
||||
DMat {
|
||||
nrows: self.nrows,
|
||||
ncols: self.ncols,
|
||||
mij: self.mij.iter().map(|a| *a + *right).collect()
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! scalar_sub_impl (
|
||||
($n: ident) => (
|
||||
impl DMatSubRhs<$n, DMat<$n>> for $n {
|
||||
#[inline]
|
||||
fn binop(left: &DMat<$n>, right: &$n) -> DMat<$n> {
|
||||
DMat {
|
||||
nrows: left.nrows,
|
||||
ncols: left.ncols,
|
||||
mij: left.mij.iter().map(|a| *a - *right).collect()
|
||||
}
|
||||
}
|
||||
impl<N: Sub<N, N>> Sub<N, DMat<N>> for DMat<N> {
|
||||
#[inline]
|
||||
fn sub(&self, right: &N) -> DMat<N> {
|
||||
DMat {
|
||||
nrows: self.nrows,
|
||||
ncols: self.ncols,
|
||||
mij: self.mij.iter().map(|a| *a - *right).collect()
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
scalar_mul_impl!(f64)
|
||||
scalar_mul_impl!(f32)
|
||||
scalar_mul_impl!(u64)
|
||||
scalar_mul_impl!(u32)
|
||||
scalar_mul_impl!(u16)
|
||||
scalar_mul_impl!(u8)
|
||||
scalar_mul_impl!(i64)
|
||||
scalar_mul_impl!(i32)
|
||||
scalar_mul_impl!(i16)
|
||||
scalar_mul_impl!(i8)
|
||||
scalar_mul_impl!(uint)
|
||||
scalar_mul_impl!(int)
|
||||
|
||||
scalar_div_impl!(f64)
|
||||
scalar_div_impl!(f32)
|
||||
scalar_div_impl!(u64)
|
||||
scalar_div_impl!(u32)
|
||||
scalar_div_impl!(u16)
|
||||
scalar_div_impl!(u8)
|
||||
scalar_div_impl!(i64)
|
||||
scalar_div_impl!(i32)
|
||||
scalar_div_impl!(i16)
|
||||
scalar_div_impl!(i8)
|
||||
scalar_div_impl!(uint)
|
||||
scalar_div_impl!(int)
|
||||
|
||||
scalar_add_impl!(f64)
|
||||
scalar_add_impl!(f32)
|
||||
scalar_add_impl!(u64)
|
||||
scalar_add_impl!(u32)
|
||||
scalar_add_impl!(u16)
|
||||
scalar_add_impl!(u8)
|
||||
scalar_add_impl!(i64)
|
||||
scalar_add_impl!(i32)
|
||||
scalar_add_impl!(i16)
|
||||
scalar_add_impl!(i8)
|
||||
scalar_add_impl!(uint)
|
||||
scalar_add_impl!(int)
|
||||
|
||||
scalar_sub_impl!(f64)
|
||||
scalar_sub_impl!(f32)
|
||||
scalar_sub_impl!(u64)
|
||||
scalar_sub_impl!(u32)
|
||||
scalar_sub_impl!(u16)
|
||||
scalar_sub_impl!(u8)
|
||||
scalar_sub_impl!(i64)
|
||||
scalar_sub_impl!(i32)
|
||||
scalar_sub_impl!(i16)
|
||||
scalar_sub_impl!(i8)
|
||||
scalar_sub_impl!(uint)
|
||||
scalar_sub_impl!(int)
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ impl<N> FromIterator<N> for DVec<N> {
|
||||
}
|
||||
|
||||
|
||||
dvec_impl!(DVec, DVecMulRhs, DVecDivRhs, DVecAddRhs, DVecSubRhs)
|
||||
dvec_impl!(DVec)
|
||||
|
||||
/// Stack-allocated, dynamically sized vector with a maximum size of 1.
|
||||
pub struct DVec1<N> {
|
||||
@ -85,7 +85,7 @@ pub struct DVec1<N> {
|
||||
dim: uint
|
||||
}
|
||||
|
||||
small_dvec_impl!(DVec1, 1, DVec1MulRhs, DVec1DivRhs, DVec1AddRhs, DVec1SubRhs, 0)
|
||||
small_dvec_impl!(DVec1, 1, 0)
|
||||
small_dvec_from_impl!(DVec1, 1, ::zero())
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ pub struct DVec2<N> {
|
||||
dim: uint
|
||||
}
|
||||
|
||||
small_dvec_impl!(DVec2, 2, DVec2MulRhs, DVec2DivRhs, DVec2AddRhs, DVec2SubRhs, 0, 1)
|
||||
small_dvec_impl!(DVec2, 2, 0, 1)
|
||||
small_dvec_from_impl!(DVec2, 2, ::zero(), ::zero())
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ pub struct DVec3<N> {
|
||||
dim: uint
|
||||
}
|
||||
|
||||
small_dvec_impl!(DVec3, 3, DVec3MulRhs, DVec3DivRhs, DVec3AddRhs, DVec3SubRhs, 0, 1, 2)
|
||||
small_dvec_impl!(DVec3, 3, 0, 1, 2)
|
||||
small_dvec_from_impl!(DVec3, 3, ::zero(), ::zero(), ::zero())
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ pub struct DVec4<N> {
|
||||
dim: uint
|
||||
}
|
||||
|
||||
small_dvec_impl!(DVec4, 4, DVec4MulRhs, DVec4DivRhs, DVec4AddRhs, DVec4SubRhs, 0, 1, 2, 3)
|
||||
small_dvec_impl!(DVec4, 4, 0, 1, 2, 3)
|
||||
small_dvec_from_impl!(DVec4, 4, ::zero(), ::zero(), ::zero(), ::zero())
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@ pub struct DVec5<N> {
|
||||
dim: uint
|
||||
}
|
||||
|
||||
small_dvec_impl!(DVec5, 5, DVec5MulRhs, DVec5DivRhs, DVec5AddRhs, DVec5SubRhs, 0, 1, 2, 3, 4)
|
||||
small_dvec_impl!(DVec5, 5, 0, 1, 2, 3, 4)
|
||||
small_dvec_from_impl!(DVec5, 5, ::zero(), ::zero(), ::zero(), ::zero(), ::zero())
|
||||
|
||||
|
||||
@ -135,5 +135,5 @@ pub struct DVec6<N> {
|
||||
dim: uint
|
||||
}
|
||||
|
||||
small_dvec_impl!(DVec6, 6, DVec6MulRhs, DVec6DivRhs, DVec6AddRhs, DVec6SubRhs, 0, 1, 2, 3, 4, 5)
|
||||
small_dvec_impl!(DVec6, 6, 0, 1, 2, 3, 4, 5)
|
||||
small_dvec_from_impl!(DVec6, 6, ::zero(), ::zero(), ::zero(), ::zero(), ::zero(), ::zero())
|
||||
|
@ -1,17 +1,7 @@
|
||||
#![macro_escape]
|
||||
|
||||
macro_rules! dvec_impl(
|
||||
($dvec: ident, $mul: ident, $div: ident, $add: ident, $sub: ident) => (
|
||||
double_dispatch_binop_decl_trait!($dvec, $mul)
|
||||
double_dispatch_binop_decl_trait!($dvec, $div)
|
||||
double_dispatch_binop_decl_trait!($dvec, $add)
|
||||
double_dispatch_binop_decl_trait!($dvec, $sub)
|
||||
|
||||
mul_redispatch_impl!($dvec, $mul)
|
||||
div_redispatch_impl!($dvec, $div)
|
||||
add_redispatch_impl!($dvec, $add)
|
||||
sub_redispatch_impl!($dvec, $sub)
|
||||
|
||||
($dvec: ident) => (
|
||||
impl<N: Zero + Clone> $dvec<N> {
|
||||
/// Builds a vector filled with zeros.
|
||||
///
|
||||
@ -132,7 +122,7 @@ macro_rules! dvec_impl(
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Clone + BaseFloat + ApproxEq<N> + $mul<N, $dvec<N>>> $dvec<N> {
|
||||
impl<N: Clone + BaseFloat + ApproxEq<N>> $dvec<N> {
|
||||
/// Computes the canonical basis for the given dimension. A canonical basis is a set of
|
||||
/// vectors, mutually orthogonal, with all its component equal to 0.0 except one which is equal
|
||||
/// to 1.0.
|
||||
@ -186,35 +176,35 @@ macro_rules! dvec_impl(
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Mul<N, N> + Zero> $mul<N, $dvec<N>> for $dvec<N> {
|
||||
impl<N: Mul<N, N> + Zero> Mul<$dvec<N>, $dvec<N>> for $dvec<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$dvec<N>, right: &$dvec<N>) -> $dvec<N> {
|
||||
assert!(left.len() == right.len());
|
||||
FromIterator::from_iter(left.as_slice().iter().zip(right.as_slice().iter()).map(|(a, b)| *a * *b))
|
||||
fn mul(&self, right: &$dvec<N>) -> $dvec<N> {
|
||||
assert!(self.len() == right.len());
|
||||
FromIterator::from_iter(self.as_slice().iter().zip(right.as_slice().iter()).map(|(a, b)| *a * *b))
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Div<N, N> + Zero> $div<N, $dvec<N>> for $dvec<N> {
|
||||
impl<N: Div<N, N> + Zero> Div<$dvec<N>, $dvec<N>> for $dvec<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$dvec<N>, right: &$dvec<N>) -> $dvec<N> {
|
||||
assert!(left.len() == right.len());
|
||||
FromIterator::from_iter(left.as_slice().iter().zip(right.as_slice().iter()).map(|(a, b)| *a / *b))
|
||||
fn div(&self, right: &$dvec<N>) -> $dvec<N> {
|
||||
assert!(self.len() == right.len());
|
||||
FromIterator::from_iter(self.as_slice().iter().zip(right.as_slice().iter()).map(|(a, b)| *a / *b))
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Add<N, N> + Zero> $add<N, $dvec<N>> for $dvec<N> {
|
||||
impl<N: Add<N, N> + Zero> Add<$dvec<N>, $dvec<N>> for $dvec<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$dvec<N>, right: &$dvec<N>) -> $dvec<N> {
|
||||
assert!(left.len() == right.len());
|
||||
FromIterator::from_iter(left.as_slice().iter().zip(right.as_slice().iter()).map(|(a, b)| *a + *b))
|
||||
fn add(&self, right: &$dvec<N>) -> $dvec<N> {
|
||||
assert!(self.len() == right.len());
|
||||
FromIterator::from_iter(self.as_slice().iter().zip(right.as_slice().iter()).map(|(a, b)| *a + *b))
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Sub<N, N> + Zero> $sub<N, $dvec<N>> for $dvec<N> {
|
||||
impl<N: Sub<N, N> + Zero> Sub<$dvec<N>, $dvec<N>> for $dvec<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$dvec<N>, right: &$dvec<N>) -> $dvec<N> {
|
||||
assert!(left.len() == right.len());
|
||||
FromIterator::from_iter(left.as_slice().iter().zip(right.as_slice().iter()).map(|(a, b)| *a - *b))
|
||||
fn sub(&self, right: &$dvec<N>) -> $dvec<N> {
|
||||
assert!(self.len() == right.len());
|
||||
FromIterator::from_iter(self.as_slice().iter().zip(right.as_slice().iter()).map(|(a, b)| *a - *b))
|
||||
}
|
||||
}
|
||||
|
||||
@ -293,106 +283,38 @@ macro_rules! dvec_impl(
|
||||
}
|
||||
}
|
||||
|
||||
dvec_scalar_mul_impl!($dvec, f64, $mul)
|
||||
dvec_scalar_mul_impl!($dvec, f32, $mul)
|
||||
dvec_scalar_mul_impl!($dvec, u64, $mul)
|
||||
dvec_scalar_mul_impl!($dvec, u32, $mul)
|
||||
dvec_scalar_mul_impl!($dvec, u16, $mul)
|
||||
dvec_scalar_mul_impl!($dvec, u8, $mul)
|
||||
dvec_scalar_mul_impl!($dvec, i64, $mul)
|
||||
dvec_scalar_mul_impl!($dvec, i32, $mul)
|
||||
dvec_scalar_mul_impl!($dvec, i16, $mul)
|
||||
dvec_scalar_mul_impl!($dvec, i8, $mul)
|
||||
dvec_scalar_mul_impl!($dvec, uint, $mul)
|
||||
dvec_scalar_mul_impl!($dvec, int, $mul)
|
||||
|
||||
dvec_scalar_div_impl!($dvec, f64, $div)
|
||||
dvec_scalar_div_impl!($dvec, f32, $div)
|
||||
dvec_scalar_div_impl!($dvec, u64, $div)
|
||||
dvec_scalar_div_impl!($dvec, u32, $div)
|
||||
dvec_scalar_div_impl!($dvec, u16, $div)
|
||||
dvec_scalar_div_impl!($dvec, u8, $div)
|
||||
dvec_scalar_div_impl!($dvec, i64, $div)
|
||||
dvec_scalar_div_impl!($dvec, i32, $div)
|
||||
dvec_scalar_div_impl!($dvec, i16, $div)
|
||||
dvec_scalar_div_impl!($dvec, i8, $div)
|
||||
dvec_scalar_div_impl!($dvec, uint, $div)
|
||||
dvec_scalar_div_impl!($dvec, int, $div)
|
||||
|
||||
dvec_scalar_add_impl!($dvec, f64, $add)
|
||||
dvec_scalar_add_impl!($dvec, f32, $add)
|
||||
dvec_scalar_add_impl!($dvec, u64, $add)
|
||||
dvec_scalar_add_impl!($dvec, u32, $add)
|
||||
dvec_scalar_add_impl!($dvec, u16, $add)
|
||||
dvec_scalar_add_impl!($dvec, u8, $add)
|
||||
dvec_scalar_add_impl!($dvec, i64, $add)
|
||||
dvec_scalar_add_impl!($dvec, i32, $add)
|
||||
dvec_scalar_add_impl!($dvec, i16, $add)
|
||||
dvec_scalar_add_impl!($dvec, i8, $add)
|
||||
dvec_scalar_add_impl!($dvec, uint, $add)
|
||||
dvec_scalar_add_impl!($dvec, int, $add)
|
||||
|
||||
dvec_scalar_sub_impl!($dvec, f64, $sub)
|
||||
dvec_scalar_sub_impl!($dvec, f32, $sub)
|
||||
dvec_scalar_sub_impl!($dvec, u64, $sub)
|
||||
dvec_scalar_sub_impl!($dvec, u32, $sub)
|
||||
dvec_scalar_sub_impl!($dvec, u16, $sub)
|
||||
dvec_scalar_sub_impl!($dvec, u8, $sub)
|
||||
dvec_scalar_sub_impl!($dvec, i64, $sub)
|
||||
dvec_scalar_sub_impl!($dvec, i32, $sub)
|
||||
dvec_scalar_sub_impl!($dvec, i16, $sub)
|
||||
dvec_scalar_sub_impl!($dvec, i8, $sub)
|
||||
dvec_scalar_sub_impl!($dvec, uint, $sub)
|
||||
dvec_scalar_sub_impl!($dvec, int, $sub)
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! dvec_scalar_mul_impl (
|
||||
($dvec: ident, $n: ident, $mul: ident) => (
|
||||
impl $mul<$n, $dvec<$n>> for $n {
|
||||
impl<N: Mul<N, N> + Zero> Mul<N, $dvec<N>> for $dvec<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$dvec<$n>, right: &$n) -> $dvec<$n> {
|
||||
FromIterator::from_iter(left.as_slice().iter().map(|a| *a * *right))
|
||||
fn mul(&self, right: &N) -> $dvec<N> {
|
||||
FromIterator::from_iter(self.as_slice().iter().map(|a| *a * *right))
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! dvec_scalar_div_impl (
|
||||
($dvec: ident, $n: ident, $div: ident) => (
|
||||
impl $div<$n, $dvec<$n>> for $n {
|
||||
impl<N: Div<N, N> + Zero> Div<N, $dvec<N>> for $dvec<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$dvec<$n>, right: &$n) -> $dvec<$n> {
|
||||
FromIterator::from_iter(left.as_slice().iter().map(|a| *a / *right))
|
||||
fn div(&self, right: &N) -> $dvec<N> {
|
||||
FromIterator::from_iter(self.as_slice().iter().map(|a| *a / *right))
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! dvec_scalar_add_impl (
|
||||
($dvec: ident, $n: ident, $add: ident) => (
|
||||
impl $add<$n, $dvec<$n>> for $n {
|
||||
impl<N: Add<N, N> + Zero> Add<N, $dvec<N>> for $dvec<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$dvec<$n>, right: &$n) -> $dvec<$n> {
|
||||
FromIterator::from_iter(left.as_slice().iter().map(|a| *a + *right))
|
||||
fn add(&self, right: &N) -> $dvec<N> {
|
||||
FromIterator::from_iter(self.as_slice().iter().map(|a| *a + *right))
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! dvec_scalar_sub_impl (
|
||||
($dvec: ident, $n: ident, $sub: ident) => (
|
||||
impl $sub<$n, $dvec<$n>> for $n {
|
||||
impl<N: Sub<N, N> + Zero> Sub<N, $dvec<N>> for $dvec<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$dvec<$n>, right: &$n) -> $dvec<$n> {
|
||||
FromIterator::from_iter(left.as_slice().iter().map(|a| *a - *right))
|
||||
fn sub(&self, right: &N) -> $dvec<N> {
|
||||
FromIterator::from_iter(self.as_slice().iter().map(|a| *a - *right))
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! small_dvec_impl (
|
||||
($dvec: ident, $dim: expr, $mul: ident, $div: ident, $add: ident, $sub: ident $(,$idx: expr)*) => (
|
||||
($dvec: ident, $dim: expr $(,$idx: expr)*) => (
|
||||
impl<N> $dvec<N> {
|
||||
#[inline]
|
||||
pub fn len(&self) -> uint {
|
||||
@ -428,7 +350,7 @@ macro_rules! small_dvec_impl (
|
||||
}
|
||||
}
|
||||
|
||||
dvec_impl!($dvec, $mul, $div, $add, $sub)
|
||||
dvec_impl!($dvec)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -10,7 +10,7 @@ use traits::geometry::{RotationMatrix, Rotation, Rotate, AbsoluteRotate, Transfo
|
||||
Translate, Translation, ToHomogeneous};
|
||||
|
||||
use structs::vec::{Vec1, Vec2, Vec3, Vec4};
|
||||
use structs::pnt::{Pnt2, Pnt3, Pnt4, Pnt2MulRhs, Pnt3MulRhs, Pnt4MulRhs};
|
||||
use structs::pnt::{Pnt2, Pnt3, Pnt4};
|
||||
use structs::rot::{Rot2, Rot3, Rot4};
|
||||
|
||||
|
||||
@ -93,8 +93,6 @@ impl<N> Iso4<N> {
|
||||
}
|
||||
|
||||
iso_impl!(Iso2, Rot2, Vec2, Vec1)
|
||||
double_dispatch_binop_decl_trait!(Iso2, Iso2MulRhs)
|
||||
mul_redispatch_impl!(Iso2, Iso2MulRhs)
|
||||
rotation_matrix_impl!(Iso2, Rot2, Vec2, Vec1)
|
||||
rotation_impl!(Iso2, Rot2, Vec1)
|
||||
dim_impl!(Iso2, 2)
|
||||
@ -104,18 +102,16 @@ rand_impl!(Iso2)
|
||||
approx_eq_impl!(Iso2)
|
||||
to_homogeneous_impl!(Iso2, Mat3)
|
||||
inv_impl!(Iso2)
|
||||
transform_impl!(Iso2TransformRhs, Iso2, Vec2, Pnt2)
|
||||
transform_impl!(Iso2, Pnt2)
|
||||
transformation_impl!(Iso2)
|
||||
rotate_impl!(Iso2, Vec2)
|
||||
translation_impl!(Iso2, Vec2)
|
||||
translate_impl!(Iso2, Pnt2)
|
||||
iso_mul_iso_impl!(Iso2, Iso2MulRhs)
|
||||
iso_mul_pnt_impl!(Iso2, Pnt2, Iso2MulRhs)
|
||||
pnt_mul_iso_impl!(Iso2, Pnt2, Pnt2MulRhs)
|
||||
iso_mul_iso_impl!(Iso2)
|
||||
iso_mul_pnt_impl!(Iso2, Pnt2)
|
||||
pnt_mul_iso_impl!(Iso2, Pnt2)
|
||||
|
||||
iso_impl!(Iso3, Rot3, Vec3, Vec3)
|
||||
double_dispatch_binop_decl_trait!(Iso3, Iso3MulRhs)
|
||||
mul_redispatch_impl!(Iso3, Iso3MulRhs)
|
||||
rotation_matrix_impl!(Iso3, Rot3, Vec3, Vec3)
|
||||
rotation_impl!(Iso3, Rot3, Vec3)
|
||||
dim_impl!(Iso3, 3)
|
||||
@ -125,18 +121,16 @@ rand_impl!(Iso3)
|
||||
approx_eq_impl!(Iso3)
|
||||
to_homogeneous_impl!(Iso3, Mat4)
|
||||
inv_impl!(Iso3)
|
||||
transform_impl!(Iso3TransformRhs, Iso3, Vec3, Pnt3)
|
||||
transform_impl!(Iso3, Pnt3)
|
||||
transformation_impl!(Iso3)
|
||||
rotate_impl!(Iso3, Vec3)
|
||||
translation_impl!(Iso3, Vec3)
|
||||
translate_impl!(Iso3, Pnt3)
|
||||
iso_mul_iso_impl!(Iso3, Iso3MulRhs)
|
||||
iso_mul_pnt_impl!(Iso3, Pnt3, Iso3MulRhs)
|
||||
pnt_mul_iso_impl!(Iso3, Pnt3, Pnt3MulRhs)
|
||||
iso_mul_iso_impl!(Iso3)
|
||||
iso_mul_pnt_impl!(Iso3, Pnt3)
|
||||
pnt_mul_iso_impl!(Iso3, Pnt3)
|
||||
|
||||
// iso_impl!(Iso4, Rot4, Vec4, Vec4)
|
||||
double_dispatch_binop_decl_trait!(Iso4, Iso4MulRhs)
|
||||
mul_redispatch_impl!(Iso4, Iso4MulRhs)
|
||||
// rotation_matrix_impl!(Iso4, Rot4, Vec4, Vec4)
|
||||
// rotation_impl!(Iso4, Rot4, Vec4)
|
||||
dim_impl!(Iso4, 4)
|
||||
@ -146,11 +140,11 @@ absolute_rotate_impl!(Iso4, Vec4)
|
||||
approx_eq_impl!(Iso4)
|
||||
to_homogeneous_impl!(Iso4, Mat5)
|
||||
inv_impl!(Iso4)
|
||||
transform_impl!(Iso4TransformRhs, Iso4, Vec4, Pnt4)
|
||||
transform_impl!(Iso4, Pnt4)
|
||||
transformation_impl!(Iso4)
|
||||
rotate_impl!(Iso4, Vec4)
|
||||
translation_impl!(Iso4, Vec4)
|
||||
translate_impl!(Iso4, Pnt4)
|
||||
iso_mul_iso_impl!(Iso4, Iso4MulRhs)
|
||||
iso_mul_pnt_impl!(Iso4, Pnt4, Iso4MulRhs)
|
||||
pnt_mul_iso_impl!(Iso4, Pnt4, Pnt4MulRhs)
|
||||
iso_mul_iso_impl!(Iso4)
|
||||
iso_mul_pnt_impl!(Iso4, Pnt4)
|
||||
pnt_mul_iso_impl!(Iso4, Pnt4)
|
||||
|
@ -60,35 +60,35 @@ macro_rules! one_impl(
|
||||
)
|
||||
|
||||
macro_rules! iso_mul_iso_impl(
|
||||
($t: ident, $tmul: ident) => (
|
||||
impl<N: BaseFloat + Clone> $tmul<N, $t<N>> for $t<N> {
|
||||
($t: ident) => (
|
||||
impl<N: BaseFloat + Clone> Mul<$t<N>, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$t<N>) -> $t<N> {
|
||||
fn mul(&self, right: &$t<N>) -> $t<N> {
|
||||
$t::new_with_rotmat(
|
||||
left.translation + left.rotation * right.translation,
|
||||
left.rotation * right.rotation)
|
||||
self.translation + self.rotation * right.translation,
|
||||
self.rotation * right.rotation)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! iso_mul_pnt_impl(
|
||||
($t: ident, $tv: ident, $tmul: ident) => (
|
||||
impl<N: BaseNum + Clone> $tmul<N, $tv<N>> for $tv<N> {
|
||||
($t: ident, $tv: ident) => (
|
||||
impl<N: BaseNum + Clone> Mul<$tv<N>, $tv<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$tv<N>) -> $tv<N> {
|
||||
left.rotation * *right + left.translation
|
||||
fn mul(&self, right: &$tv<N>) -> $tv<N> {
|
||||
self.rotation * *right + self.translation
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! pnt_mul_iso_impl(
|
||||
($t: ident, $tv: ident, $tmul: ident) => (
|
||||
impl<N: Clone + BaseNum> $tmul<N, $tv<N>> for $t<N> {
|
||||
($t: ident, $tv: ident) => (
|
||||
impl<N: Clone + BaseNum> Mul<$t<N>, $tv<N>> for $tv<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$tv<N>, right: &$t<N>) -> $tv<N> {
|
||||
(*left + right.translation) * right.rotation
|
||||
fn mul(&self, right: &$t<N>) -> $tv<N> {
|
||||
(*self + right.translation) * right.rotation
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -254,37 +254,16 @@ macro_rules! transformation_impl(
|
||||
)
|
||||
|
||||
macro_rules! transform_impl(
|
||||
($trhs: ident, $t: ident, $tv: ident, $tp: ident) => (
|
||||
/*
|
||||
* FIXME: we use the double dispatch trick here so that we can transform vectors _and_
|
||||
* points. Remove this as soon as rust supports multidispatch.
|
||||
*/
|
||||
pub trait $trhs<N> {
|
||||
fn transform(left: &$t<N>, right: &Self) -> Self;
|
||||
fn inv_transform(left: &$t<N>, right: &Self) -> Self;
|
||||
}
|
||||
|
||||
impl<N, V: $trhs<N>> Transform<V> for $t<N> {
|
||||
#[inline(always)]
|
||||
fn transform(&self, other: &V) -> V {
|
||||
$trhs::transform(self, other)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn inv_transform(&self, other: &V) -> V {
|
||||
$trhs::inv_transform(self, other)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: BaseNum + Clone> $trhs<N> for $tp<N> {
|
||||
($t: ident, $tp: ident) => (
|
||||
impl<N: BaseNum + Clone> Transform<$tp<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn transform(t: &$t<N>, p: &$tp<N>) -> $tp<N> {
|
||||
t.rotation.transform(p) + t.translation
|
||||
fn transform(&self, p: &$tp<N>) -> $tp<N> {
|
||||
self.rotation.transform(p) + self.translation
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn inv_transform(t: &$t<N>, p: &$tp<N>) -> $tp<N> {
|
||||
t.rotation.inv_transform(&(*p - t.translation))
|
||||
fn inv_transform(&self, p: &$tp<N>) -> $tp<N> {
|
||||
self.rotation.inv_transform(&(*p - self.translation))
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -5,9 +5,8 @@
|
||||
use std::mem;
|
||||
use traits::operations::ApproxEq;
|
||||
use std::slice::{Items, MutItems};
|
||||
use structs::vec::{Vec1, Vec2, Vec3, Vec4, Vec5, Vec6,
|
||||
Vec1MulRhs, Vec4MulRhs, Vec5MulRhs, Vec6MulRhs};
|
||||
use structs::pnt::{Pnt1, Pnt4, Pnt5, Pnt6, Pnt1MulRhs, Pnt4MulRhs, Pnt5MulRhs, Pnt6MulRhs};
|
||||
use structs::vec::{Vec1, Vec2, Vec3, Vec4, Vec5, Vec6};
|
||||
use structs::pnt::{Pnt1, Pnt4, Pnt5, Pnt6};
|
||||
use structs::dvec::{DVec1, DVec2, DVec3, DVec4, DVec5, DVec6};
|
||||
|
||||
use traits::structure::{Cast, Row, Col, Iterable, IterableMut, Dim, Indexable,
|
||||
@ -37,74 +36,15 @@ pub struct Mat1<N> {
|
||||
|
||||
eye_impl!(Mat1, 1, m11)
|
||||
|
||||
double_dispatch_binop_decl_trait!(Mat1, Mat1MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat1, Mat1DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat1, Mat1AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat1, Mat1SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Mat1, Mat1Cast)
|
||||
mul_redispatch_impl!(Mat1, Mat1MulRhs)
|
||||
div_redispatch_impl!(Mat1, Mat1DivRhs)
|
||||
add_redispatch_impl!(Mat1, Mat1AddRhs)
|
||||
sub_redispatch_impl!(Mat1, Mat1SubRhs)
|
||||
cast_redispatch_impl!(Mat1, Mat1Cast)
|
||||
mat_impl!(Mat1, m11)
|
||||
as_array_impl!(Mat1, 1)
|
||||
mat_cast_impl!(Mat1, Mat1Cast, m11)
|
||||
add_impl!(Mat1, Mat1AddRhs, m11)
|
||||
sub_impl!(Mat1, Mat1SubRhs, m11)
|
||||
|
||||
mat_mul_scalar_impl!(Mat1, f64, Mat1MulRhs, m11)
|
||||
mat_mul_scalar_impl!(Mat1, f32, Mat1MulRhs, m11)
|
||||
mat_mul_scalar_impl!(Mat1, i64, Mat1MulRhs, m11)
|
||||
mat_mul_scalar_impl!(Mat1, i32, Mat1MulRhs, m11)
|
||||
mat_mul_scalar_impl!(Mat1, i16, Mat1MulRhs, m11)
|
||||
mat_mul_scalar_impl!(Mat1, i8, Mat1MulRhs, m11)
|
||||
mat_mul_scalar_impl!(Mat1, u64, Mat1MulRhs, m11)
|
||||
mat_mul_scalar_impl!(Mat1, u32, Mat1MulRhs, m11)
|
||||
mat_mul_scalar_impl!(Mat1, u16, Mat1MulRhs, m11)
|
||||
mat_mul_scalar_impl!(Mat1, u8, Mat1MulRhs, m11)
|
||||
mat_mul_scalar_impl!(Mat1, uint, Mat1MulRhs, m11)
|
||||
mat_mul_scalar_impl!(Mat1, int, Mat1MulRhs, m11)
|
||||
|
||||
mat_div_scalar_impl!(Mat1, f64, Mat1DivRhs, m11)
|
||||
mat_div_scalar_impl!(Mat1, f32, Mat1DivRhs, m11)
|
||||
mat_div_scalar_impl!(Mat1, i64, Mat1DivRhs, m11)
|
||||
mat_div_scalar_impl!(Mat1, i32, Mat1DivRhs, m11)
|
||||
mat_div_scalar_impl!(Mat1, i16, Mat1DivRhs, m11)
|
||||
mat_div_scalar_impl!(Mat1, i8, Mat1DivRhs, m11)
|
||||
mat_div_scalar_impl!(Mat1, u64, Mat1DivRhs, m11)
|
||||
mat_div_scalar_impl!(Mat1, u32, Mat1DivRhs, m11)
|
||||
mat_div_scalar_impl!(Mat1, u16, Mat1DivRhs, m11)
|
||||
mat_div_scalar_impl!(Mat1, u8, Mat1DivRhs, m11)
|
||||
mat_div_scalar_impl!(Mat1, uint, Mat1DivRhs, m11)
|
||||
mat_div_scalar_impl!(Mat1, int, Mat1DivRhs, m11)
|
||||
|
||||
mat_add_scalar_impl!(Mat1, f64, Mat1AddRhs, m11)
|
||||
mat_add_scalar_impl!(Mat1, f32, Mat1AddRhs, m11)
|
||||
mat_add_scalar_impl!(Mat1, i64, Mat1AddRhs, m11)
|
||||
mat_add_scalar_impl!(Mat1, i32, Mat1AddRhs, m11)
|
||||
mat_add_scalar_impl!(Mat1, i16, Mat1AddRhs, m11)
|
||||
mat_add_scalar_impl!(Mat1, i8, Mat1AddRhs, m11)
|
||||
mat_add_scalar_impl!(Mat1, u64, Mat1AddRhs, m11)
|
||||
mat_add_scalar_impl!(Mat1, u32, Mat1AddRhs, m11)
|
||||
mat_add_scalar_impl!(Mat1, u16, Mat1AddRhs, m11)
|
||||
mat_add_scalar_impl!(Mat1, u8, Mat1AddRhs, m11)
|
||||
mat_add_scalar_impl!(Mat1, uint, Mat1AddRhs, m11)
|
||||
mat_add_scalar_impl!(Mat1, int, Mat1AddRhs, m11)
|
||||
|
||||
mat_sub_scalar_impl!(Mat1, f64, Mat1SubRhs, m11)
|
||||
mat_sub_scalar_impl!(Mat1, f32, Mat1SubRhs, m11)
|
||||
mat_sub_scalar_impl!(Mat1, i64, Mat1SubRhs, m11)
|
||||
mat_sub_scalar_impl!(Mat1, i32, Mat1SubRhs, m11)
|
||||
mat_sub_scalar_impl!(Mat1, i16, Mat1SubRhs, m11)
|
||||
mat_sub_scalar_impl!(Mat1, i8, Mat1SubRhs, m11)
|
||||
mat_sub_scalar_impl!(Mat1, u64, Mat1SubRhs, m11)
|
||||
mat_sub_scalar_impl!(Mat1, u32, Mat1SubRhs, m11)
|
||||
mat_sub_scalar_impl!(Mat1, u16, Mat1SubRhs, m11)
|
||||
mat_sub_scalar_impl!(Mat1, u8, Mat1SubRhs, m11)
|
||||
mat_sub_scalar_impl!(Mat1, uint, Mat1SubRhs, m11)
|
||||
mat_sub_scalar_impl!(Mat1, int, Mat1SubRhs, m11)
|
||||
|
||||
mat_cast_impl!(Mat1, m11)
|
||||
add_impl!(Mat1, m11)
|
||||
sub_impl!(Mat1, m11)
|
||||
scalar_add_impl!(Mat1, m11)
|
||||
scalar_sub_impl!(Mat1, m11)
|
||||
scalar_mul_impl!(Mat1, m11)
|
||||
scalar_div_impl!(Mat1, m11)
|
||||
absolute_impl!(Mat1, m11)
|
||||
zero_impl!(Mat1, m11)
|
||||
one_impl!(Mat1, ::one)
|
||||
@ -114,11 +54,11 @@ at_fast_impl!(Mat1, 1)
|
||||
dim_impl!(Mat1, 1)
|
||||
indexable_impl!(Mat1, 1)
|
||||
index_impl!(Mat1, 1)
|
||||
mat_mul_mat_impl!(Mat1, Mat1MulRhs, 1)
|
||||
mat_mul_vec_impl!(Mat1, Vec1, Mat1MulRhs, 1, ::zero)
|
||||
vec_mul_mat_impl!(Mat1, Vec1, Vec1MulRhs, 1, ::zero)
|
||||
mat_mul_pnt_impl!(Mat1, Pnt1, Mat1MulRhs, 1, Orig::orig)
|
||||
pnt_mul_mat_impl!(Mat1, Pnt1, Pnt1MulRhs, 1, Orig::orig)
|
||||
mat_mul_mat_impl!(Mat1, 1)
|
||||
mat_mul_vec_impl!(Mat1, Vec1, 1, ::zero)
|
||||
vec_mul_mat_impl!(Mat1, Vec1, 1, ::zero)
|
||||
mat_mul_pnt_impl!(Mat1, Pnt1, 1, Orig::orig)
|
||||
pnt_mul_mat_impl!(Mat1, Pnt1, 1, Orig::orig)
|
||||
// (specialized) inv_impl!(Mat1, 1)
|
||||
transpose_impl!(Mat1, 1)
|
||||
approx_eq_impl!(Mat1)
|
||||
@ -141,81 +81,22 @@ pub struct Mat2<N> {
|
||||
|
||||
eye_impl!(Mat2, 2, m11, m22)
|
||||
|
||||
double_dispatch_binop_decl_trait!(Mat2, Mat2MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat2, Mat2DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat2, Mat2AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat2, Mat2SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Mat2, Mat2Cast)
|
||||
mul_redispatch_impl!(Mat2, Mat2MulRhs)
|
||||
div_redispatch_impl!(Mat2, Mat2DivRhs)
|
||||
add_redispatch_impl!(Mat2, Mat2AddRhs)
|
||||
sub_redispatch_impl!(Mat2, Mat2SubRhs)
|
||||
cast_redispatch_impl!(Mat2, Mat2Cast)
|
||||
mat_impl!(Mat2, m11, m12,
|
||||
m21, m22)
|
||||
as_array_impl!(Mat2, 2)
|
||||
mat_cast_impl!(Mat2, Mat2Cast, m11, m12,
|
||||
m21, m22)
|
||||
add_impl!(Mat2, Mat2AddRhs, m11, m12, m21, m22)
|
||||
sub_impl!(Mat2, Mat2SubRhs, m11, m12, m21, m22)
|
||||
|
||||
mat_mul_scalar_impl!(Mat2, f64, Mat2MulRhs, m11, m12, m21, m22)
|
||||
mat_mul_scalar_impl!(Mat2, f32, Mat2MulRhs, m11, m12, m21, m22)
|
||||
mat_mul_scalar_impl!(Mat2, i64, Mat2MulRhs, m11, m12, m21, m22)
|
||||
mat_mul_scalar_impl!(Mat2, i32, Mat2MulRhs, m11, m12, m21, m22)
|
||||
mat_mul_scalar_impl!(Mat2, i16, Mat2MulRhs, m11, m12, m21, m22)
|
||||
mat_mul_scalar_impl!(Mat2, i8, Mat2MulRhs, m11, m12, m21, m22)
|
||||
mat_mul_scalar_impl!(Mat2, u64, Mat2MulRhs, m11, m12, m21, m22)
|
||||
mat_mul_scalar_impl!(Mat2, u32, Mat2MulRhs, m11, m12, m21, m22)
|
||||
mat_mul_scalar_impl!(Mat2, u16, Mat2MulRhs, m11, m12, m21, m22)
|
||||
mat_mul_scalar_impl!(Mat2, u8, Mat2MulRhs, m11, m12, m21, m22)
|
||||
mat_mul_scalar_impl!(Mat2, uint, Mat2MulRhs, m11, m12, m21, m22)
|
||||
mat_mul_scalar_impl!(Mat2, int, Mat2MulRhs, m11, m12, m21, m22)
|
||||
|
||||
mat_div_scalar_impl!(Mat2, f64, Mat2DivRhs, m11, m12, m21, m22)
|
||||
mat_div_scalar_impl!(Mat2, f32, Mat2DivRhs, m11, m12, m21, m22)
|
||||
mat_div_scalar_impl!(Mat2, i64, Mat2DivRhs, m11, m12, m21, m22)
|
||||
mat_div_scalar_impl!(Mat2, i32, Mat2DivRhs, m11, m12, m21, m22)
|
||||
mat_div_scalar_impl!(Mat2, i16, Mat2DivRhs, m11, m12, m21, m22)
|
||||
mat_div_scalar_impl!(Mat2, i8, Mat2DivRhs, m11, m12, m21, m22)
|
||||
mat_div_scalar_impl!(Mat2, u64, Mat2DivRhs, m11, m12, m21, m22)
|
||||
mat_div_scalar_impl!(Mat2, u32, Mat2DivRhs, m11, m12, m21, m22)
|
||||
mat_div_scalar_impl!(Mat2, u16, Mat2DivRhs, m11, m12, m21, m22)
|
||||
mat_div_scalar_impl!(Mat2, u8, Mat2DivRhs, m11, m12, m21, m22)
|
||||
mat_div_scalar_impl!(Mat2, uint, Mat2DivRhs, m11, m12, m21, m22)
|
||||
mat_div_scalar_impl!(Mat2, int, Mat2DivRhs, m11, m12, m21, m22)
|
||||
|
||||
mat_add_scalar_impl!(Mat2, f64, Mat2AddRhs, m11, m12, m21, m22)
|
||||
mat_add_scalar_impl!(Mat2, f32, Mat2AddRhs, m11, m12, m21, m22)
|
||||
mat_add_scalar_impl!(Mat2, i64, Mat2AddRhs, m11, m12, m21, m22)
|
||||
mat_add_scalar_impl!(Mat2, i32, Mat2AddRhs, m11, m12, m21, m22)
|
||||
mat_add_scalar_impl!(Mat2, i16, Mat2AddRhs, m11, m12, m21, m22)
|
||||
mat_add_scalar_impl!(Mat2, i8, Mat2AddRhs, m11, m12, m21, m22)
|
||||
mat_add_scalar_impl!(Mat2, u64, Mat2AddRhs, m11, m12, m21, m22)
|
||||
mat_add_scalar_impl!(Mat2, u32, Mat2AddRhs, m11, m12, m21, m22)
|
||||
mat_add_scalar_impl!(Mat2, u16, Mat2AddRhs, m11, m12, m21, m22)
|
||||
mat_add_scalar_impl!(Mat2, u8, Mat2AddRhs, m11, m12, m21, m22)
|
||||
mat_add_scalar_impl!(Mat2, uint, Mat2AddRhs, m11, m12, m21, m22)
|
||||
mat_add_scalar_impl!(Mat2, int, Mat2AddRhs, m11, m12, m21, m22)
|
||||
|
||||
mat_sub_scalar_impl!(Mat2, f64, Mat2SubRhs, m11, m12, m21, m22)
|
||||
mat_sub_scalar_impl!(Mat2, f32, Mat2SubRhs, m11, m12, m21, m22)
|
||||
mat_sub_scalar_impl!(Mat2, i64, Mat2SubRhs, m11, m12, m21, m22)
|
||||
mat_sub_scalar_impl!(Mat2, i32, Mat2SubRhs, m11, m12, m21, m22)
|
||||
mat_sub_scalar_impl!(Mat2, i16, Mat2SubRhs, m11, m12, m21, m22)
|
||||
mat_sub_scalar_impl!(Mat2, i8, Mat2SubRhs, m11, m12, m21, m22)
|
||||
mat_sub_scalar_impl!(Mat2, u64, Mat2SubRhs, m11, m12, m21, m22)
|
||||
mat_sub_scalar_impl!(Mat2, u32, Mat2SubRhs, m11, m12, m21, m22)
|
||||
mat_sub_scalar_impl!(Mat2, u16, Mat2SubRhs, m11, m12, m21, m22)
|
||||
mat_sub_scalar_impl!(Mat2, u8, Mat2SubRhs, m11, m12, m21, m22)
|
||||
mat_sub_scalar_impl!(Mat2, uint, Mat2SubRhs, m11, m12, m21, m22)
|
||||
mat_sub_scalar_impl!(Mat2, int, Mat2SubRhs, m11, m12, m21, m22)
|
||||
|
||||
mat_cast_impl!(Mat2, m11, m12,
|
||||
m21, m22)
|
||||
add_impl!(Mat2, m11, m12, m21, m22)
|
||||
sub_impl!(Mat2, m11, m12, m21, m22)
|
||||
scalar_add_impl!(Mat2, m11, m12, m21, m22)
|
||||
scalar_sub_impl!(Mat2, m11, m12, m21, m22)
|
||||
scalar_mul_impl!(Mat2, m11, m12, m21, m22)
|
||||
scalar_div_impl!(Mat2, m11, m12, m21, m22)
|
||||
absolute_impl!(Mat2, m11, m12,
|
||||
m21, m22)
|
||||
zero_impl!(Mat2, m11, m12,
|
||||
m21, m22)
|
||||
one_impl!(Mat2, ::one, ::zero,
|
||||
one_impl!(Mat2, ::one, ::zero,
|
||||
::zero, ::one)
|
||||
iterable_impl!(Mat2, 2)
|
||||
iterable_mut_impl!(Mat2, 2)
|
||||
@ -249,85 +130,43 @@ pub struct Mat3<N> {
|
||||
|
||||
eye_impl!(Mat3, 3, m11, m22, m33)
|
||||
|
||||
double_dispatch_binop_decl_trait!(Mat3, Mat3MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat3, Mat3DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat3, Mat3AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat3, Mat3SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Mat3, Mat3Cast)
|
||||
mul_redispatch_impl!(Mat3, Mat3MulRhs)
|
||||
div_redispatch_impl!(Mat3, Mat3DivRhs)
|
||||
add_redispatch_impl!(Mat3, Mat3AddRhs)
|
||||
sub_redispatch_impl!(Mat3, Mat3SubRhs)
|
||||
cast_redispatch_impl!(Mat3, Mat3Cast)
|
||||
mat_impl!(Mat3, m11, m12, m13,
|
||||
m21, m22, m23,
|
||||
m31, m32, m33)
|
||||
as_array_impl!(Mat3, 3)
|
||||
mat_cast_impl!(Mat3, Mat3Cast, m11, m12, m13,
|
||||
m21, m22, m23,
|
||||
m31, m32, m33)
|
||||
add_impl!(Mat3, Mat3AddRhs,
|
||||
mat_cast_impl!(Mat3, m11, m12, m13,
|
||||
m21, m22, m23,
|
||||
m31, m32, m33)
|
||||
add_impl!(Mat3,
|
||||
m11, m12, m13,
|
||||
m21, m22, m23,
|
||||
m31, m32, m33
|
||||
)
|
||||
sub_impl!(Mat3, Mat3SubRhs,
|
||||
sub_impl!(Mat3,
|
||||
m11, m12, m13,
|
||||
m21, m22, m23,
|
||||
m31, m32, m33
|
||||
)
|
||||
scalar_add_impl!(Mat3,
|
||||
m11, m12, m13,
|
||||
m21, m22, m23,
|
||||
m31, m32, m33
|
||||
)
|
||||
scalar_sub_impl!(Mat3,
|
||||
m11, m12, m13,
|
||||
m21, m22, m23,
|
||||
m31, m32, m33
|
||||
)
|
||||
scalar_mul_impl!(Mat3,
|
||||
m11, m12, m13,
|
||||
m21, m22, m23,
|
||||
m31, m32, m33
|
||||
)
|
||||
scalar_div_impl!(Mat3,
|
||||
m11, m12, m13,
|
||||
m21, m22, m23,
|
||||
m31, m32, m33
|
||||
)
|
||||
mat_mul_scalar_impl!(Mat3, f64, Mat3MulRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_mul_scalar_impl!(Mat3, f32, Mat3MulRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_mul_scalar_impl!(Mat3, i64, Mat3MulRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_mul_scalar_impl!(Mat3, i32, Mat3MulRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_mul_scalar_impl!(Mat3, i16, Mat3MulRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_mul_scalar_impl!(Mat3, i8, Mat3MulRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_mul_scalar_impl!(Mat3, u64, Mat3MulRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_mul_scalar_impl!(Mat3, u32, Mat3MulRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_mul_scalar_impl!(Mat3, u16, Mat3MulRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_mul_scalar_impl!(Mat3, u8, Mat3MulRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_mul_scalar_impl!(Mat3, uint, Mat3MulRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_mul_scalar_impl!(Mat3, int, Mat3MulRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
|
||||
mat_div_scalar_impl!(Mat3, f64, Mat3DivRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_div_scalar_impl!(Mat3, f32, Mat3DivRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_div_scalar_impl!(Mat3, i64, Mat3DivRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_div_scalar_impl!(Mat3, i32, Mat3DivRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_div_scalar_impl!(Mat3, i16, Mat3DivRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_div_scalar_impl!(Mat3, i8, Mat3DivRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_div_scalar_impl!(Mat3, u64, Mat3DivRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_div_scalar_impl!(Mat3, u32, Mat3DivRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_div_scalar_impl!(Mat3, u16, Mat3DivRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_div_scalar_impl!(Mat3, u8, Mat3DivRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_div_scalar_impl!(Mat3, uint, Mat3DivRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_div_scalar_impl!(Mat3, int, Mat3DivRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
|
||||
mat_add_scalar_impl!(Mat3, f64, Mat3AddRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_add_scalar_impl!(Mat3, f32, Mat3AddRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_add_scalar_impl!(Mat3, i64, Mat3AddRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_add_scalar_impl!(Mat3, i32, Mat3AddRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_add_scalar_impl!(Mat3, i16, Mat3AddRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_add_scalar_impl!(Mat3, i8, Mat3AddRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_add_scalar_impl!(Mat3, u64, Mat3AddRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_add_scalar_impl!(Mat3, u32, Mat3AddRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_add_scalar_impl!(Mat3, u16, Mat3AddRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_add_scalar_impl!(Mat3, u8, Mat3AddRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_add_scalar_impl!(Mat3, uint, Mat3AddRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_add_scalar_impl!(Mat3, int, Mat3AddRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
|
||||
mat_sub_scalar_impl!(Mat3, f64, Mat3SubRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_sub_scalar_impl!(Mat3, f32, Mat3SubRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_sub_scalar_impl!(Mat3, i64, Mat3SubRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_sub_scalar_impl!(Mat3, i32, Mat3SubRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_sub_scalar_impl!(Mat3, i16, Mat3SubRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_sub_scalar_impl!(Mat3, i8, Mat3SubRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_sub_scalar_impl!(Mat3, u64, Mat3SubRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_sub_scalar_impl!(Mat3, u32, Mat3SubRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_sub_scalar_impl!(Mat3, u16, Mat3SubRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_sub_scalar_impl!(Mat3, u8, Mat3SubRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_sub_scalar_impl!(Mat3, uint, Mat3SubRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
mat_sub_scalar_impl!(Mat3, int, Mat3SubRhs, m11, m12, m13, m21, m22, m23, m31, m32, m33)
|
||||
|
||||
absolute_impl!(Mat3,
|
||||
m11, m12, m13,
|
||||
m21, m22, m23,
|
||||
@ -338,8 +177,8 @@ zero_impl!(Mat3,
|
||||
m21, m22, m23,
|
||||
m31, m32, m33
|
||||
)
|
||||
one_impl!(Mat3, ::one , ::zero, ::zero,
|
||||
::zero, ::one , ::zero,
|
||||
one_impl!(Mat3, ::one , ::zero, ::zero,
|
||||
::zero, ::one , ::zero,
|
||||
::zero, ::zero, ::one)
|
||||
iterable_impl!(Mat3, 3)
|
||||
iterable_mut_impl!(Mat3, 3)
|
||||
@ -374,16 +213,6 @@ pub struct Mat4<N> {
|
||||
|
||||
eye_impl!(Mat4, 4, m11, m22, m33, m44)
|
||||
|
||||
double_dispatch_binop_decl_trait!(Mat4, Mat4MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat4, Mat4DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat4, Mat4AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat4, Mat4SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Mat4, Mat4Cast)
|
||||
mul_redispatch_impl!(Mat4, Mat4MulRhs)
|
||||
div_redispatch_impl!(Mat4, Mat4DivRhs)
|
||||
add_redispatch_impl!(Mat4, Mat4AddRhs)
|
||||
sub_redispatch_impl!(Mat4, Mat4SubRhs)
|
||||
cast_redispatch_impl!(Mat4, Mat4Cast)
|
||||
mat_impl!(Mat4,
|
||||
m11, m12, m13, m14,
|
||||
m21, m22, m23, m24,
|
||||
@ -391,117 +220,48 @@ mat_impl!(Mat4,
|
||||
m41, m42, m43, m44
|
||||
)
|
||||
as_array_impl!(Mat4, 4)
|
||||
mat_cast_impl!(Mat4, Mat4Cast,
|
||||
mat_cast_impl!(Mat4,
|
||||
m11, m12, m13, m14,
|
||||
m21, m22, m23, m24,
|
||||
m31, m32, m33, m34,
|
||||
m41, m42, m43, m44
|
||||
)
|
||||
add_impl!(Mat4, Mat4AddRhs,
|
||||
add_impl!(Mat4,
|
||||
m11, m12, m13, m14,
|
||||
m21, m22, m23, m24,
|
||||
m31, m32, m33, m34,
|
||||
m41, m42, m43, m44
|
||||
)
|
||||
sub_impl!(Mat4, Mat4SubRhs,
|
||||
sub_impl!(Mat4,
|
||||
m11, m12, m13, m14,
|
||||
m21, m22, m23, m24,
|
||||
m31, m32, m33, m34,
|
||||
m41, m42, m43, m44
|
||||
)
|
||||
scalar_add_impl!(Mat4,
|
||||
m11, m12, m13, m14,
|
||||
m21, m22, m23, m24,
|
||||
m31, m32, m33, m34,
|
||||
m41, m42, m43, m44
|
||||
)
|
||||
scalar_sub_impl!(Mat4,
|
||||
m11, m12, m13, m14,
|
||||
m21, m22, m23, m24,
|
||||
m31, m32, m33, m34,
|
||||
m41, m42, m43, m44
|
||||
)
|
||||
scalar_mul_impl!(Mat4,
|
||||
m11, m12, m13, m14,
|
||||
m21, m22, m23, m24,
|
||||
m31, m32, m33, m34,
|
||||
m41, m42, m43, m44
|
||||
)
|
||||
scalar_div_impl!(Mat4,
|
||||
m11, m12, m13, m14,
|
||||
m21, m22, m23, m24,
|
||||
m31, m32, m33, m34,
|
||||
m41, m42, m43, m44
|
||||
)
|
||||
|
||||
mat_mul_scalar_impl!(Mat4, f64, Mat4MulRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_mul_scalar_impl!(Mat4, f32, Mat4MulRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_mul_scalar_impl!(Mat4, i64, Mat4MulRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_mul_scalar_impl!(Mat4, i32, Mat4MulRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_mul_scalar_impl!(Mat4, i16, Mat4MulRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_mul_scalar_impl!(Mat4, i8, Mat4MulRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_mul_scalar_impl!(Mat4, u32, Mat4MulRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_mul_scalar_impl!(Mat4, u16, Mat4MulRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_mul_scalar_impl!(Mat4, u8, Mat4MulRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_mul_scalar_impl!(Mat4, uint, Mat4MulRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_mul_scalar_impl!(Mat4, int, Mat4MulRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
|
||||
mat_div_scalar_impl!(Mat4, f64, Mat4DivRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_div_scalar_impl!(Mat4, f32, Mat4DivRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_div_scalar_impl!(Mat4, i64, Mat4DivRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_div_scalar_impl!(Mat4, i32, Mat4DivRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_div_scalar_impl!(Mat4, i16, Mat4DivRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_div_scalar_impl!(Mat4, i8, Mat4DivRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_div_scalar_impl!(Mat4, u32, Mat4DivRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_div_scalar_impl!(Mat4, u16, Mat4DivRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_div_scalar_impl!(Mat4, u8, Mat4DivRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_div_scalar_impl!(Mat4, uint, Mat4DivRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_div_scalar_impl!(Mat4, int, Mat4DivRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
|
||||
mat_add_scalar_impl!(Mat4, f64, Mat4AddRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_add_scalar_impl!(Mat4, f32, Mat4AddRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_add_scalar_impl!(Mat4, i64, Mat4AddRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_add_scalar_impl!(Mat4, i32, Mat4AddRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_add_scalar_impl!(Mat4, i16, Mat4AddRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_add_scalar_impl!(Mat4, i8, Mat4AddRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_add_scalar_impl!(Mat4, u32, Mat4AddRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_add_scalar_impl!(Mat4, u16, Mat4AddRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_add_scalar_impl!(Mat4, u8, Mat4AddRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_add_scalar_impl!(Mat4, uint, Mat4AddRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_add_scalar_impl!(Mat4, int, Mat4AddRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
|
||||
mat_sub_scalar_impl!(Mat4, f64, Mat4SubRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_sub_scalar_impl!(Mat4, f32, Mat4SubRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_sub_scalar_impl!(Mat4, i64, Mat4SubRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_sub_scalar_impl!(Mat4, i32, Mat4SubRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_sub_scalar_impl!(Mat4, i16, Mat4SubRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_sub_scalar_impl!(Mat4, i8, Mat4SubRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_sub_scalar_impl!(Mat4, u32, Mat4SubRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_sub_scalar_impl!(Mat4, u16, Mat4SubRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_sub_scalar_impl!(Mat4, u8, Mat4SubRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_sub_scalar_impl!(Mat4, uint, Mat4SubRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
mat_sub_scalar_impl!(Mat4, int, Mat4SubRhs, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34,
|
||||
m41, m42, m43, m44)
|
||||
|
||||
absolute_impl!(Mat4,
|
||||
m11, m12, m13, m14,
|
||||
m21, m22, m23, m24,
|
||||
@ -524,11 +284,11 @@ dim_impl!(Mat4, 4)
|
||||
indexable_impl!(Mat4, 4)
|
||||
index_impl!(Mat4, 4)
|
||||
at_fast_impl!(Mat4, 4)
|
||||
mat_mul_mat_impl!(Mat4, Mat4MulRhs, 4)
|
||||
mat_mul_vec_impl!(Mat4, Vec4, Mat4MulRhs, 4, ::zero)
|
||||
vec_mul_mat_impl!(Mat4, Vec4, Vec4MulRhs, 4, ::zero)
|
||||
mat_mul_pnt_impl!(Mat4, Pnt4, Mat4MulRhs, 4, Orig::orig)
|
||||
pnt_mul_mat_impl!(Mat4, Pnt4, Pnt4MulRhs, 4, Orig::orig)
|
||||
mat_mul_mat_impl!(Mat4, 4)
|
||||
mat_mul_vec_impl!(Mat4, Vec4, 4, ::zero)
|
||||
vec_mul_mat_impl!(Mat4, Vec4, 4, ::zero)
|
||||
mat_mul_pnt_impl!(Mat4, Pnt4, 4, Orig::orig)
|
||||
pnt_mul_mat_impl!(Mat4, Pnt4, 4, Orig::orig)
|
||||
inv_impl!(Mat4, 4)
|
||||
transpose_impl!(Mat4, 4)
|
||||
approx_eq_impl!(Mat4)
|
||||
@ -554,16 +314,6 @@ pub struct Mat5<N> {
|
||||
|
||||
eye_impl!(Mat5, 5, m11, m22, m33, m44, m55)
|
||||
|
||||
double_dispatch_binop_decl_trait!(Mat5, Mat5MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat5, Mat5DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat5, Mat5AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat5, Mat5SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Mat5, Mat5Cast)
|
||||
mul_redispatch_impl!(Mat5, Mat5MulRhs)
|
||||
div_redispatch_impl!(Mat5, Mat5DivRhs)
|
||||
add_redispatch_impl!(Mat5, Mat5AddRhs)
|
||||
sub_redispatch_impl!(Mat5, Mat5SubRhs)
|
||||
cast_redispatch_impl!(Mat5, Mat5Cast)
|
||||
mat_impl!(Mat5,
|
||||
m11, m12, m13, m14, m15,
|
||||
m21, m22, m23, m24, m25,
|
||||
@ -572,7 +322,7 @@ mat_impl!(Mat5,
|
||||
m51, m52, m53, m54, m55
|
||||
)
|
||||
as_array_impl!(Mat5, 5)
|
||||
mat_cast_impl!(Mat5, Mat5Cast,
|
||||
mat_cast_impl!(Mat5,
|
||||
m11, m12, m13, m14, m15,
|
||||
m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35,
|
||||
@ -600,131 +350,59 @@ one_impl!(Mat5,
|
||||
::zero, ::zero, ::zero, ::one , ::zero,
|
||||
::zero, ::zero, ::zero, ::zero, ::one
|
||||
)
|
||||
add_impl!(Mat5, Mat5AddRhs,
|
||||
add_impl!(Mat5,
|
||||
m11, m12, m13, m14, m15,
|
||||
m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35,
|
||||
m41, m42, m43, m44, m45,
|
||||
m51, m52, m53, m54, m55
|
||||
)
|
||||
sub_impl!(Mat5, Mat5SubRhs,
|
||||
sub_impl!(Mat5,
|
||||
m11, m12, m13, m14, m15,
|
||||
m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35,
|
||||
m41, m42, m43, m44, m45,
|
||||
m51, m52, m53, m54, m55
|
||||
)
|
||||
scalar_add_impl!(Mat5,
|
||||
m11, m12, m13, m14, m15,
|
||||
m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35,
|
||||
m41, m42, m43, m44, m45,
|
||||
m51, m52, m53, m54, m55
|
||||
)
|
||||
scalar_sub_impl!(Mat5,
|
||||
m11, m12, m13, m14, m15,
|
||||
m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35,
|
||||
m41, m42, m43, m44, m45,
|
||||
m51, m52, m53, m54, m55
|
||||
)
|
||||
scalar_mul_impl!(Mat5,
|
||||
m11, m12, m13, m14, m15,
|
||||
m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35,
|
||||
m41, m42, m43, m44, m45,
|
||||
m51, m52, m53, m54, m55
|
||||
)
|
||||
scalar_div_impl!(Mat5,
|
||||
m11, m12, m13, m14, m15,
|
||||
m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35,
|
||||
m41, m42, m43, m44, m45,
|
||||
m51, m52, m53, m54, m55
|
||||
)
|
||||
mat_mul_scalar_impl!(Mat5, f64, Mat5MulRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_mul_scalar_impl!(Mat5, f32, Mat5MulRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_mul_scalar_impl!(Mat5, i64, Mat5MulRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_mul_scalar_impl!(Mat5, i32, Mat5MulRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_mul_scalar_impl!(Mat5, i16, Mat5MulRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_mul_scalar_impl!(Mat5, i8, Mat5MulRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_mul_scalar_impl!(Mat5, u64, Mat5MulRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_mul_scalar_impl!(Mat5, u32, Mat5MulRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_mul_scalar_impl!(Mat5, u16, Mat5MulRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_mul_scalar_impl!(Mat5, u8, Mat5MulRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_mul_scalar_impl!(Mat5, uint, Mat5MulRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_mul_scalar_impl!(Mat5, int, Mat5MulRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
|
||||
mat_div_scalar_impl!(Mat5, f64, Mat5DivRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_div_scalar_impl!(Mat5, f32, Mat5DivRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_div_scalar_impl!(Mat5, i64, Mat5DivRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_div_scalar_impl!(Mat5, i32, Mat5DivRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_div_scalar_impl!(Mat5, i16, Mat5DivRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_div_scalar_impl!(Mat5, i8, Mat5DivRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_div_scalar_impl!(Mat5, u64, Mat5DivRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_div_scalar_impl!(Mat5, u32, Mat5DivRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_div_scalar_impl!(Mat5, u16, Mat5DivRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_div_scalar_impl!(Mat5, u8, Mat5DivRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_div_scalar_impl!(Mat5, uint, Mat5DivRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_div_scalar_impl!(Mat5, int, Mat5DivRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
|
||||
mat_add_scalar_impl!(Mat5, f64, Mat5AddRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_add_scalar_impl!(Mat5, f32, Mat5AddRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_add_scalar_impl!(Mat5, i64, Mat5AddRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_add_scalar_impl!(Mat5, i32, Mat5AddRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_add_scalar_impl!(Mat5, i16, Mat5AddRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_add_scalar_impl!(Mat5, i8, Mat5AddRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_add_scalar_impl!(Mat5, u64, Mat5AddRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_add_scalar_impl!(Mat5, u32, Mat5AddRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_add_scalar_impl!(Mat5, u16, Mat5AddRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_add_scalar_impl!(Mat5, u8, Mat5AddRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_add_scalar_impl!(Mat5, uint, Mat5AddRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_add_scalar_impl!(Mat5, int, Mat5AddRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
|
||||
mat_sub_scalar_impl!(Mat5, f64, Mat5SubRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_sub_scalar_impl!(Mat5, f32, Mat5SubRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_sub_scalar_impl!(Mat5, i64, Mat5SubRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_sub_scalar_impl!(Mat5, i32, Mat5SubRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_sub_scalar_impl!(Mat5, i16, Mat5SubRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_sub_scalar_impl!(Mat5, i8, Mat5SubRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_sub_scalar_impl!(Mat5, u64, Mat5SubRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_sub_scalar_impl!(Mat5, u32, Mat5SubRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_sub_scalar_impl!(Mat5, u16, Mat5SubRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_sub_scalar_impl!(Mat5, u8, Mat5SubRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_sub_scalar_impl!(Mat5, uint, Mat5SubRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
mat_sub_scalar_impl!(Mat5, int, Mat5SubRhs, m11, m12, m13, m14, m15, m21, m22, m23, m24, m25,
|
||||
m31, m32, m33, m34, m35, m41, m42, m43, m44, m45, m51, m52, m53, m54, m55)
|
||||
|
||||
iterable_impl!(Mat5, 5)
|
||||
iterable_mut_impl!(Mat5, 5)
|
||||
dim_impl!(Mat5, 5)
|
||||
indexable_impl!(Mat5, 5)
|
||||
index_impl!(Mat5, 5)
|
||||
at_fast_impl!(Mat5, 5)
|
||||
mat_mul_mat_impl!(Mat5, Mat5MulRhs, 5)
|
||||
mat_mul_vec_impl!(Mat5, Vec5, Mat5MulRhs, 5, ::zero)
|
||||
vec_mul_mat_impl!(Mat5, Vec5, Vec5MulRhs, 5, ::zero)
|
||||
mat_mul_pnt_impl!(Mat5, Pnt5, Mat5MulRhs, 5, Orig::orig)
|
||||
pnt_mul_mat_impl!(Mat5, Pnt5, Pnt5MulRhs, 5, Orig::orig)
|
||||
mat_mul_mat_impl!(Mat5, 5)
|
||||
mat_mul_vec_impl!(Mat5, Vec5, 5, ::zero)
|
||||
vec_mul_mat_impl!(Mat5, Vec5, 5, ::zero)
|
||||
mat_mul_pnt_impl!(Mat5, Pnt5, 5, Orig::orig)
|
||||
pnt_mul_mat_impl!(Mat5, Pnt5, 5, Orig::orig)
|
||||
inv_impl!(Mat5, 5)
|
||||
transpose_impl!(Mat5, 5)
|
||||
approx_eq_impl!(Mat5)
|
||||
@ -751,16 +429,6 @@ pub struct Mat6<N> {
|
||||
|
||||
eye_impl!(Mat6, 6, m11, m22, m33, m44, m55, m66)
|
||||
|
||||
double_dispatch_binop_decl_trait!(Mat6, Mat6MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat6, Mat6DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat6, Mat6AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Mat6, Mat6SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Mat6, Mat6Cast)
|
||||
mul_redispatch_impl!(Mat6, Mat6MulRhs)
|
||||
div_redispatch_impl!(Mat6, Mat6DivRhs)
|
||||
add_redispatch_impl!(Mat6, Mat6AddRhs)
|
||||
sub_redispatch_impl!(Mat6, Mat6SubRhs)
|
||||
cast_redispatch_impl!(Mat6, Mat6Cast)
|
||||
mat_impl!(Mat6,
|
||||
m11, m12, m13, m14, m15, m16,
|
||||
m21, m22, m23, m24, m25, m26,
|
||||
@ -770,7 +438,7 @@ mat_impl!(Mat6,
|
||||
m61, m62, m63, m64, m65, m66
|
||||
)
|
||||
as_array_impl!(Mat6, 6)
|
||||
mat_cast_impl!(Mat6, Mat6Cast,
|
||||
mat_cast_impl!(Mat6,
|
||||
m11, m12, m13, m14, m15, m16,
|
||||
m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36,
|
||||
@ -778,7 +446,7 @@ mat_cast_impl!(Mat6, Mat6Cast,
|
||||
m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66
|
||||
)
|
||||
add_impl!(Mat6, Mat6AddRhs,
|
||||
add_impl!(Mat6,
|
||||
m11, m12, m13, m14, m15, m16,
|
||||
m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36,
|
||||
@ -786,7 +454,39 @@ add_impl!(Mat6, Mat6AddRhs,
|
||||
m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66
|
||||
)
|
||||
sub_impl!(Mat6, Mat6SubRhs,
|
||||
sub_impl!(Mat6,
|
||||
m11, m12, m13, m14, m15, m16,
|
||||
m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36,
|
||||
m41, m42, m43, m44, m45, m46,
|
||||
m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66
|
||||
)
|
||||
scalar_add_impl!(Mat6,
|
||||
m11, m12, m13, m14, m15, m16,
|
||||
m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36,
|
||||
m41, m42, m43, m44, m45, m46,
|
||||
m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66
|
||||
)
|
||||
scalar_sub_impl!(Mat6,
|
||||
m11, m12, m13, m14, m15, m16,
|
||||
m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36,
|
||||
m41, m42, m43, m44, m45, m46,
|
||||
m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66
|
||||
)
|
||||
scalar_mul_impl!(Mat6,
|
||||
m11, m12, m13, m14, m15, m16,
|
||||
m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36,
|
||||
m41, m42, m43, m44, m45, m46,
|
||||
m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66
|
||||
)
|
||||
scalar_div_impl!(Mat6,
|
||||
m11, m12, m13, m14, m15, m16,
|
||||
m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36,
|
||||
@ -794,155 +494,6 @@ sub_impl!(Mat6, Mat6SubRhs,
|
||||
m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66
|
||||
)
|
||||
|
||||
mat_mul_scalar_impl!(Mat6, f64, Mat6MulRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_mul_scalar_impl!(Mat6, f32, Mat6MulRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_mul_scalar_impl!(Mat6, i64, Mat6MulRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_mul_scalar_impl!(Mat6, i32, Mat6MulRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_mul_scalar_impl!(Mat6, i16, Mat6MulRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_mul_scalar_impl!(Mat6, i8, Mat6MulRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_mul_scalar_impl!(Mat6, u64, Mat6MulRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_mul_scalar_impl!(Mat6, u32, Mat6MulRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_mul_scalar_impl!(Mat6, u16, Mat6MulRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_mul_scalar_impl!(Mat6, u8, Mat6MulRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_mul_scalar_impl!(Mat6, uint, Mat6MulRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_mul_scalar_impl!(Mat6, int, Mat6MulRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
|
||||
mat_div_scalar_impl!(Mat6, f64, Mat6DivRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_div_scalar_impl!(Mat6, f32, Mat6DivRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_div_scalar_impl!(Mat6, i64, Mat6DivRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_div_scalar_impl!(Mat6, i32, Mat6DivRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_div_scalar_impl!(Mat6, i16, Mat6DivRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_div_scalar_impl!(Mat6, i8, Mat6DivRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_div_scalar_impl!(Mat6, u64, Mat6DivRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_div_scalar_impl!(Mat6, u32, Mat6DivRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_div_scalar_impl!(Mat6, u16, Mat6DivRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_div_scalar_impl!(Mat6, u8, Mat6DivRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_div_scalar_impl!(Mat6, uint, Mat6DivRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_div_scalar_impl!(Mat6, int, Mat6DivRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
|
||||
mat_add_scalar_impl!(Mat6, f64, Mat6AddRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_add_scalar_impl!(Mat6, f32, Mat6AddRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_add_scalar_impl!(Mat6, i64, Mat6AddRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_add_scalar_impl!(Mat6, i32, Mat6AddRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_add_scalar_impl!(Mat6, i16, Mat6AddRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_add_scalar_impl!(Mat6, i8, Mat6AddRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_add_scalar_impl!(Mat6, u64, Mat6AddRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_add_scalar_impl!(Mat6, u32, Mat6AddRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_add_scalar_impl!(Mat6, u16, Mat6AddRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_add_scalar_impl!(Mat6, u8, Mat6AddRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_add_scalar_impl!(Mat6, uint, Mat6AddRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_add_scalar_impl!(Mat6, int, Mat6AddRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
|
||||
mat_sub_scalar_impl!(Mat6, f64, Mat6SubRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_sub_scalar_impl!(Mat6, f32, Mat6SubRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_sub_scalar_impl!(Mat6, i64, Mat6SubRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_sub_scalar_impl!(Mat6, i32, Mat6SubRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_sub_scalar_impl!(Mat6, i16, Mat6SubRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_sub_scalar_impl!(Mat6, i8, Mat6SubRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_sub_scalar_impl!(Mat6, u64, Mat6SubRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_sub_scalar_impl!(Mat6, u32, Mat6SubRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_sub_scalar_impl!(Mat6, u16, Mat6SubRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_sub_scalar_impl!(Mat6, u8, Mat6SubRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_sub_scalar_impl!(Mat6, uint, Mat6SubRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
mat_sub_scalar_impl!(Mat6, int, Mat6SubRhs, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
|
||||
absolute_impl!(Mat6, m11, m12, m13, m14, m15, m16, m21, m22, m23, m24, m25, m26,
|
||||
m31, m32, m33, m34, m35, m36, m41, m42, m43, m44, m45, m46, m51, m52, m53, m54, m55, m56,
|
||||
m61, m62, m63, m64, m65, m66)
|
||||
@ -965,11 +516,11 @@ dim_impl!(Mat6, 6)
|
||||
indexable_impl!(Mat6, 6)
|
||||
index_impl!(Mat6, 6)
|
||||
at_fast_impl!(Mat6, 6)
|
||||
mat_mul_mat_impl!(Mat6, Mat6MulRhs, 6)
|
||||
mat_mul_vec_impl!(Mat6, Vec6, Mat6MulRhs, 6, ::zero)
|
||||
vec_mul_mat_impl!(Mat6, Vec6, Vec6MulRhs, 6, ::zero)
|
||||
mat_mul_pnt_impl!(Mat6, Pnt6, Mat6MulRhs, 6, Orig::orig)
|
||||
pnt_mul_mat_impl!(Mat6, Pnt6, Pnt6MulRhs, 6, Orig::orig)
|
||||
mat_mul_mat_impl!(Mat6, 6)
|
||||
mat_mul_vec_impl!(Mat6, Vec6, 6, ::zero)
|
||||
vec_mul_mat_impl!(Mat6, Vec6, 6, ::zero)
|
||||
mat_mul_pnt_impl!(Mat6, Pnt6, 6, Orig::orig)
|
||||
pnt_mul_mat_impl!(Mat6, Pnt6, 6, Orig::orig)
|
||||
inv_impl!(Mat6, 6)
|
||||
transpose_impl!(Mat6, 6)
|
||||
approx_eq_impl!(Mat6)
|
||||
|
@ -76,10 +76,10 @@ macro_rules! at_fast_impl(
|
||||
)
|
||||
|
||||
macro_rules! mat_cast_impl(
|
||||
($t: ident, $tcast: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<Nin: Clone, Nout: Clone + Cast<Nin>> $tcast<Nout> for $t<Nin> {
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<Nin: Clone, Nout: Clone + Cast<Nin>> Cast<$t<Nin>> for $t<Nout> {
|
||||
#[inline]
|
||||
fn to(v: $t<Nin>) -> $t<Nout> {
|
||||
fn from(v: $t<Nin>) -> $t<Nout> {
|
||||
$t::new(Cast::from(v.$comp0.clone()) $(, Cast::from(v.$compN.clone()))*)
|
||||
}
|
||||
}
|
||||
@ -87,55 +87,55 @@ macro_rules! mat_cast_impl(
|
||||
)
|
||||
|
||||
macro_rules! add_impl(
|
||||
($t: ident, $trhs: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Add<N, N>> $trhs<N, $t<N>> for $t<N> {
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Add<N, N>> Add<$t<N>, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$t<N>) -> $t<N> {
|
||||
$t::new(left.$comp0 + right.$comp0 $(, left.$compN + right.$compN)*)
|
||||
fn add(&self, right: &$t<N>) -> $t<N> {
|
||||
$t::new(self.$comp0 + right.$comp0 $(, self.$compN + right.$compN)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! sub_impl(
|
||||
($t: ident, $trhs: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Sub<N, N>> $trhs<N, $t<N>> for $t<N> {
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Sub<N, N>> Sub<$t<N>, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$t<N>) -> $t<N> {
|
||||
$t::new(left.$comp0 - right.$comp0 $(, left.$compN - right.$compN)*)
|
||||
fn sub(&self, right: &$t<N>) -> $t<N> {
|
||||
$t::new(self.$comp0 - right.$comp0 $(, self.$compN - right.$compN)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! mat_mul_scalar_impl(
|
||||
($t: ident, $n: ident, $trhs: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl $trhs<$n, $t<$n>> for $n {
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Mul<N, N>> Mul<N, $t<N>> for N {
|
||||
#[inline]
|
||||
fn binop(left: &$t<$n>, right: &$n) -> $t<$n> {
|
||||
$t::new(left.$comp0 * *right $(, left.$compN * *right)*)
|
||||
fn mul(&self, right: &N) -> $t<N> {
|
||||
$t::new(self.$comp0 * *right $(, self.$compN * *right)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! mat_div_scalar_impl(
|
||||
($t: ident, $n: ident, $trhs: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl $trhs<$n, $t<$n>> for $n {
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Div<N, N>> Div<N, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<$n>, right: &$n) -> $t<$n> {
|
||||
$t::new(left.$comp0 / *right $(, left.$compN / *right)*)
|
||||
fn div(&self, right: &N) -> $t<N> {
|
||||
$t::new(self.$comp0 / *right $(, self.$compN / *right)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! mat_add_scalar_impl(
|
||||
($t: ident, $n: ident, $trhs: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl $trhs<$n, $t<$n>> for $n {
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Add<N, N>> Add<N, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<$n>, right: &$n) -> $t<$n> {
|
||||
$t::new(left.$comp0 + *right $(, left.$compN + *right)*)
|
||||
fn add(&self, right: &N) -> $t<N> {
|
||||
$t::new(self.$comp0 + *right $(, self.$compN + *right)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -143,10 +143,10 @@ macro_rules! mat_add_scalar_impl(
|
||||
|
||||
|
||||
macro_rules! eye_impl(
|
||||
($t: ident, $ndim: expr, $($comp_diagN: ident),+) => (
|
||||
($t: ident, $dim: expr, $($comp_diagN: ident),+) => (
|
||||
impl<N: Zero + One> Eye for $t<N> {
|
||||
fn new_identity(dim: uint) -> $t<N> {
|
||||
assert!(dim == $ndim);
|
||||
assert!(dim == $dim);
|
||||
let mut eye: $t<N> = ::zero();
|
||||
$(eye.$comp_diagN = ::one();)+
|
||||
eye
|
||||
@ -156,11 +156,11 @@ macro_rules! eye_impl(
|
||||
)
|
||||
|
||||
macro_rules! mat_sub_scalar_impl(
|
||||
($t: ident, $n: ident, $trhs: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl $trhs<$n, $t<$n>> for $n {
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Sub<N, N> Sub<N, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<$n>, right: &$n) -> $t<$n> {
|
||||
$t::new(left.$comp0 - *right $(, left.$compN - *right)*)
|
||||
fn sub(self, right: &N) -> $t<N> {
|
||||
$t::new(self.$comp0 - *right $(, self.$compN - *right)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -425,10 +425,10 @@ macro_rules! diag_impl(
|
||||
)
|
||||
|
||||
macro_rules! mat_mul_mat_impl(
|
||||
($t: ident, $trhs: ident, $dim: expr) => (
|
||||
impl<N: Clone + BaseNum> $trhs<N, $t<N>> for $t<N> {
|
||||
($t: ident, $dim: expr) => (
|
||||
impl<N: Clone + BaseNum> Mul<$t<N>, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$t<N>) -> $t<N> {
|
||||
fn mul(&self, right: &$t<N>) -> $t<N> {
|
||||
// careful! we need to comute other * self here (self is the rhs).
|
||||
let mut res: $t<N> = ::zero();
|
||||
|
||||
@ -438,7 +438,7 @@ macro_rules! mat_mul_mat_impl(
|
||||
|
||||
unsafe {
|
||||
for k in range(0u, $dim) {
|
||||
acc = acc + left.at_fast((i, k)) * right.at_fast((k, j));
|
||||
acc = acc + self.at_fast((i, k)) * right.at_fast((k, j));
|
||||
}
|
||||
|
||||
res.set_fast((i, j), acc);
|
||||
@ -453,16 +453,16 @@ macro_rules! mat_mul_mat_impl(
|
||||
)
|
||||
|
||||
macro_rules! vec_mul_mat_impl(
|
||||
($t: ident, $v: ident, $trhs: ident, $dim: expr, $zero: expr) => (
|
||||
impl<N: Clone + BaseNum> $trhs<N, $v<N>> for $t<N> {
|
||||
($t: ident, $v: ident, $dim: expr, $zero: expr) => (
|
||||
impl<N: Clone + BaseNum> Mul<$t<N>, $v<N>> for $v<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$v<N>, right: &$t<N>) -> $v<N> {
|
||||
fn mul(&self, right: &$t<N>) -> $v<N> {
|
||||
let mut res : $v<N> = $zero();
|
||||
|
||||
for i in range(0u, $dim) {
|
||||
for j in range(0u, $dim) {
|
||||
unsafe {
|
||||
let val = res.at_fast(i) + left.at_fast(j) * right.at_fast((j, i));
|
||||
let val = res.at_fast(i) + self.at_fast(j) * right.at_fast((j, i));
|
||||
res.set_fast(i, val)
|
||||
}
|
||||
}
|
||||
@ -475,16 +475,16 @@ macro_rules! vec_mul_mat_impl(
|
||||
)
|
||||
|
||||
macro_rules! mat_mul_vec_impl(
|
||||
($t: ident, $v: ident, $trhs: ident, $dim: expr, $zero: expr) => (
|
||||
impl<N: Clone + BaseNum> $trhs<N, $v<N>> for $v<N> {
|
||||
($t: ident, $v: ident, $dim: expr, $zero: expr) => (
|
||||
impl<N: Clone + BaseNum> Mul<$v<N>, $v<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$v<N>) -> $v<N> {
|
||||
fn mul(&self, right: &$v<N>) -> $v<N> {
|
||||
let mut res : $v<N> = $zero();
|
||||
|
||||
for i in range(0u, $dim) {
|
||||
for j in range(0u, $dim) {
|
||||
unsafe {
|
||||
let val = res.at_fast(i) + left.at_fast((i, j)) * right.at_fast(j);
|
||||
let val = res.at_fast(i) + self.at_fast((i, j)) * right.at_fast(j);
|
||||
res.set_fast(i, val)
|
||||
}
|
||||
}
|
||||
@ -497,14 +497,14 @@ macro_rules! mat_mul_vec_impl(
|
||||
)
|
||||
|
||||
macro_rules! pnt_mul_mat_impl(
|
||||
($t: ident, $v: ident, $trhs: ident, $dim: expr, $zero: expr) => (
|
||||
vec_mul_mat_impl!($t, $v, $trhs, $dim, $zero)
|
||||
($t: ident, $v: ident, $dim: expr, $zero: expr) => (
|
||||
vec_mul_mat_impl!($t, $v, $dim, $zero)
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! mat_mul_pnt_impl(
|
||||
($t: ident, $v: ident, $trhs: ident, $dim: expr, $zero: expr) => (
|
||||
mat_mul_vec_impl!($t, $v, $trhs, $dim, $zero)
|
||||
($t: ident, $v: ident, $dim: expr, $zero: expr) => (
|
||||
mat_mul_vec_impl!($t, $v, $dim, $zero)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1,88 +0,0 @@
|
||||
#![macro_escape]
|
||||
|
||||
#![doc(hidden)] // we hide doc to not have to document the $trhs double dispatch trait.
|
||||
|
||||
// Create the traits needed to do fancy operator oveloading.
|
||||
// This is a meta version of
|
||||
// http://smallcultfollowing.com/babysteps/blog/2012/10/04/refining-traits-slash-impls/
|
||||
//
|
||||
// Hopefully future version of the language will make this useless.
|
||||
macro_rules! double_dispatch_binop_decl_trait(
|
||||
($t: ident, $trhs: ident) => (
|
||||
pub trait $trhs<N, Res> {
|
||||
/// Applies the binary operation represented by this trait.
|
||||
///
|
||||
/// In infix notation, assuming the operation is noted `*`, the following is computed:
|
||||
/// `right * left`.
|
||||
fn binop(left: &$t<N>, right: &Self) -> Res;
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
// Macro driving the `Mul` trait to use the related trait for double redispatch.
|
||||
macro_rules! mul_redispatch_impl(
|
||||
($t: ident, $trhs: ident) => (
|
||||
impl<N, Rhs: $trhs<N, Res>, Res> Mul<Rhs, Res> for $t<N> {
|
||||
#[inline(always)]
|
||||
fn mul(&self, other: &Rhs) -> Res {
|
||||
$trhs::binop(self, other)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
// Macro driving the `Div` trait to use the related trait for double redispatch.
|
||||
macro_rules! div_redispatch_impl(
|
||||
($t: ident, $trhs: ident) => (
|
||||
impl<N, Rhs: $trhs<N, Res>, Res> Div<Rhs, Res> for $t<N> {
|
||||
#[inline(always)]
|
||||
fn div(&self, other: &Rhs) -> Res {
|
||||
$trhs::binop(self, other)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
// Macro driving the `Add` trait to use the related trait for double redispatch.
|
||||
macro_rules! add_redispatch_impl(
|
||||
($t: ident, $trhs: ident) => (
|
||||
impl<N, Rhs: $trhs<N, Res>, Res> Add<Rhs, Res> for $t<N> {
|
||||
#[inline(always)]
|
||||
fn add(&self, other: &Rhs) -> Res {
|
||||
$trhs::binop(self, other)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
// Macro driving the `Sub` trait to use the related trait for double redispatch.
|
||||
macro_rules! sub_redispatch_impl(
|
||||
($t: ident, $trhs: ident) => (
|
||||
impl<N, Rhs: $trhs<N, Res>, Res> Sub<Rhs, Res> for $t<N> {
|
||||
#[inline(always)]
|
||||
fn sub(&self, other: &Rhs) -> Res {
|
||||
$trhs::binop(self, other)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
// Double dispatch traits to drive the Cast method for structured types with one type parameter.
|
||||
macro_rules! double_dispatch_cast_decl_trait(
|
||||
($t: ident, $tcast: ident) => (
|
||||
pub trait $tcast<N> {
|
||||
fn to(Self) -> $t<N>;
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! cast_redispatch_impl(
|
||||
($t:ident, $tcast: ident) => (
|
||||
impl<T: $tcast<N>, N> Cast<T> for $t<N> {
|
||||
#[inline(always)]
|
||||
fn from(t: T) -> $t<N> {
|
||||
$tcast::to(t)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
@ -11,20 +11,6 @@ pub use self::persp::{Persp3, PerspMat3};
|
||||
pub use self::ortho::{Ortho3, OrthoMat3};
|
||||
pub use self::quat::{Quat, UnitQuat};
|
||||
|
||||
pub use self::vec::{Vec1MulRhs, Vec2MulRhs, Vec3MulRhs, Vec4MulRhs, Vec5MulRhs, Vec6MulRhs,
|
||||
Vec1DivRhs, Vec2DivRhs, Vec3DivRhs, Vec4DivRhs, Vec5DivRhs, Vec6DivRhs,
|
||||
Vec1AddRhs, Vec2AddRhs, Vec3AddRhs, Vec4AddRhs, Vec5AddRhs, Vec6AddRhs,
|
||||
Vec1SubRhs, Vec2SubRhs, Vec3SubRhs, Vec4SubRhs, Vec5SubRhs, Vec6SubRhs};
|
||||
pub use self::pnt::{Pnt1MulRhs, Pnt2MulRhs, Pnt3MulRhs, Pnt4MulRhs, Pnt5MulRhs, Pnt6MulRhs,
|
||||
Pnt1DivRhs, Pnt2DivRhs, Pnt3DivRhs, Pnt4DivRhs, Pnt5DivRhs, Pnt6DivRhs,
|
||||
Pnt1AddRhs, Pnt2AddRhs, Pnt3AddRhs, Pnt4AddRhs, Pnt5AddRhs, Pnt6AddRhs,
|
||||
Pnt1SubRhs, Pnt2SubRhs, Pnt3SubRhs, Pnt4SubRhs, Pnt5SubRhs, Pnt6SubRhs};
|
||||
pub use self::mat::{Mat1MulRhs, Mat2MulRhs, Mat3MulRhs, Mat4MulRhs, Mat5MulRhs, Mat6MulRhs,
|
||||
Mat1DivRhs, Mat2DivRhs, Mat3DivRhs, Mat4DivRhs, Mat5DivRhs, Mat6DivRhs,
|
||||
Mat1AddRhs, Mat2AddRhs, Mat3AddRhs, Mat4AddRhs, Mat5AddRhs, Mat6AddRhs,
|
||||
Mat1SubRhs, Mat2SubRhs, Mat3SubRhs, Mat4SubRhs, Mat5SubRhs, Mat6SubRhs};
|
||||
|
||||
mod metal;
|
||||
mod dmat;
|
||||
mod dvec_macros;
|
||||
mod dvec;
|
||||
|
@ -38,20 +38,14 @@ pub struct Pnt1<N> {
|
||||
pub x: N
|
||||
}
|
||||
|
||||
double_dispatch_binop_decl_trait!(Pnt1, Pnt1MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt1, Pnt1DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt1, Pnt1AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt1, Pnt1SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Pnt1, Pnt1Cast)
|
||||
mul_redispatch_impl!(Pnt1, Pnt1MulRhs)
|
||||
div_redispatch_impl!(Pnt1, Pnt1DivRhs)
|
||||
add_redispatch_impl!(Pnt1, Pnt1AddRhs)
|
||||
sub_redispatch_impl!(Pnt1, Pnt1SubRhs)
|
||||
cast_redispatch_impl!(Pnt1, Pnt1Cast)
|
||||
new_impl!(Pnt1, x)
|
||||
orig_impl!(Pnt1, x)
|
||||
ord_impl!(Pnt1, x)
|
||||
vec_cast_impl!(Pnt1, Pnt1Cast, x)
|
||||
scalar_mul_impl!(Pnt1, x)
|
||||
scalar_div_impl!(Pnt1, x)
|
||||
scalar_add_impl!(Pnt1, x)
|
||||
scalar_sub_impl!(Pnt1, x)
|
||||
vec_cast_impl!(Pnt1, x)
|
||||
as_array_impl!(Pnt1, 1)
|
||||
index_impl!(Pnt1)
|
||||
indexable_impl!(Pnt1, 1)
|
||||
@ -60,59 +54,11 @@ new_repeat_impl!(Pnt1, val, x)
|
||||
dim_impl!(Pnt1, 1)
|
||||
container_impl!(Pnt1)
|
||||
pnt_as_vec_impl!(Pnt1, Vec1, x)
|
||||
pnt_sub_impl!(Pnt1, Vec1, Pnt1SubRhs)
|
||||
pnt_sub_impl!(Pnt1, Vec1)
|
||||
neg_impl!(Pnt1, x)
|
||||
pnt_add_vec_impl!(Pnt1, Vec1, Pnt1AddRhs, x)
|
||||
pnt_sub_vec_impl!(Pnt1, Vec1, Pnt1SubRhs, x)
|
||||
pnt_add_vec_impl!(Pnt1, Vec1, x)
|
||||
pnt_sub_vec_impl!(Pnt1, Vec1, x)
|
||||
scalar_ops_impl!(Pnt1, x)
|
||||
vec_mul_scalar_impl!(Pnt1, f64, Pnt1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Pnt1, f32, Pnt1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Pnt1, u64, Pnt1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Pnt1, u32, Pnt1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Pnt1, u16, Pnt1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Pnt1, u8, Pnt1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Pnt1, i64, Pnt1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Pnt1, i32, Pnt1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Pnt1, i16, Pnt1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Pnt1, i8, Pnt1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Pnt1, uint, Pnt1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Pnt1, int, Pnt1MulRhs, x)
|
||||
vec_div_scalar_impl!(Pnt1, f64, Pnt1DivRhs, x)
|
||||
vec_div_scalar_impl!(Pnt1, f32, Pnt1DivRhs, x)
|
||||
vec_div_scalar_impl!(Pnt1, u64, Pnt1DivRhs, x)
|
||||
vec_div_scalar_impl!(Pnt1, u32, Pnt1DivRhs, x)
|
||||
vec_div_scalar_impl!(Pnt1, u16, Pnt1DivRhs, x)
|
||||
vec_div_scalar_impl!(Pnt1, u8, Pnt1DivRhs, x)
|
||||
vec_div_scalar_impl!(Pnt1, i64, Pnt1DivRhs, x)
|
||||
vec_div_scalar_impl!(Pnt1, i32, Pnt1DivRhs, x)
|
||||
vec_div_scalar_impl!(Pnt1, i16, Pnt1DivRhs, x)
|
||||
vec_div_scalar_impl!(Pnt1, i8, Pnt1DivRhs, x)
|
||||
vec_div_scalar_impl!(Pnt1, uint, Pnt1DivRhs, x)
|
||||
vec_div_scalar_impl!(Pnt1, int, Pnt1DivRhs, x)
|
||||
vec_add_scalar_impl!(Pnt1, f64, Pnt1AddRhs, x)
|
||||
vec_add_scalar_impl!(Pnt1, f32, Pnt1AddRhs, x)
|
||||
vec_add_scalar_impl!(Pnt1, u64, Pnt1AddRhs, x)
|
||||
vec_add_scalar_impl!(Pnt1, u32, Pnt1AddRhs, x)
|
||||
vec_add_scalar_impl!(Pnt1, u16, Pnt1AddRhs, x)
|
||||
vec_add_scalar_impl!(Pnt1, u8, Pnt1AddRhs, x)
|
||||
vec_add_scalar_impl!(Pnt1, i64, Pnt1AddRhs, x)
|
||||
vec_add_scalar_impl!(Pnt1, i32, Pnt1AddRhs, x)
|
||||
vec_add_scalar_impl!(Pnt1, i16, Pnt1AddRhs, x)
|
||||
vec_add_scalar_impl!(Pnt1, i8, Pnt1AddRhs, x)
|
||||
vec_add_scalar_impl!(Pnt1, uint, Pnt1AddRhs, x)
|
||||
vec_add_scalar_impl!(Pnt1, int, Pnt1AddRhs, x)
|
||||
vec_sub_scalar_impl!(Pnt1, f64, Pnt1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Pnt1, f32, Pnt1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Pnt1, u64, Pnt1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Pnt1, u32, Pnt1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Pnt1, u16, Pnt1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Pnt1, u8, Pnt1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Pnt1, i64, Pnt1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Pnt1, i32, Pnt1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Pnt1, i16, Pnt1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Pnt1, i8, Pnt1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Pnt1, uint, Pnt1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Pnt1, int, Pnt1SubRhs, x)
|
||||
approx_eq_impl!(Pnt1, x)
|
||||
from_iterator_impl!(Pnt1, iterator)
|
||||
bounded_impl!(Pnt1, x)
|
||||
@ -121,7 +67,7 @@ iterable_impl!(Pnt1, 1)
|
||||
iterable_mut_impl!(Pnt1, 1)
|
||||
pnt_to_homogeneous_impl!(Pnt1, Pnt2, y, x)
|
||||
pnt_from_homogeneous_impl!(Pnt1, Pnt2, y, x)
|
||||
num_float_pnt_impl!(Pnt1, Vec1, Pnt1MulRhs, Pnt1DivRhs)
|
||||
num_float_pnt_impl!(Pnt1, Vec1)
|
||||
|
||||
/// Point of dimension 2.
|
||||
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show)]
|
||||
@ -132,20 +78,14 @@ pub struct Pnt2<N> {
|
||||
pub y: N
|
||||
}
|
||||
|
||||
double_dispatch_binop_decl_trait!(Pnt2, Pnt2MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt2, Pnt2DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt2, Pnt2AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt2, Pnt2SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Pnt2, Pnt2Cast)
|
||||
mul_redispatch_impl!(Pnt2, Pnt2MulRhs)
|
||||
div_redispatch_impl!(Pnt2, Pnt2DivRhs)
|
||||
add_redispatch_impl!(Pnt2, Pnt2AddRhs)
|
||||
sub_redispatch_impl!(Pnt2, Pnt2SubRhs)
|
||||
cast_redispatch_impl!(Pnt2, Pnt2Cast)
|
||||
new_impl!(Pnt2, x, y)
|
||||
orig_impl!(Pnt2, x, y)
|
||||
ord_impl!(Pnt2, x, y)
|
||||
vec_cast_impl!(Pnt2, Pnt2Cast, x, y)
|
||||
scalar_mul_impl!(Pnt2, x, y)
|
||||
scalar_div_impl!(Pnt2, x, y)
|
||||
scalar_add_impl!(Pnt2, x, y)
|
||||
scalar_sub_impl!(Pnt2, x, y)
|
||||
vec_cast_impl!(Pnt2, x, y)
|
||||
as_array_impl!(Pnt2, 2)
|
||||
index_impl!(Pnt2)
|
||||
indexable_impl!(Pnt2, 2)
|
||||
@ -154,59 +94,11 @@ new_repeat_impl!(Pnt2, val, x, y)
|
||||
dim_impl!(Pnt2, 2)
|
||||
container_impl!(Pnt2)
|
||||
pnt_as_vec_impl!(Pnt2, Vec2, x, y)
|
||||
pnt_sub_impl!(Pnt2, Vec2, Pnt2SubRhs)
|
||||
pnt_sub_impl!(Pnt2, Vec2)
|
||||
neg_impl!(Pnt2, x, y)
|
||||
pnt_add_vec_impl!(Pnt2, Vec2, Pnt2AddRhs, x, y)
|
||||
pnt_sub_vec_impl!(Pnt2, Vec2, Pnt2SubRhs, x, y)
|
||||
pnt_add_vec_impl!(Pnt2, Vec2, x, y)
|
||||
pnt_sub_vec_impl!(Pnt2, Vec2, x, y)
|
||||
scalar_ops_impl!(Pnt2, x, y)
|
||||
vec_mul_scalar_impl!(Pnt2, f64, Pnt2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Pnt2, f32, Pnt2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Pnt2, u64, Pnt2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Pnt2, u32, Pnt2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Pnt2, u16, Pnt2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Pnt2, u8, Pnt2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Pnt2, i64, Pnt2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Pnt2, i32, Pnt2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Pnt2, i16, Pnt2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Pnt2, i8, Pnt2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Pnt2, uint, Pnt2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Pnt2, int, Pnt2MulRhs, x, y)
|
||||
vec_div_scalar_impl!(Pnt2, f64, Pnt2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Pnt2, f32, Pnt2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Pnt2, u64, Pnt2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Pnt2, u32, Pnt2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Pnt2, u16, Pnt2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Pnt2, u8, Pnt2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Pnt2, i64, Pnt2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Pnt2, i32, Pnt2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Pnt2, i16, Pnt2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Pnt2, i8, Pnt2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Pnt2, uint, Pnt2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Pnt2, int, Pnt2DivRhs, x, y)
|
||||
vec_add_scalar_impl!(Pnt2, f64, Pnt2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Pnt2, f32, Pnt2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Pnt2, u64, Pnt2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Pnt2, u32, Pnt2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Pnt2, u16, Pnt2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Pnt2, u8, Pnt2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Pnt2, i64, Pnt2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Pnt2, i32, Pnt2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Pnt2, i16, Pnt2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Pnt2, i8, Pnt2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Pnt2, uint, Pnt2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Pnt2, int, Pnt2AddRhs, x, y)
|
||||
vec_sub_scalar_impl!(Pnt2, f64, Pnt2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Pnt2, f32, Pnt2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Pnt2, u64, Pnt2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Pnt2, u32, Pnt2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Pnt2, u16, Pnt2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Pnt2, u8, Pnt2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Pnt2, i64, Pnt2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Pnt2, i32, Pnt2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Pnt2, i16, Pnt2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Pnt2, i8, Pnt2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Pnt2, uint, Pnt2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Pnt2, int, Pnt2SubRhs, x, y)
|
||||
approx_eq_impl!(Pnt2, x, y)
|
||||
from_iterator_impl!(Pnt2, iterator, iterator)
|
||||
bounded_impl!(Pnt2, x, y)
|
||||
@ -215,7 +107,7 @@ iterable_impl!(Pnt2, 2)
|
||||
iterable_mut_impl!(Pnt2, 2)
|
||||
pnt_to_homogeneous_impl!(Pnt2, Pnt3, z, x, y)
|
||||
pnt_from_homogeneous_impl!(Pnt2, Pnt3, z, x, y)
|
||||
num_float_pnt_impl!(Pnt2, Vec2, Pnt2MulRhs, Pnt2DivRhs)
|
||||
num_float_pnt_impl!(Pnt2, Vec2)
|
||||
|
||||
/// Point of dimension 3.
|
||||
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show)]
|
||||
@ -228,20 +120,14 @@ pub struct Pnt3<N> {
|
||||
pub z: N
|
||||
}
|
||||
|
||||
double_dispatch_binop_decl_trait!(Pnt3, Pnt3MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt3, Pnt3DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt3, Pnt3AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt3, Pnt3SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Pnt3, Pnt3Cast)
|
||||
mul_redispatch_impl!(Pnt3, Pnt3MulRhs)
|
||||
div_redispatch_impl!(Pnt3, Pnt3DivRhs)
|
||||
add_redispatch_impl!(Pnt3, Pnt3AddRhs)
|
||||
sub_redispatch_impl!(Pnt3, Pnt3SubRhs)
|
||||
cast_redispatch_impl!(Pnt3, Pnt3Cast)
|
||||
new_impl!(Pnt3, x, y, z)
|
||||
orig_impl!(Pnt3, x, y, z)
|
||||
ord_impl!(Pnt3, x, y, z)
|
||||
vec_cast_impl!(Pnt3, Pnt3Cast, x, y, z)
|
||||
scalar_mul_impl!(Pnt3, x, y, z)
|
||||
scalar_div_impl!(Pnt3, x, y, z)
|
||||
scalar_add_impl!(Pnt3, x, y, z)
|
||||
scalar_sub_impl!(Pnt3, x, y, z)
|
||||
vec_cast_impl!(Pnt3, x, y, z)
|
||||
as_array_impl!(Pnt3, 3)
|
||||
index_impl!(Pnt3)
|
||||
indexable_impl!(Pnt3, 3)
|
||||
@ -250,59 +136,11 @@ new_repeat_impl!(Pnt3, val, x, y, z)
|
||||
dim_impl!(Pnt3, 3)
|
||||
container_impl!(Pnt3)
|
||||
pnt_as_vec_impl!(Pnt3, Vec3, x, y, z)
|
||||
pnt_sub_impl!(Pnt3, Vec3, Pnt3SubRhs)
|
||||
pnt_sub_impl!(Pnt3, Vec3)
|
||||
neg_impl!(Pnt3, x, y, z)
|
||||
pnt_add_vec_impl!(Pnt3, Vec3, Pnt3AddRhs, x, y, z)
|
||||
pnt_sub_vec_impl!(Pnt3, Vec3, Pnt3SubRhs, x, y, z)
|
||||
pnt_add_vec_impl!(Pnt3, Vec3, x, y, z)
|
||||
pnt_sub_vec_impl!(Pnt3, Vec3, x, y, z)
|
||||
scalar_ops_impl!(Pnt3, x, y, z)
|
||||
vec_mul_scalar_impl!(Pnt3, f64, Pnt3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Pnt3, f32, Pnt3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Pnt3, u64, Pnt3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Pnt3, u32, Pnt3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Pnt3, u16, Pnt3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Pnt3, u8, Pnt3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Pnt3, i64, Pnt3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Pnt3, i32, Pnt3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Pnt3, i16, Pnt3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Pnt3, i8, Pnt3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Pnt3, uint, Pnt3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Pnt3, int, Pnt3MulRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Pnt3, f64, Pnt3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Pnt3, f32, Pnt3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Pnt3, u64, Pnt3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Pnt3, u32, Pnt3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Pnt3, u16, Pnt3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Pnt3, u8, Pnt3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Pnt3, i64, Pnt3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Pnt3, i32, Pnt3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Pnt3, i16, Pnt3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Pnt3, i8, Pnt3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Pnt3, uint, Pnt3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Pnt3, int, Pnt3DivRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Pnt3, f64, Pnt3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Pnt3, f32, Pnt3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Pnt3, u64, Pnt3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Pnt3, u32, Pnt3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Pnt3, u16, Pnt3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Pnt3, u8, Pnt3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Pnt3, i64, Pnt3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Pnt3, i32, Pnt3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Pnt3, i16, Pnt3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Pnt3, i8, Pnt3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Pnt3, uint, Pnt3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Pnt3, int, Pnt3AddRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Pnt3, f64, Pnt3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Pnt3, f32, Pnt3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Pnt3, u64, Pnt3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Pnt3, u32, Pnt3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Pnt3, u16, Pnt3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Pnt3, u8, Pnt3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Pnt3, i64, Pnt3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Pnt3, i32, Pnt3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Pnt3, i16, Pnt3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Pnt3, i8, Pnt3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Pnt3, uint, Pnt3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Pnt3, int, Pnt3SubRhs, x, y, z)
|
||||
approx_eq_impl!(Pnt3, x, y, z)
|
||||
from_iterator_impl!(Pnt3, iterator, iterator, iterator)
|
||||
bounded_impl!(Pnt3, x, y, z)
|
||||
@ -311,7 +149,7 @@ iterable_impl!(Pnt3, 3)
|
||||
iterable_mut_impl!(Pnt3, 3)
|
||||
pnt_to_homogeneous_impl!(Pnt3, Pnt4, w, x, y, z)
|
||||
pnt_from_homogeneous_impl!(Pnt3, Pnt4, w, x, y, z)
|
||||
num_float_pnt_impl!(Pnt3, Vec3, Pnt3MulRhs, Pnt3DivRhs)
|
||||
num_float_pnt_impl!(Pnt3, Vec3)
|
||||
|
||||
/// Point of dimension 4.
|
||||
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show)]
|
||||
@ -326,20 +164,14 @@ pub struct Pnt4<N> {
|
||||
pub w: N
|
||||
}
|
||||
|
||||
double_dispatch_binop_decl_trait!(Pnt4, Pnt4MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt4, Pnt4DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt4, Pnt4AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt4, Pnt4SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Pnt4, Pnt4Cast)
|
||||
mul_redispatch_impl!(Pnt4, Pnt4MulRhs)
|
||||
div_redispatch_impl!(Pnt4, Pnt4DivRhs)
|
||||
add_redispatch_impl!(Pnt4, Pnt4AddRhs)
|
||||
sub_redispatch_impl!(Pnt4, Pnt4SubRhs)
|
||||
cast_redispatch_impl!(Pnt4, Pnt4Cast)
|
||||
new_impl!(Pnt4, x, y, z, w)
|
||||
orig_impl!(Pnt4, x, y, z, w)
|
||||
ord_impl!(Pnt4, x, y, z, w)
|
||||
vec_cast_impl!(Pnt4, Pnt4Cast, x, y, z, w)
|
||||
scalar_mul_impl!(Pnt4, x, y, z, w)
|
||||
scalar_div_impl!(Pnt4, x, y, z, w)
|
||||
scalar_add_impl!(Pnt4, x, y, z, w)
|
||||
scalar_sub_impl!(Pnt4, x, y, z, w)
|
||||
vec_cast_impl!(Pnt4, x, y, z, w)
|
||||
as_array_impl!(Pnt4, 4)
|
||||
index_impl!(Pnt4)
|
||||
indexable_impl!(Pnt4, 4)
|
||||
@ -348,59 +180,11 @@ new_repeat_impl!(Pnt4, val, x, y, z, w)
|
||||
dim_impl!(Pnt4, 4)
|
||||
container_impl!(Pnt4)
|
||||
pnt_as_vec_impl!(Pnt4, Vec4, x, y, z, w)
|
||||
pnt_sub_impl!(Pnt4, Vec4, Pnt4SubRhs)
|
||||
pnt_sub_impl!(Pnt4, Vec4)
|
||||
neg_impl!(Pnt4, x, y, z, w)
|
||||
pnt_add_vec_impl!(Pnt4, Vec4, Pnt4AddRhs, x, y, z, w)
|
||||
pnt_sub_vec_impl!(Pnt4, Vec4, Pnt4SubRhs, x, y, z, w)
|
||||
pnt_add_vec_impl!(Pnt4, Vec4, x, y, z, w)
|
||||
pnt_sub_vec_impl!(Pnt4, Vec4, x, y, z, w)
|
||||
scalar_ops_impl!(Pnt4, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Pnt4, f64, Pnt4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Pnt4, f32, Pnt4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Pnt4, u64, Pnt4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Pnt4, u32, Pnt4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Pnt4, u16, Pnt4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Pnt4, u8, Pnt4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Pnt4, i64, Pnt4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Pnt4, i32, Pnt4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Pnt4, i16, Pnt4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Pnt4, i8, Pnt4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Pnt4, uint, Pnt4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Pnt4, int, Pnt4MulRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Pnt4, f64, Pnt4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Pnt4, f32, Pnt4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Pnt4, u64, Pnt4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Pnt4, u32, Pnt4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Pnt4, u16, Pnt4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Pnt4, u8, Pnt4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Pnt4, i64, Pnt4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Pnt4, i32, Pnt4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Pnt4, i16, Pnt4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Pnt4, i8, Pnt4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Pnt4, uint, Pnt4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Pnt4, int, Pnt4DivRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Pnt4, f64, Pnt4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Pnt4, f32, Pnt4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Pnt4, u64, Pnt4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Pnt4, u32, Pnt4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Pnt4, u16, Pnt4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Pnt4, u8, Pnt4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Pnt4, i64, Pnt4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Pnt4, i32, Pnt4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Pnt4, i16, Pnt4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Pnt4, i8, Pnt4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Pnt4, uint, Pnt4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Pnt4, int, Pnt4AddRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Pnt4, f64, Pnt4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Pnt4, f32, Pnt4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Pnt4, u64, Pnt4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Pnt4, u32, Pnt4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Pnt4, u16, Pnt4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Pnt4, u8, Pnt4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Pnt4, i64, Pnt4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Pnt4, i32, Pnt4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Pnt4, i16, Pnt4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Pnt4, i8, Pnt4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Pnt4, uint, Pnt4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Pnt4, int, Pnt4SubRhs, x, y, z, w)
|
||||
approx_eq_impl!(Pnt4, x, y, z, w)
|
||||
from_iterator_impl!(Pnt4, iterator, iterator, iterator, iterator)
|
||||
bounded_impl!(Pnt4, x, y, z, w)
|
||||
@ -409,7 +193,7 @@ iterable_impl!(Pnt4, 4)
|
||||
iterable_mut_impl!(Pnt4, 4)
|
||||
pnt_to_homogeneous_impl!(Pnt4, Pnt5, a, x, y, z, w)
|
||||
pnt_from_homogeneous_impl!(Pnt4, Pnt5, a, x, y, z, w)
|
||||
num_float_pnt_impl!(Pnt4, Vec4, Pnt4MulRhs, Pnt4DivRhs)
|
||||
num_float_pnt_impl!(Pnt4, Vec4)
|
||||
|
||||
/// Point of dimension 5.
|
||||
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show)]
|
||||
@ -426,20 +210,14 @@ pub struct Pnt5<N> {
|
||||
pub a: N
|
||||
}
|
||||
|
||||
double_dispatch_binop_decl_trait!(Pnt5, Pnt5MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt5, Pnt5DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt5, Pnt5AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt5, Pnt5SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Pnt5, Pnt5Cast)
|
||||
mul_redispatch_impl!(Pnt5, Pnt5MulRhs)
|
||||
div_redispatch_impl!(Pnt5, Pnt5DivRhs)
|
||||
add_redispatch_impl!(Pnt5, Pnt5AddRhs)
|
||||
sub_redispatch_impl!(Pnt5, Pnt5SubRhs)
|
||||
cast_redispatch_impl!(Pnt5, Pnt5Cast)
|
||||
new_impl!(Pnt5, x, y, z, w, a)
|
||||
orig_impl!(Pnt5, x, y, z, w, a)
|
||||
ord_impl!(Pnt5, x, y, z, w, a)
|
||||
vec_cast_impl!(Pnt5, Pnt5Cast, x, y, z, w, a)
|
||||
scalar_mul_impl!(Pnt5, x, y, z, w, a)
|
||||
scalar_div_impl!(Pnt5, x, y, z, w, a)
|
||||
scalar_add_impl!(Pnt5, x, y, z, w, a)
|
||||
scalar_sub_impl!(Pnt5, x, y, z, w, a)
|
||||
vec_cast_impl!(Pnt5, x, y, z, w, a)
|
||||
as_array_impl!(Pnt5, 5)
|
||||
index_impl!(Pnt5)
|
||||
indexable_impl!(Pnt5, 5)
|
||||
@ -448,59 +226,11 @@ new_repeat_impl!(Pnt5, val, x, y, z, w, a)
|
||||
dim_impl!(Pnt5, 5)
|
||||
container_impl!(Pnt5)
|
||||
pnt_as_vec_impl!(Pnt5, Vec5, x, y, z, w, a)
|
||||
pnt_sub_impl!(Pnt5, Vec5, Pnt5SubRhs)
|
||||
pnt_sub_impl!(Pnt5, Vec5)
|
||||
neg_impl!(Pnt5, x, y, z, w, a)
|
||||
pnt_add_vec_impl!(Pnt5, Vec5, Pnt5AddRhs, x, y, z, w, a)
|
||||
pnt_sub_vec_impl!(Pnt5, Vec5, Pnt5SubRhs, x, y, z, w, a)
|
||||
pnt_add_vec_impl!(Pnt5, Vec5, x, y, z, w, a)
|
||||
pnt_sub_vec_impl!(Pnt5, Vec5, x, y, z, w, a)
|
||||
scalar_ops_impl!(Pnt5, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Pnt5, f64, Pnt5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Pnt5, f32, Pnt5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Pnt5, u64, Pnt5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Pnt5, u32, Pnt5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Pnt5, u16, Pnt5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Pnt5, u8, Pnt5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Pnt5, i64, Pnt5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Pnt5, i32, Pnt5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Pnt5, i16, Pnt5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Pnt5, i8, Pnt5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Pnt5, uint, Pnt5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Pnt5, int, Pnt5MulRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Pnt5, f64, Pnt5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Pnt5, f32, Pnt5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Pnt5, u64, Pnt5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Pnt5, u32, Pnt5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Pnt5, u16, Pnt5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Pnt5, u8, Pnt5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Pnt5, i64, Pnt5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Pnt5, i32, Pnt5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Pnt5, i16, Pnt5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Pnt5, i8, Pnt5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Pnt5, uint, Pnt5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Pnt5, int, Pnt5DivRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Pnt5, f64, Pnt5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Pnt5, f32, Pnt5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Pnt5, u64, Pnt5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Pnt5, u32, Pnt5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Pnt5, u16, Pnt5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Pnt5, u8, Pnt5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Pnt5, i64, Pnt5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Pnt5, i32, Pnt5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Pnt5, i16, Pnt5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Pnt5, i8, Pnt5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Pnt5, uint, Pnt5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Pnt5, int, Pnt5AddRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Pnt5, f64, Pnt5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Pnt5, f32, Pnt5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Pnt5, u64, Pnt5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Pnt5, u32, Pnt5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Pnt5, u16, Pnt5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Pnt5, u8, Pnt5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Pnt5, i64, Pnt5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Pnt5, i32, Pnt5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Pnt5, i16, Pnt5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Pnt5, i8, Pnt5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Pnt5, uint, Pnt5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Pnt5, int, Pnt5SubRhs, x, y, z, w, a)
|
||||
approx_eq_impl!(Pnt5, x, y, z, w, a)
|
||||
from_iterator_impl!(Pnt5, iterator, iterator, iterator, iterator, iterator)
|
||||
bounded_impl!(Pnt5, x, y, z, w, a)
|
||||
@ -509,7 +239,7 @@ iterable_impl!(Pnt5, 5)
|
||||
iterable_mut_impl!(Pnt5, 5)
|
||||
pnt_to_homogeneous_impl!(Pnt5, Pnt6, b, x, y, z, w, a)
|
||||
pnt_from_homogeneous_impl!(Pnt5, Pnt6, b, x, y, z, w, a)
|
||||
num_float_pnt_impl!(Pnt5, Vec5, Pnt5MulRhs, Pnt5DivRhs)
|
||||
num_float_pnt_impl!(Pnt5, Vec5)
|
||||
|
||||
/// Point of dimension 6.
|
||||
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show)]
|
||||
@ -528,20 +258,14 @@ pub struct Pnt6<N> {
|
||||
pub b: N
|
||||
}
|
||||
|
||||
double_dispatch_binop_decl_trait!(Pnt6, Pnt6MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt6, Pnt6DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt6, Pnt6AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Pnt6, Pnt6SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Pnt6, Pnt6Cast)
|
||||
mul_redispatch_impl!(Pnt6, Pnt6MulRhs)
|
||||
div_redispatch_impl!(Pnt6, Pnt6DivRhs)
|
||||
add_redispatch_impl!(Pnt6, Pnt6AddRhs)
|
||||
sub_redispatch_impl!(Pnt6, Pnt6SubRhs)
|
||||
cast_redispatch_impl!(Pnt6, Pnt6Cast)
|
||||
new_impl!(Pnt6, x, y, z, w, a, b)
|
||||
orig_impl!(Pnt6, x, y, z, w, a, b)
|
||||
ord_impl!(Pnt6, x, y, z, w, a, b)
|
||||
vec_cast_impl!(Pnt6, Pnt6Cast, x, y, z, w, a, b)
|
||||
scalar_mul_impl!(Pnt6, x, y, z, w, a, b)
|
||||
scalar_div_impl!(Pnt6, x, y, z, w, a, b)
|
||||
scalar_add_impl!(Pnt6, x, y, z, w, a, b)
|
||||
scalar_sub_impl!(Pnt6, x, y, z, w, a, b)
|
||||
vec_cast_impl!(Pnt6, x, y, z, w, a, b)
|
||||
as_array_impl!(Pnt6, 6)
|
||||
index_impl!(Pnt6)
|
||||
indexable_impl!(Pnt6, 6)
|
||||
@ -550,63 +274,15 @@ new_repeat_impl!(Pnt6, val, x, y, z, w, a, b)
|
||||
dim_impl!(Pnt6, 6)
|
||||
container_impl!(Pnt6)
|
||||
pnt_as_vec_impl!(Pnt6, Vec6, x, y, z, w, a, b)
|
||||
pnt_sub_impl!(Pnt6, Vec6, Pnt6SubRhs)
|
||||
pnt_sub_impl!(Pnt6, Vec6)
|
||||
neg_impl!(Pnt6, x, y, z, w, a, b)
|
||||
pnt_add_vec_impl!(Pnt6, Vec6, Pnt6AddRhs, x, y, z, w, a, b)
|
||||
pnt_sub_vec_impl!(Pnt6, Vec6, Pnt6SubRhs, x, y, z, w, a, b)
|
||||
pnt_add_vec_impl!(Pnt6, Vec6, x, y, z, w, a, b)
|
||||
pnt_sub_vec_impl!(Pnt6, Vec6, x, y, z, w, a, b)
|
||||
scalar_ops_impl!(Pnt6, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Pnt6, f64, Pnt6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Pnt6, f32, Pnt6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Pnt6, u64, Pnt6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Pnt6, u32, Pnt6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Pnt6, u16, Pnt6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Pnt6, u8, Pnt6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Pnt6, i64, Pnt6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Pnt6, i32, Pnt6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Pnt6, i16, Pnt6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Pnt6, i8, Pnt6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Pnt6, uint, Pnt6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Pnt6, int, Pnt6MulRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Pnt6, f64, Pnt6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Pnt6, f32, Pnt6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Pnt6, u64, Pnt6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Pnt6, u32, Pnt6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Pnt6, u16, Pnt6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Pnt6, u8, Pnt6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Pnt6, i64, Pnt6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Pnt6, i32, Pnt6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Pnt6, i16, Pnt6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Pnt6, i8, Pnt6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Pnt6, uint, Pnt6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Pnt6, int, Pnt6DivRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Pnt6, f64, Pnt6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Pnt6, f32, Pnt6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Pnt6, u64, Pnt6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Pnt6, u32, Pnt6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Pnt6, u16, Pnt6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Pnt6, u8, Pnt6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Pnt6, i64, Pnt6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Pnt6, i32, Pnt6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Pnt6, i16, Pnt6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Pnt6, i8, Pnt6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Pnt6, uint, Pnt6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Pnt6, int, Pnt6AddRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Pnt6, f64, Pnt6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Pnt6, f32, Pnt6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Pnt6, u64, Pnt6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Pnt6, u32, Pnt6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Pnt6, u16, Pnt6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Pnt6, u8, Pnt6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Pnt6, i64, Pnt6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Pnt6, i32, Pnt6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Pnt6, i16, Pnt6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Pnt6, i8, Pnt6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Pnt6, uint, Pnt6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Pnt6, int, Pnt6SubRhs, x, y, z, w, a, b)
|
||||
approx_eq_impl!(Pnt6, x, y, z, w, a, b)
|
||||
from_iterator_impl!(Pnt6, iterator, iterator, iterator, iterator, iterator, iterator)
|
||||
bounded_impl!(Pnt6, x, y, z, w, a, b)
|
||||
axpy_impl!(Pnt6, x, y, z, w, a, b)
|
||||
iterable_impl!(Pnt6, 6)
|
||||
iterable_mut_impl!(Pnt6, 6)
|
||||
num_float_pnt_impl!(Pnt6, Vec6, Pnt6MulRhs, Pnt6DivRhs)
|
||||
num_float_pnt_impl!(Pnt6, Vec6)
|
||||
|
@ -20,33 +20,33 @@ macro_rules! orig_impl(
|
||||
)
|
||||
|
||||
macro_rules! pnt_sub_impl(
|
||||
($t: ident, $tv: ident, $trhs: ident) => (
|
||||
impl<N: Sub<N, N>> $trhs<N, $tv<N>> for $t<N> {
|
||||
($t: ident, $tv: ident) => (
|
||||
impl<N: Sub<N, N>> Sub<$t<N>, $tv<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$t<N>) -> $tv<N> {
|
||||
*left.as_vec() - *right.as_vec()
|
||||
fn sub(&self, right: &$t<N>) -> $tv<N> {
|
||||
*self.as_vec() - *right.as_vec()
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! pnt_add_vec_impl(
|
||||
($t: ident, $tv: ident, $trhs: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Add<N, N>> $trhs<N, $t<N>> for $tv<N> {
|
||||
($t: ident, $tv: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Add<N, N>> Add<$tv<N>, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$tv<N>) -> $t<N> {
|
||||
$t::new(left.$comp0 + right.$comp0 $(, left.$compN + right.$compN)*)
|
||||
fn add(&self, right: &$tv<N>) -> $t<N> {
|
||||
$t::new(self.$comp0 + right.$comp0 $(, self.$compN + right.$compN)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! pnt_sub_vec_impl(
|
||||
($t: ident, $tv: ident, $trhs: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Sub<N, N>> $trhs<N, $t<N>> for $tv<N> {
|
||||
($t: ident, $tv: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Sub<N, N>> Sub<$tv<N>, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$tv<N>) -> $t<N> {
|
||||
$t::new(left.$comp0 - right.$comp0 $(, left.$compN - right.$compN)*)
|
||||
fn sub(&self, right: &$tv<N>) -> $t<N> {
|
||||
$t::new(self.$comp0 - right.$comp0 $(, self.$compN - right.$compN)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -130,13 +130,13 @@ macro_rules! pnt_from_homogeneous_impl(
|
||||
)
|
||||
|
||||
macro_rules! num_float_pnt_impl(
|
||||
($t: ident, $tv: ident $(,$trhs: ident)*) => (
|
||||
($t: ident, $tv: ident) => (
|
||||
impl<N> NumPnt<N, $tv<N>> for $t<N>
|
||||
where N: BaseNum + Zero $(+ $trhs<N, $t<N>>)* {
|
||||
where N: BaseNum {
|
||||
}
|
||||
|
||||
impl<N> FloatPnt<N, $tv<N>> for $t<N>
|
||||
where N: BaseNum + One + Zero + ApproxEq<N> + BaseFloat $(+ $trhs<N, $t<N>>)* {
|
||||
where N: BaseFloat + ApproxEq<N> {
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ use std::mem;
|
||||
use std::num;
|
||||
use std::rand::{Rand, Rng};
|
||||
use std::slice::{Items, MutItems};
|
||||
use structs::{Vec3, Pnt3, Rot3, Mat3, Vec3MulRhs, Pnt3MulRhs};
|
||||
use structs::{Vec3, Pnt3, Rot3, Mat3};
|
||||
use traits::operations::{ApproxEq, Inv, POrd, POrdering, Axpy, ScalarAdd, ScalarSub, ScalarMul,
|
||||
ScalarDiv};
|
||||
use traits::structure::{Cast, Indexable, Iterable, IterableMut, Dim, Shape, BaseFloat, BaseNum, Zero,
|
||||
@ -121,21 +121,21 @@ impl<N: BaseFloat> Norm<N> for Quat<N> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Mul<N, N> + Sub<N, N> + Add<N, N>> QuatMulRhs<N, Quat<N>> for Quat<N> {
|
||||
impl<N: Mul<N, N> + Sub<N, N> + Add<N, N>> Mul<Quat<N>, Quat<N>> for Quat<N> {
|
||||
#[inline]
|
||||
fn binop(left: &Quat<N>, right: &Quat<N>) -> Quat<N> {
|
||||
fn mul(&self, right: &Quat<N>) -> Quat<N> {
|
||||
Quat::new(
|
||||
left.w * right.w - left.i * right.i - left.j * right.j - left.k * right.k,
|
||||
left.w * right.i + left.i * right.w + left.j * right.k - left.k * right.j,
|
||||
left.w * right.j - left.i * right.k + left.j * right.w + left.k * right.i,
|
||||
left.w * right.k + left.i * right.j - left.j * right.i + left.k * right.w)
|
||||
self.w * right.w - self.i * right.i - self.j * right.j - self.k * right.k,
|
||||
self.w * right.i + self.i * right.w + self.j * right.k - self.k * right.j,
|
||||
self.w * right.j - self.i * right.k + self.j * right.w + self.k * right.i,
|
||||
self.w * right.k + self.i * right.j - self.j * right.i + self.k * right.w)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: ApproxEq<N> + BaseFloat + Clone> QuatDivRhs<N, Quat<N>> for Quat<N> {
|
||||
impl<N: ApproxEq<N> + BaseFloat + Clone> Div<Quat<N>, Quat<N>> for Quat<N> {
|
||||
#[inline]
|
||||
fn binop(left: &Quat<N>, right: &Quat<N>) -> Quat<N> {
|
||||
*left * Inv::inv_cpy(right).expect("Unable to invert the denominator.")
|
||||
fn div(&self, right: &Quat<N>) -> Quat<N> {
|
||||
*self * Inv::inv_cpy(right).expect("Unable to invert the denominator.")
|
||||
}
|
||||
}
|
||||
|
||||
@ -307,49 +307,49 @@ impl<N: BaseFloat + ApproxEq<N> + Clone> Div<UnitQuat<N>, UnitQuat<N>> for UnitQ
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: BaseNum + Clone> UnitQuatMulRhs<N, UnitQuat<N>> for UnitQuat<N> {
|
||||
impl<N: BaseNum + Clone> Mul<UnitQuat<N>, UnitQuat<N>> for UnitQuat<N> {
|
||||
#[inline]
|
||||
fn binop(left: &UnitQuat<N>, right: &UnitQuat<N>) -> UnitQuat<N> {
|
||||
UnitQuat { q: left.q * right.q }
|
||||
fn mul(&self, right: &UnitQuat<N>) -> UnitQuat<N> {
|
||||
UnitQuat { q: self.q * right.q }
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: BaseNum + Clone> UnitQuatMulRhs<N, Vec3<N>> for Vec3<N> {
|
||||
impl<N: BaseNum + Clone> Mul<Vec3<N>, Vec3<N>> for UnitQuat<N> {
|
||||
#[inline]
|
||||
fn binop(left: &UnitQuat<N>, right: &Vec3<N>) -> Vec3<N> {
|
||||
fn mul(&self, right: &Vec3<N>) -> Vec3<N> {
|
||||
let _2: N = ::one::<N>() + ::one();
|
||||
let mut t = Cross::cross(left.q.vector(), right);
|
||||
let mut t = Cross::cross(self.q.vector(), right);
|
||||
t.x = t.x * _2;
|
||||
t.y = t.y * _2;
|
||||
t.z = t.z * _2;
|
||||
|
||||
Vec3::new(t.x * left.q.w, t.y * left.q.w, t.z * left.q.w) +
|
||||
Cross::cross(left.q.vector(), &t) +
|
||||
Vec3::new(t.x * self.q.w, t.y * self.q.w, t.z * self.q.w) +
|
||||
Cross::cross(self.q.vector(), &t) +
|
||||
*right
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: BaseNum + Clone> UnitQuatMulRhs<N, Pnt3<N>> for Pnt3<N> {
|
||||
impl<N: BaseNum + Clone> Mul<Pnt3<N>, Pnt3<N>> for UnitQuat<N> {
|
||||
#[inline]
|
||||
fn binop(left: &UnitQuat<N>, right: &Pnt3<N>) -> Pnt3<N> {
|
||||
::orig::<Pnt3<N>>() + *left * *right.as_vec()
|
||||
fn mul(&self, right: &Pnt3<N>) -> Pnt3<N> {
|
||||
::orig::<Pnt3<N>>() + *self * *right.as_vec()
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: BaseNum + Clone> Vec3MulRhs<N, Vec3<N>> for UnitQuat<N> {
|
||||
impl<N: BaseNum + Clone> Mul<UnitQuat<N>, Vec3<N>> for Vec3<N> {
|
||||
#[inline]
|
||||
fn binop(left: &Vec3<N>, right: &UnitQuat<N>) -> Vec3<N> {
|
||||
fn mul(&self, right: &UnitQuat<N>) -> Vec3<N> {
|
||||
let mut inv_quat = right.clone();
|
||||
inv_quat.inv();
|
||||
|
||||
inv_quat * *left
|
||||
inv_quat * *self
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: BaseNum + Clone> Pnt3MulRhs<N, Pnt3<N>> for UnitQuat<N> {
|
||||
impl<N: BaseNum + Clone> Mul<UnitQuat<N>, Pnt3<N>> for Pnt3<N> {
|
||||
#[inline]
|
||||
fn binop(left: &Pnt3<N>, right: &UnitQuat<N>) -> Pnt3<N> {
|
||||
::orig::<Pnt3<N>>() + *left.as_vec() * *right
|
||||
fn mul(&self, right: &UnitQuat<N>) -> Pnt3<N> {
|
||||
::orig::<Pnt3<N>>() + *self.as_vec() * *right
|
||||
}
|
||||
}
|
||||
|
||||
@ -447,19 +447,9 @@ impl<N: BaseNum + Clone> Transform<Pnt3<N>> for UnitQuat<N> {
|
||||
}
|
||||
}
|
||||
|
||||
double_dispatch_binop_decl_trait!(Quat, QuatMulRhs)
|
||||
double_dispatch_binop_decl_trait!(Quat, QuatDivRhs)
|
||||
double_dispatch_binop_decl_trait!(Quat, QuatAddRhs)
|
||||
double_dispatch_binop_decl_trait!(Quat, QuatSubRhs)
|
||||
double_dispatch_cast_decl_trait!(Quat, QuatCast)
|
||||
mul_redispatch_impl!(Quat, QuatMulRhs)
|
||||
div_redispatch_impl!(Quat, QuatDivRhs)
|
||||
add_redispatch_impl!(Quat, QuatAddRhs)
|
||||
sub_redispatch_impl!(Quat, QuatSubRhs)
|
||||
cast_redispatch_impl!(Quat, QuatCast)
|
||||
ord_impl!(Quat, w, i, j, k)
|
||||
vec_axis_impl!(Quat, w, i, j, k)
|
||||
vec_cast_impl!(Quat, QuatCast, w, i, j, k)
|
||||
vec_cast_impl!(Quat, w, i, j, k)
|
||||
as_array_impl!(Quat, 4)
|
||||
index_impl!(Quat)
|
||||
indexable_impl!(Quat, 4)
|
||||
@ -467,58 +457,14 @@ at_fast_impl!(Quat, 4)
|
||||
new_repeat_impl!(Quat, val, w, i, j, k)
|
||||
dim_impl!(Quat, 3)
|
||||
container_impl!(Quat)
|
||||
add_impl!(Quat, QuatAddRhs, w, i, j, k)
|
||||
sub_impl!(Quat, QuatSubRhs, w, i, j, k)
|
||||
add_impl!(Quat, w, i, j, k)
|
||||
sub_impl!(Quat, w, i, j, k)
|
||||
scalar_add_impl!(Quat, w, i, j, k)
|
||||
scalar_sub_impl!(Quat, w, i, j, k)
|
||||
scalar_mul_impl!(Quat, w, i, j, k)
|
||||
scalar_div_impl!(Quat, w, i, j, k)
|
||||
neg_impl!(Quat, w, i, j, k)
|
||||
scalar_ops_impl!(Quat, w, i, j, k)
|
||||
vec_mul_scalar_impl!(Quat, f64, QuatMulRhs, w, i, j, k)
|
||||
vec_mul_scalar_impl!(Quat, f32, QuatMulRhs, w, i, j, k)
|
||||
vec_mul_scalar_impl!(Quat, u64, QuatMulRhs, w, i, j, k)
|
||||
vec_mul_scalar_impl!(Quat, u32, QuatMulRhs, w, i, j, k)
|
||||
vec_mul_scalar_impl!(Quat, u16, QuatMulRhs, w, i, j, k)
|
||||
vec_mul_scalar_impl!(Quat, u8, QuatMulRhs, w, i, j, k)
|
||||
vec_mul_scalar_impl!(Quat, i64, QuatMulRhs, w, i, j, k)
|
||||
vec_mul_scalar_impl!(Quat, i32, QuatMulRhs, w, i, j, k)
|
||||
vec_mul_scalar_impl!(Quat, i16, QuatMulRhs, w, i, j, k)
|
||||
vec_mul_scalar_impl!(Quat, i8, QuatMulRhs, w, i, j, k)
|
||||
vec_mul_scalar_impl!(Quat, uint, QuatMulRhs, w, i, j, k)
|
||||
vec_mul_scalar_impl!(Quat, int, QuatMulRhs, w, i, j, k)
|
||||
vec_div_scalar_impl!(Quat, f64, QuatDivRhs, w, i, j, k)
|
||||
vec_div_scalar_impl!(Quat, f32, QuatDivRhs, w, i, j, k)
|
||||
vec_div_scalar_impl!(Quat, u64, QuatDivRhs, w, i, j, k)
|
||||
vec_div_scalar_impl!(Quat, u32, QuatDivRhs, w, i, j, k)
|
||||
vec_div_scalar_impl!(Quat, u16, QuatDivRhs, w, i, j, k)
|
||||
vec_div_scalar_impl!(Quat, u8, QuatDivRhs, w, i, j, k)
|
||||
vec_div_scalar_impl!(Quat, i64, QuatDivRhs, w, i, j, k)
|
||||
vec_div_scalar_impl!(Quat, i32, QuatDivRhs, w, i, j, k)
|
||||
vec_div_scalar_impl!(Quat, i16, QuatDivRhs, w, i, j, k)
|
||||
vec_div_scalar_impl!(Quat, i8, QuatDivRhs, w, i, j, k)
|
||||
vec_div_scalar_impl!(Quat, uint, QuatDivRhs, w, i, j, k)
|
||||
vec_div_scalar_impl!(Quat, int, QuatDivRhs, w, i, j, k)
|
||||
vec_add_scalar_impl!(Quat, f64, QuatAddRhs, w, i, j, k)
|
||||
vec_add_scalar_impl!(Quat, f32, QuatAddRhs, w, i, j, k)
|
||||
vec_add_scalar_impl!(Quat, u64, QuatAddRhs, w, i, j, k)
|
||||
vec_add_scalar_impl!(Quat, u32, QuatAddRhs, w, i, j, k)
|
||||
vec_add_scalar_impl!(Quat, u16, QuatAddRhs, w, i, j, k)
|
||||
vec_add_scalar_impl!(Quat, u8, QuatAddRhs, w, i, j, k)
|
||||
vec_add_scalar_impl!(Quat, i64, QuatAddRhs, w, i, j, k)
|
||||
vec_add_scalar_impl!(Quat, i32, QuatAddRhs, w, i, j, k)
|
||||
vec_add_scalar_impl!(Quat, i16, QuatAddRhs, w, i, j, k)
|
||||
vec_add_scalar_impl!(Quat, i8, QuatAddRhs, w, i, j, k)
|
||||
vec_add_scalar_impl!(Quat, uint, QuatAddRhs, w, i, j, k)
|
||||
vec_add_scalar_impl!(Quat, int, QuatAddRhs, w, i, j, k)
|
||||
vec_sub_scalar_impl!(Quat, f64, QuatSubRhs, w, i, j, k)
|
||||
vec_sub_scalar_impl!(Quat, f32, QuatSubRhs, w, i, j, k)
|
||||
vec_sub_scalar_impl!(Quat, u64, QuatSubRhs, w, i, j, k)
|
||||
vec_sub_scalar_impl!(Quat, u32, QuatSubRhs, w, i, j, k)
|
||||
vec_sub_scalar_impl!(Quat, u16, QuatSubRhs, w, i, j, k)
|
||||
vec_sub_scalar_impl!(Quat, u8, QuatSubRhs, w, i, j, k)
|
||||
vec_sub_scalar_impl!(Quat, i64, QuatSubRhs, w, i, j, k)
|
||||
vec_sub_scalar_impl!(Quat, i32, QuatSubRhs, w, i, j, k)
|
||||
vec_sub_scalar_impl!(Quat, i16, QuatSubRhs, w, i, j, k)
|
||||
vec_sub_scalar_impl!(Quat, i8, QuatSubRhs, w, i, j, k)
|
||||
vec_sub_scalar_impl!(Quat, uint, QuatSubRhs, w, i, j, k)
|
||||
vec_sub_scalar_impl!(Quat, int, QuatSubRhs, w, i, j, k)
|
||||
zero_one_impl!(Quat, w, i, j, k)
|
||||
approx_eq_impl!(Quat, w, i, j, k)
|
||||
from_iterator_impl!(Quat, iterator, iterator, iterator, iterator)
|
||||
@ -527,6 +473,4 @@ axpy_impl!(Quat, w, i, j, k)
|
||||
iterable_impl!(Quat, 4)
|
||||
iterable_mut_impl!(Quat, 4)
|
||||
|
||||
double_dispatch_binop_decl_trait!(UnitQuat, UnitQuatMulRhs)
|
||||
mul_redispatch_impl!(UnitQuat, UnitQuatMulRhs)
|
||||
dim_impl!(UnitQuat, 3)
|
||||
|
@ -7,8 +7,8 @@ use traits::geometry::{Rotate, Rotation, AbsoluteRotate, RotationMatrix, Transfo
|
||||
Norm, Cross};
|
||||
use traits::structure::{Cast, Dim, Row, Col, BaseFloat, BaseNum, Zero, One};
|
||||
use traits::operations::{Absolute, Inv, Transpose, ApproxEq};
|
||||
use structs::vec::{Vec1, Vec2, Vec3, Vec4, Vec2MulRhs, Vec3MulRhs, Vec4MulRhs};
|
||||
use structs::pnt::{Pnt2, Pnt3, Pnt4, Pnt2MulRhs, Pnt3MulRhs, Pnt4MulRhs};
|
||||
use structs::vec::{Vec1, Vec2, Vec3, Vec4};
|
||||
use structs::pnt::{Pnt2, Pnt3, Pnt4};
|
||||
use structs::mat::{Mat2, Mat3, Mat4, Mat5};
|
||||
|
||||
|
||||
@ -376,17 +376,15 @@ Rotation<Vec4<N>> for Rot4<N> {
|
||||
* Common implementations.
|
||||
*/
|
||||
|
||||
double_dispatch_binop_decl_trait!(Rot2, Rot2MulRhs)
|
||||
mul_redispatch_impl!(Rot2, Rot2MulRhs)
|
||||
submat_impl!(Rot2, Mat2)
|
||||
rotate_impl!(Rot2RotateRhs, Rot2, Vec2, Pnt2)
|
||||
transform_impl!(Rot2TransformRhs, Rot2, Vec2, Pnt2)
|
||||
rotate_impl!(Rot2, Vec2, Pnt2)
|
||||
transform_impl!(Rot2, Vec2, Pnt2)
|
||||
dim_impl!(Rot2, 2)
|
||||
rot_mul_rot_impl!(Rot2, Rot2MulRhs)
|
||||
rot_mul_vec_impl!(Rot2, Vec2, Rot2MulRhs)
|
||||
vec_mul_rot_impl!(Rot2, Vec2, Vec2MulRhs)
|
||||
rot_mul_pnt_impl!(Rot2, Pnt2, Rot2MulRhs)
|
||||
pnt_mul_rot_impl!(Rot2, Pnt2, Pnt2MulRhs)
|
||||
rot_mul_rot_impl!(Rot2)
|
||||
rot_mul_vec_impl!(Rot2, Vec2)
|
||||
vec_mul_rot_impl!(Rot2, Vec2)
|
||||
rot_mul_pnt_impl!(Rot2, Pnt2)
|
||||
pnt_mul_rot_impl!(Rot2, Pnt2)
|
||||
one_impl!(Rot2)
|
||||
rotation_matrix_impl!(Rot2, Vec2, Vec1)
|
||||
col_impl!(Rot2, Vec2)
|
||||
@ -398,17 +396,15 @@ inv_impl!(Rot2)
|
||||
transpose_impl!(Rot2)
|
||||
approx_eq_impl!(Rot2)
|
||||
|
||||
double_dispatch_binop_decl_trait!(Rot3, Rot3MulRhs)
|
||||
mul_redispatch_impl!(Rot3, Rot3MulRhs)
|
||||
submat_impl!(Rot3, Mat3)
|
||||
rotate_impl!(Rot3RotateRhs, Rot3, Vec3, Pnt3)
|
||||
transform_impl!(Rot3TransformRhs, Rot3, Vec3, Pnt3)
|
||||
rotate_impl!(Rot3, Vec3, Pnt3)
|
||||
transform_impl!(Rot3, Vec3, Pnt3)
|
||||
dim_impl!(Rot3, 3)
|
||||
rot_mul_rot_impl!(Rot3, Rot3MulRhs)
|
||||
rot_mul_vec_impl!(Rot3, Vec3, Rot3MulRhs)
|
||||
vec_mul_rot_impl!(Rot3, Vec3, Vec3MulRhs)
|
||||
rot_mul_pnt_impl!(Rot3, Pnt3, Rot3MulRhs)
|
||||
pnt_mul_rot_impl!(Rot3, Pnt3, Pnt3MulRhs)
|
||||
rot_mul_rot_impl!(Rot3)
|
||||
rot_mul_vec_impl!(Rot3, Vec3)
|
||||
vec_mul_rot_impl!(Rot3, Vec3)
|
||||
rot_mul_pnt_impl!(Rot3, Pnt3)
|
||||
pnt_mul_rot_impl!(Rot3, Pnt3)
|
||||
one_impl!(Rot3)
|
||||
rotation_matrix_impl!(Rot3, Vec3, Vec3)
|
||||
col_impl!(Rot3, Vec3)
|
||||
@ -420,17 +416,15 @@ inv_impl!(Rot3)
|
||||
transpose_impl!(Rot3)
|
||||
approx_eq_impl!(Rot3)
|
||||
|
||||
double_dispatch_binop_decl_trait!(Rot4, Rot4MulRhs)
|
||||
mul_redispatch_impl!(Rot4, Rot4MulRhs)
|
||||
submat_impl!(Rot4, Mat4)
|
||||
rotate_impl!(Rot4RotateRhs, Rot4, Vec4, Pnt4)
|
||||
transform_impl!(Rot4TransformRhs, Rot4, Vec4, Pnt4)
|
||||
rotate_impl!(Rot4, Vec4, Pnt4)
|
||||
transform_impl!(Rot4, Vec4, Pnt4)
|
||||
dim_impl!(Rot4, 4)
|
||||
rot_mul_rot_impl!(Rot4, Rot4MulRhs)
|
||||
rot_mul_vec_impl!(Rot4, Vec4, Rot4MulRhs)
|
||||
vec_mul_rot_impl!(Rot4, Vec4, Vec4MulRhs)
|
||||
rot_mul_pnt_impl!(Rot4, Pnt4, Rot4MulRhs)
|
||||
pnt_mul_rot_impl!(Rot4, Pnt4, Pnt4MulRhs)
|
||||
rot_mul_rot_impl!(Rot4)
|
||||
rot_mul_vec_impl!(Rot4, Vec4)
|
||||
vec_mul_rot_impl!(Rot4, Vec4)
|
||||
rot_mul_pnt_impl!(Rot4, Pnt4)
|
||||
pnt_mul_rot_impl!(Rot4, Pnt4)
|
||||
one_impl!(Rot4)
|
||||
rotation_matrix_impl!(Rot4, Vec4, Vec4)
|
||||
col_impl!(Rot4, Vec4)
|
||||
|
@ -12,98 +12,56 @@ macro_rules! submat_impl(
|
||||
)
|
||||
|
||||
macro_rules! rotate_impl(
|
||||
($trhs: ident, $t: ident, $tv: ident, $tp: ident) => (
|
||||
/*
|
||||
* FIXME: we use the double dispatch trick here so that we can rotate vectors _and_
|
||||
* points. Remove this as soon as rust supports multidispatch.
|
||||
*/
|
||||
pub trait $trhs<N> {
|
||||
fn rotate(left: &$t<N>, right: &Self) -> Self;
|
||||
fn inv_rotate(left: &$t<N>, right: &Self) -> Self;
|
||||
}
|
||||
|
||||
impl<N, V: $trhs<N>> Rotate<V> for $t<N> {
|
||||
#[inline(always)]
|
||||
fn rotate(&self, other: &V) -> V {
|
||||
$trhs::rotate(self, other)
|
||||
($t: ident, $tv: ident, $tp: ident) => (
|
||||
impl<N: BaseNum + Clone> Rotate<$tv<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn rotate(&self, v: &$tv<N>) -> $tv<N> {
|
||||
*self * *v
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn inv_rotate(&self, other: &V) -> V {
|
||||
$trhs::inv_rotate(self, other)
|
||||
#[inline]
|
||||
fn inv_rotate(&self, v: &$tv<N>) -> $tv<N> {
|
||||
*v * *self
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: BaseNum + Clone> $trhs<N> for $tv<N> {
|
||||
impl<N: BaseNum + Clone> Rotate<$tp<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn rotate(t: &$t<N>, v: &$tv<N>) -> $tv<N> {
|
||||
*t * *v
|
||||
fn rotate(&self, p: &$tp<N>) -> $tp<N> {
|
||||
*self * *p
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn inv_rotate(t: &$t<N>, v: &$tv<N>) -> $tv<N> {
|
||||
*v * *t
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: BaseNum + Clone> $trhs<N> for $tp<N> {
|
||||
#[inline]
|
||||
fn rotate(t: &$t<N>, p: &$tp<N>) -> $tp<N> {
|
||||
*t * *p
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn inv_rotate(t: &$t<N>, p: &$tp<N>) -> $tp<N> {
|
||||
*p * *t
|
||||
fn inv_rotate(&self, p: &$tp<N>) -> $tp<N> {
|
||||
*p * *self
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! transform_impl(
|
||||
($trhs: ident, $t: ident, $tv: ident, $tp: ident) => (
|
||||
/*
|
||||
* FIXME: we use the double dispatch trick here so that we can transform vectors _and_
|
||||
* points. Remove this as soon as rust supports multidispatch.
|
||||
*/
|
||||
pub trait $trhs<N> {
|
||||
fn transform(left: &$t<N>, right: &Self) -> Self;
|
||||
fn inv_transform(left: &$t<N>, right: &Self) -> Self;
|
||||
}
|
||||
|
||||
impl<N, V: $trhs<N>> Transform<V> for $t<N> {
|
||||
#[inline(always)]
|
||||
fn transform(&self, other: &V) -> V {
|
||||
$trhs::transform(self, other)
|
||||
($t: ident, $tv: ident, $tp: ident) => (
|
||||
impl<N: BaseNum + Clone> Transform<$tv<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn transform(&self, v: &$tv<N>) -> $tv<N> {
|
||||
self.rotate(v)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn inv_transform(&self, other: &V) -> V {
|
||||
$trhs::inv_transform(self, other)
|
||||
#[inline]
|
||||
fn inv_transform(&self, v: &$tv<N>) -> $tv<N> {
|
||||
self.inv_rotate(v)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: BaseNum + Clone> $trhs<N> for $tv<N> {
|
||||
impl<N: BaseNum + Clone> Transform<$tp<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn transform(t: &$t<N>, v: &$tv<N>) -> $tv<N> {
|
||||
t.rotate(v)
|
||||
fn transform(&self, p: &$tp<N>) -> $tp<N> {
|
||||
self.rotate(p)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn inv_transform(t: &$t<N>, v: &$tv<N>) -> $tv<N> {
|
||||
t.inv_rotate(v)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: BaseNum + Clone> $trhs<N> for $tp<N> {
|
||||
#[inline]
|
||||
fn transform(t: &$t<N>, p: &$tp<N>) -> $tp<N> {
|
||||
t.rotate(p)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn inv_transform(t: &$t<N>, p: &$tp<N>) -> $tp<N> {
|
||||
t.inv_rotate(p)
|
||||
fn inv_transform(&self, p: &$tp<N>) -> $tp<N> {
|
||||
self.inv_rotate(p)
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -143,47 +101,47 @@ macro_rules! one_impl(
|
||||
)
|
||||
|
||||
macro_rules! rot_mul_rot_impl(
|
||||
($t: ident, $mulrhs: ident) => (
|
||||
impl<N: BaseNum + Clone> $mulrhs<N, $t<N>> for $t<N> {
|
||||
($t: ident) => (
|
||||
impl<N: BaseNum + Clone> Mul<$t<N>, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$t<N>) -> $t<N> {
|
||||
$t { submat: left.submat * right.submat }
|
||||
fn mul(&self, right: &$t<N>) -> $t<N> {
|
||||
$t { submat: self.submat * right.submat }
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! rot_mul_vec_impl(
|
||||
($t: ident, $tv: ident, $mulrhs: ident) => (
|
||||
impl<N: BaseNum + Clone> $mulrhs<N, $tv<N>> for $tv<N> {
|
||||
($t: ident, $tv: ident) => (
|
||||
impl<N: BaseNum + Clone> Mul<$tv<N>, $tv<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$tv<N>) -> $tv<N> {
|
||||
left.submat * *right
|
||||
fn mul(&self, right: &$tv<N>) -> $tv<N> {
|
||||
self.submat * *right
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! rot_mul_pnt_impl(
|
||||
($t: ident, $tv: ident, $mulrhs: ident) => (
|
||||
rot_mul_vec_impl!($t, $tv, $mulrhs)
|
||||
($t: ident, $tv: ident) => (
|
||||
rot_mul_vec_impl!($t, $tv)
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! vec_mul_rot_impl(
|
||||
($t: ident, $tv: ident, $mulrhs: ident) => (
|
||||
impl<N: BaseNum + Clone> $mulrhs<N, $tv<N>> for $t<N> {
|
||||
($t: ident, $tv: ident) => (
|
||||
impl<N: BaseNum + Clone> Mul<$t<N>, $tv<N>> for $tv<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$tv<N>, right: &$t<N>) -> $tv<N> {
|
||||
*left * right.submat
|
||||
fn mul(&self, right: &$t<N>) -> $tv<N> {
|
||||
*self * right.submat
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! pnt_mul_rot_impl(
|
||||
($t: ident, $tv: ident, $mulrhs: ident) => (
|
||||
vec_mul_rot_impl!($t, $tv, $mulrhs)
|
||||
($t: ident, $tv: ident) => (
|
||||
vec_mul_rot_impl!($t, $tv)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use structs::vec::{Vec2, Vec3, Vec2MulRhs, Vec3MulRhs};
|
||||
use structs::pnt::{Pnt2, Pnt3, Pnt2MulRhs, Pnt3MulRhs};
|
||||
use structs::mat::{Mat1, Mat2, Mat3, Mat3MulRhs, Mat2MulRhs};
|
||||
use structs::vec::{Vec2, Vec3};
|
||||
use structs::pnt::{Pnt2, Pnt3};
|
||||
use structs::mat::{Mat1, Mat2, Mat3};
|
||||
use traits::operations::{Inv, Det, ApproxEq};
|
||||
use traits::structure::{Row, Col, BaseNum};
|
||||
|
||||
@ -211,118 +211,118 @@ impl<N: Clone> Col<Vec3<N>> for Mat3<N> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mat3MulRhs<N, Mat3<N>> for Mat3<N> {
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mul<Mat3<N>, Mat3<N>> for Mat3<N> {
|
||||
#[inline]
|
||||
fn binop(left: &Mat3<N>, right: &Mat3<N>) -> Mat3<N> {
|
||||
fn mul(&self, right: &Mat3<N>) -> Mat3<N> {
|
||||
Mat3::new(
|
||||
left.m11 * right.m11 + left.m12 * right.m21 + left.m13 * right.m31,
|
||||
left.m11 * right.m12 + left.m12 * right.m22 + left.m13 * right.m32,
|
||||
left.m11 * right.m13 + left.m12 * right.m23 + left.m13 * right.m33,
|
||||
self.m11 * right.m11 + self.m12 * right.m21 + self.m13 * right.m31,
|
||||
self.m11 * right.m12 + self.m12 * right.m22 + self.m13 * right.m32,
|
||||
self.m11 * right.m13 + self.m12 * right.m23 + self.m13 * right.m33,
|
||||
|
||||
left.m21 * right.m11 + left.m22 * right.m21 + left.m23 * right.m31,
|
||||
left.m21 * right.m12 + left.m22 * right.m22 + left.m23 * right.m32,
|
||||
left.m21 * right.m13 + left.m22 * right.m23 + left.m23 * right.m33,
|
||||
self.m21 * right.m11 + self.m22 * right.m21 + self.m23 * right.m31,
|
||||
self.m21 * right.m12 + self.m22 * right.m22 + self.m23 * right.m32,
|
||||
self.m21 * right.m13 + self.m22 * right.m23 + self.m23 * right.m33,
|
||||
|
||||
left.m31 * right.m11 + left.m32 * right.m21 + left.m33 * right.m31,
|
||||
left.m31 * right.m12 + left.m32 * right.m22 + left.m33 * right.m32,
|
||||
left.m31 * right.m13 + left.m32 * right.m23 + left.m33 * right.m33
|
||||
self.m31 * right.m11 + self.m32 * right.m21 + self.m33 * right.m31,
|
||||
self.m31 * right.m12 + self.m32 * right.m22 + self.m33 * right.m32,
|
||||
self.m31 * right.m13 + self.m32 * right.m23 + self.m33 * right.m33
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mat2MulRhs<N, Mat2<N>> for Mat2<N> {
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mul<Mat2<N>, Mat2<N>> for Mat2<N> {
|
||||
#[inline(always)]
|
||||
fn binop(left: &Mat2<N>, right: &Mat2<N>) -> Mat2<N> {
|
||||
fn mul(&self, right: &Mat2<N>) -> Mat2<N> {
|
||||
Mat2::new(
|
||||
left.m11 * right.m11 + left.m12 * right.m21,
|
||||
left.m11 * right.m12 + left.m12 * right.m22,
|
||||
self.m11 * right.m11 + self.m12 * right.m21,
|
||||
self.m11 * right.m12 + self.m12 * right.m22,
|
||||
|
||||
left.m21 * right.m11 + left.m22 * right.m21,
|
||||
left.m21 * right.m12 + left.m22 * right.m22
|
||||
self.m21 * right.m11 + self.m22 * right.m21,
|
||||
self.m21 * right.m12 + self.m22 * right.m22
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mat3MulRhs<N, Vec3<N>> for Vec3<N> {
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mul<Vec3<N>, Vec3<N>> for Mat3<N> {
|
||||
#[inline(always)]
|
||||
fn binop(left: &Mat3<N>, right: &Vec3<N>) -> Vec3<N> {
|
||||
fn mul(&self, right: &Vec3<N>) -> Vec3<N> {
|
||||
Vec3::new(
|
||||
left.m11 * right.x + left.m12 * right.y + left.m13 * right.z,
|
||||
left.m21 * right.x + left.m22 * right.y + left.m23 * right.z,
|
||||
left.m31 * right.x + left.m32 * right.y + left.m33 * right.z
|
||||
self.m11 * right.x + self.m12 * right.y + self.m13 * right.z,
|
||||
self.m21 * right.x + self.m22 * right.y + self.m23 * right.z,
|
||||
self.m31 * right.x + self.m32 * right.y + self.m33 * right.z
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Mul<N, N> + Add<N, N>> Vec3MulRhs<N, Vec3<N>> for Mat3<N> {
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mul<Mat3<N>, Vec3<N>> for Vec3<N> {
|
||||
#[inline(always)]
|
||||
fn binop(left: &Vec3<N>, right: &Mat3<N>) -> Vec3<N> {
|
||||
fn mul(&self, right: &Mat3<N>) -> Vec3<N> {
|
||||
Vec3::new(
|
||||
left.x * right.m11 + left.y * right.m21 + left.z * right.m31,
|
||||
left.x * right.m12 + left.y * right.m22 + left.z * right.m32,
|
||||
left.x * right.m13 + left.y * right.m23 + left.z * right.m33
|
||||
self.x * right.m11 + self.y * right.m21 + self.z * right.m31,
|
||||
self.x * right.m12 + self.y * right.m22 + self.z * right.m32,
|
||||
self.x * right.m13 + self.y * right.m23 + self.z * right.m33
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Mul<N, N> + Add<N, N>> Vec2MulRhs<N, Vec2<N>> for Mat2<N> {
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mul<Mat2<N>, Vec2<N>> for Vec2<N> {
|
||||
#[inline(always)]
|
||||
fn binop(left: &Vec2<N>, right: &Mat2<N>) -> Vec2<N> {
|
||||
fn mul(&self, right: &Mat2<N>) -> Vec2<N> {
|
||||
Vec2::new(
|
||||
left.x * right.m11 + left.y * right.m21,
|
||||
left.x * right.m12 + left.y * right.m22
|
||||
self.x * right.m11 + self.y * right.m21,
|
||||
self.x * right.m12 + self.y * right.m22
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mat2MulRhs<N, Vec2<N>> for Vec2<N> {
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mul<Vec2<N>, Vec2<N>> for Mat2<N> {
|
||||
#[inline(always)]
|
||||
fn binop(left: &Mat2<N>, right: &Vec2<N>) -> Vec2<N> {
|
||||
fn mul(&self, right: &Vec2<N>) -> Vec2<N> {
|
||||
Vec2::new(
|
||||
left.m11 * right.x + left.m12 * right.y,
|
||||
left.m21 * right.x + left.m22 * right.y
|
||||
self.m11 * right.x + self.m12 * right.y,
|
||||
self.m21 * right.x + self.m22 * right.y
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mat3MulRhs<N, Pnt3<N>> for Pnt3<N> {
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mul<Pnt3<N>, Pnt3<N>> for Mat3<N> {
|
||||
#[inline(always)]
|
||||
fn binop(left: &Mat3<N>, right: &Pnt3<N>) -> Pnt3<N> {
|
||||
fn mul(&self, right: &Pnt3<N>) -> Pnt3<N> {
|
||||
Pnt3::new(
|
||||
left.m11 * right.x + left.m12 * right.y + left.m13 * right.z,
|
||||
left.m21 * right.x + left.m22 * right.y + left.m23 * right.z,
|
||||
left.m31 * right.x + left.m32 * right.y + left.m33 * right.z
|
||||
self.m11 * right.x + self.m12 * right.y + self.m13 * right.z,
|
||||
self.m21 * right.x + self.m22 * right.y + self.m23 * right.z,
|
||||
self.m31 * right.x + self.m32 * right.y + self.m33 * right.z
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Mul<N, N> + Add<N, N>> Pnt3MulRhs<N, Pnt3<N>> for Mat3<N> {
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mul<Mat3<N>, Pnt3<N>> for Pnt3<N> {
|
||||
#[inline(always)]
|
||||
fn binop(left: &Pnt3<N>, right: &Mat3<N>) -> Pnt3<N> {
|
||||
fn mul(&self, right: &Mat3<N>) -> Pnt3<N> {
|
||||
Pnt3::new(
|
||||
left.x * right.m11 + left.y * right.m21 + left.z * right.m31,
|
||||
left.x * right.m12 + left.y * right.m22 + left.z * right.m32,
|
||||
left.x * right.m13 + left.y * right.m23 + left.z * right.m33
|
||||
self.x * right.m11 + self.y * right.m21 + self.z * right.m31,
|
||||
self.x * right.m12 + self.y * right.m22 + self.z * right.m32,
|
||||
self.x * right.m13 + self.y * right.m23 + self.z * right.m33
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Mul<N, N> + Add<N, N>> Pnt2MulRhs<N, Pnt2<N>> for Mat2<N> {
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mul<Mat2<N>, Pnt2<N>> for Pnt2<N> {
|
||||
#[inline(always)]
|
||||
fn binop(left: &Pnt2<N>, right: &Mat2<N>) -> Pnt2<N> {
|
||||
fn mul(&self, right: &Mat2<N>) -> Pnt2<N> {
|
||||
Pnt2::new(
|
||||
left.x * right.m11 + left.y * right.m21,
|
||||
left.x * right.m12 + left.y * right.m22
|
||||
self.x * right.m11 + self.y * right.m21,
|
||||
self.x * right.m12 + self.y * right.m22
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mat2MulRhs<N, Pnt2<N>> for Pnt2<N> {
|
||||
impl<N: Mul<N, N> + Add<N, N>> Mul<Pnt2<N>, Pnt2<N>> for Mat2<N> {
|
||||
#[inline(always)]
|
||||
fn binop(left: &Mat2<N>, right: &Pnt2<N>) -> Pnt2<N> {
|
||||
fn mul(&self, right: &Pnt2<N>) -> Pnt2<N> {
|
||||
Pnt2::new(
|
||||
left.m11 * right.x + left.m12 * right.y,
|
||||
left.m21 * right.x + left.m22 * right.y
|
||||
self.m11 * right.x + self.m12 * right.y,
|
||||
self.m21 * right.x + self.m22 * right.y
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -33,26 +33,16 @@ impl<N> Vec0<N> {
|
||||
}
|
||||
|
||||
/// Vector of dimension 1.
|
||||
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Show)]
|
||||
pub struct Vec1<N> {
|
||||
/// First component of the vector.
|
||||
pub x: N
|
||||
}
|
||||
|
||||
double_dispatch_binop_decl_trait!(Vec1, Vec1MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec1, Vec1DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec1, Vec1AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec1, Vec1SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Vec1, Vec1Cast)
|
||||
mul_redispatch_impl!(Vec1, Vec1MulRhs)
|
||||
div_redispatch_impl!(Vec1, Vec1DivRhs)
|
||||
add_redispatch_impl!(Vec1, Vec1AddRhs)
|
||||
sub_redispatch_impl!(Vec1, Vec1SubRhs)
|
||||
cast_redispatch_impl!(Vec1, Vec1Cast)
|
||||
new_impl!(Vec1, x)
|
||||
ord_impl!(Vec1, x)
|
||||
vec_axis_impl!(Vec1, x)
|
||||
vec_cast_impl!(Vec1, Vec1Cast, x)
|
||||
vec_cast_impl!(Vec1, x)
|
||||
as_array_impl!(Vec1, 1)
|
||||
index_impl!(Vec1)
|
||||
indexable_impl!(Vec1, 1)
|
||||
@ -61,61 +51,17 @@ new_repeat_impl!(Vec1, val, x)
|
||||
dim_impl!(Vec1, 1)
|
||||
container_impl!(Vec1)
|
||||
// (specialized) basis_impl!(Vec1, 1)
|
||||
add_impl!(Vec1, Vec1AddRhs, x)
|
||||
sub_impl!(Vec1, Vec1SubRhs, x)
|
||||
mul_impl!(Vec1, Vec1MulRhs, x)
|
||||
div_impl!(Vec1, Vec1DivRhs, x)
|
||||
add_impl!(Vec1, x)
|
||||
sub_impl!(Vec1, x)
|
||||
mul_impl!(Vec1, x)
|
||||
div_impl!(Vec1, x)
|
||||
scalar_add_impl!(Vec1, x)
|
||||
scalar_sub_impl!(Vec1, x)
|
||||
scalar_mul_impl!(Vec1, x)
|
||||
scalar_div_impl!(Vec1, x)
|
||||
neg_impl!(Vec1, x)
|
||||
dot_impl!(Vec1, x)
|
||||
scalar_ops_impl!(Vec1, x)
|
||||
vec_mul_scalar_impl!(Vec1, f64, Vec1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Vec1, f32, Vec1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Vec1, u64, Vec1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Vec1, u32, Vec1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Vec1, u16, Vec1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Vec1, u8, Vec1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Vec1, i64, Vec1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Vec1, i32, Vec1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Vec1, i16, Vec1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Vec1, i8, Vec1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Vec1, uint, Vec1MulRhs, x)
|
||||
vec_mul_scalar_impl!(Vec1, int, Vec1MulRhs, x)
|
||||
vec_div_scalar_impl!(Vec1, f64, Vec1DivRhs, x)
|
||||
vec_div_scalar_impl!(Vec1, f32, Vec1DivRhs, x)
|
||||
vec_div_scalar_impl!(Vec1, u64, Vec1DivRhs, x)
|
||||
vec_div_scalar_impl!(Vec1, u32, Vec1DivRhs, x)
|
||||
vec_div_scalar_impl!(Vec1, u16, Vec1DivRhs, x)
|
||||
vec_div_scalar_impl!(Vec1, u8, Vec1DivRhs, x)
|
||||
vec_div_scalar_impl!(Vec1, i64, Vec1DivRhs, x)
|
||||
vec_div_scalar_impl!(Vec1, i32, Vec1DivRhs, x)
|
||||
vec_div_scalar_impl!(Vec1, i16, Vec1DivRhs, x)
|
||||
vec_div_scalar_impl!(Vec1, i8, Vec1DivRhs, x)
|
||||
vec_div_scalar_impl!(Vec1, uint, Vec1DivRhs, x)
|
||||
vec_div_scalar_impl!(Vec1, int, Vec1DivRhs, x)
|
||||
vec_add_scalar_impl!(Vec1, f64, Vec1AddRhs, x)
|
||||
vec_add_scalar_impl!(Vec1, f32, Vec1AddRhs, x)
|
||||
vec_add_scalar_impl!(Vec1, u64, Vec1AddRhs, x)
|
||||
vec_add_scalar_impl!(Vec1, u32, Vec1AddRhs, x)
|
||||
vec_add_scalar_impl!(Vec1, u16, Vec1AddRhs, x)
|
||||
vec_add_scalar_impl!(Vec1, u8, Vec1AddRhs, x)
|
||||
vec_add_scalar_impl!(Vec1, i64, Vec1AddRhs, x)
|
||||
vec_add_scalar_impl!(Vec1, i32, Vec1AddRhs, x)
|
||||
vec_add_scalar_impl!(Vec1, i16, Vec1AddRhs, x)
|
||||
vec_add_scalar_impl!(Vec1, i8, Vec1AddRhs, x)
|
||||
vec_add_scalar_impl!(Vec1, uint, Vec1AddRhs, x)
|
||||
vec_add_scalar_impl!(Vec1, int, Vec1AddRhs, x)
|
||||
vec_sub_scalar_impl!(Vec1, f64, Vec1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Vec1, f32, Vec1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Vec1, u64, Vec1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Vec1, u32, Vec1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Vec1, u16, Vec1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Vec1, u8, Vec1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Vec1, i64, Vec1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Vec1, i32, Vec1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Vec1, i16, Vec1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Vec1, i8, Vec1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Vec1, uint, Vec1SubRhs, x)
|
||||
vec_sub_scalar_impl!(Vec1, int, Vec1SubRhs, x)
|
||||
translation_impl!(Vec1)
|
||||
norm_impl!(Vec1, x)
|
||||
approx_eq_impl!(Vec1, x)
|
||||
@ -132,7 +78,7 @@ rotate_impl!(Vec1)
|
||||
rotate_impl!(Pnt1)
|
||||
transform_impl!(Vec1, Pnt1)
|
||||
vec_as_pnt_impl!(Vec1, Pnt1, x)
|
||||
num_float_vec_impl!(Vec1, Vec1MulRhs, Vec1DivRhs)
|
||||
num_float_vec_impl!(Vec1)
|
||||
absolute_vec_impl!(Vec1, x)
|
||||
|
||||
/// Vector of dimension 2.
|
||||
@ -144,20 +90,10 @@ pub struct Vec2<N> {
|
||||
pub y: N
|
||||
}
|
||||
|
||||
double_dispatch_binop_decl_trait!(Vec2, Vec2MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec2, Vec2DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec2, Vec2AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec2, Vec2SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Vec2, Vec2Cast)
|
||||
mul_redispatch_impl!(Vec2, Vec2MulRhs)
|
||||
div_redispatch_impl!(Vec2, Vec2DivRhs)
|
||||
add_redispatch_impl!(Vec2, Vec2AddRhs)
|
||||
sub_redispatch_impl!(Vec2, Vec2SubRhs)
|
||||
cast_redispatch_impl!(Vec2, Vec2Cast)
|
||||
new_impl!(Vec2, x, y)
|
||||
ord_impl!(Vec2, x, y)
|
||||
vec_axis_impl!(Vec2, x, y)
|
||||
vec_cast_impl!(Vec2, Vec2Cast, x, y)
|
||||
vec_cast_impl!(Vec2, x, y)
|
||||
as_array_impl!(Vec2, 2)
|
||||
index_impl!(Vec2)
|
||||
indexable_impl!(Vec2, 2)
|
||||
@ -166,61 +102,17 @@ new_repeat_impl!(Vec2, val, x, y)
|
||||
dim_impl!(Vec2, 2)
|
||||
container_impl!(Vec2)
|
||||
// (specialized) basis_impl!(Vec2, 1)
|
||||
add_impl!(Vec2, Vec2AddRhs, x, y)
|
||||
sub_impl!(Vec2, Vec2SubRhs, x, y)
|
||||
mul_impl!(Vec2, Vec2MulRhs, x, y)
|
||||
div_impl!(Vec2, Vec2DivRhs, x, y)
|
||||
add_impl!(Vec2, x, y)
|
||||
sub_impl!(Vec2, x, y)
|
||||
mul_impl!(Vec2, x, y)
|
||||
div_impl!(Vec2, x, y)
|
||||
scalar_add_impl!(Vec2, x, y)
|
||||
scalar_sub_impl!(Vec2, x, y)
|
||||
scalar_mul_impl!(Vec2, x, y)
|
||||
scalar_div_impl!(Vec2, x, y)
|
||||
neg_impl!(Vec2, x, y)
|
||||
dot_impl!(Vec2, x, y)
|
||||
scalar_ops_impl!(Vec2, x, y)
|
||||
vec_mul_scalar_impl!(Vec2, f64, Vec2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Vec2, f32, Vec2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Vec2, u64, Vec2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Vec2, u32, Vec2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Vec2, u16, Vec2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Vec2, u8, Vec2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Vec2, i64, Vec2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Vec2, i32, Vec2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Vec2, i16, Vec2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Vec2, i8, Vec2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Vec2, uint, Vec2MulRhs, x, y)
|
||||
vec_mul_scalar_impl!(Vec2, int, Vec2MulRhs, x, y)
|
||||
vec_div_scalar_impl!(Vec2, f64, Vec2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Vec2, f32, Vec2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Vec2, u64, Vec2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Vec2, u32, Vec2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Vec2, u16, Vec2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Vec2, u8, Vec2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Vec2, i64, Vec2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Vec2, i32, Vec2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Vec2, i16, Vec2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Vec2, i8, Vec2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Vec2, uint, Vec2DivRhs, x, y)
|
||||
vec_div_scalar_impl!(Vec2, int, Vec2DivRhs, x, y)
|
||||
vec_add_scalar_impl!(Vec2, f64, Vec2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Vec2, f32, Vec2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Vec2, u64, Vec2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Vec2, u32, Vec2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Vec2, u16, Vec2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Vec2, u8, Vec2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Vec2, i64, Vec2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Vec2, i32, Vec2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Vec2, i16, Vec2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Vec2, i8, Vec2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Vec2, uint, Vec2AddRhs, x, y)
|
||||
vec_add_scalar_impl!(Vec2, int, Vec2AddRhs, x, y)
|
||||
vec_sub_scalar_impl!(Vec2, f64, Vec2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Vec2, f32, Vec2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Vec2, u64, Vec2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Vec2, u32, Vec2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Vec2, u16, Vec2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Vec2, u8, Vec2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Vec2, i64, Vec2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Vec2, i32, Vec2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Vec2, i16, Vec2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Vec2, i8, Vec2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Vec2, uint, Vec2SubRhs, x, y)
|
||||
vec_sub_scalar_impl!(Vec2, int, Vec2SubRhs, x, y)
|
||||
translation_impl!(Vec2)
|
||||
norm_impl!(Vec2, x, y)
|
||||
approx_eq_impl!(Vec2, x, y)
|
||||
@ -237,7 +129,7 @@ rotate_impl!(Vec2)
|
||||
rotate_impl!(Pnt2)
|
||||
transform_impl!(Vec2, Pnt2)
|
||||
vec_as_pnt_impl!(Vec2, Pnt2, x, y)
|
||||
num_float_vec_impl!(Vec2, Vec2MulRhs, Vec2DivRhs)
|
||||
num_float_vec_impl!(Vec2)
|
||||
absolute_vec_impl!(Vec2, x, y)
|
||||
|
||||
/// Vector of dimension 3.
|
||||
@ -251,20 +143,10 @@ pub struct Vec3<N> {
|
||||
pub z: N
|
||||
}
|
||||
|
||||
double_dispatch_binop_decl_trait!(Vec3, Vec3MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec3, Vec3DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec3, Vec3AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec3, Vec3SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Vec3, Vec3Cast)
|
||||
mul_redispatch_impl!(Vec3, Vec3MulRhs)
|
||||
div_redispatch_impl!(Vec3, Vec3DivRhs)
|
||||
add_redispatch_impl!(Vec3, Vec3AddRhs)
|
||||
sub_redispatch_impl!(Vec3, Vec3SubRhs)
|
||||
cast_redispatch_impl!(Vec3, Vec3Cast)
|
||||
new_impl!(Vec3, x, y, z)
|
||||
ord_impl!(Vec3, x, y, z)
|
||||
vec_axis_impl!(Vec3, x, y, z)
|
||||
vec_cast_impl!(Vec3, Vec3Cast, x, y, z)
|
||||
vec_cast_impl!(Vec3, x, y, z)
|
||||
as_array_impl!(Vec3, 3)
|
||||
index_impl!(Vec3)
|
||||
indexable_impl!(Vec3, 3)
|
||||
@ -273,64 +155,17 @@ new_repeat_impl!(Vec3, val, x, y, z)
|
||||
dim_impl!(Vec3, 3)
|
||||
container_impl!(Vec3)
|
||||
// (specialized) basis_impl!(Vec3, 1)
|
||||
add_impl!(Vec3, Vec3AddRhs, x, y, z)
|
||||
sub_impl!(Vec3, Vec3SubRhs, x, y, z)
|
||||
mul_impl!(Vec3, Vec3MulRhs, x, y, z)
|
||||
div_impl!(Vec3, Vec3DivRhs, x, y, z)
|
||||
add_impl!(Vec3, x, y, z)
|
||||
sub_impl!(Vec3, x, y, z)
|
||||
mul_impl!(Vec3, x, y, z)
|
||||
div_impl!(Vec3, x, y, z)
|
||||
scalar_add_impl!(Vec3, x, y, z)
|
||||
scalar_sub_impl!(Vec3, x, y, z)
|
||||
scalar_mul_impl!(Vec3, x, y, z)
|
||||
scalar_div_impl!(Vec3, x, y, z)
|
||||
neg_impl!(Vec3, x, y, z)
|
||||
dot_impl!(Vec3, x, y, z)
|
||||
scalar_ops_impl!(Vec3, x, y, z)
|
||||
vec_mul_scalar_impl!(Vec3, f64, Vec3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Vec3, f32, Vec3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Vec3, u64, Vec3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Vec3, u32, Vec3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Vec3, u16, Vec3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Vec3, u8, Vec3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Vec3, i64, Vec3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Vec3, i32, Vec3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Vec3, i16, Vec3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Vec3, i8, Vec3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Vec3, uint, Vec3MulRhs, x, y, z)
|
||||
vec_mul_scalar_impl!(Vec3, int, Vec3MulRhs, x, y, z)
|
||||
|
||||
vec_div_scalar_impl!(Vec3, f64, Vec3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Vec3, f32, Vec3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Vec3, u64, Vec3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Vec3, u32, Vec3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Vec3, u16, Vec3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Vec3, u8, Vec3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Vec3, i64, Vec3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Vec3, i32, Vec3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Vec3, i16, Vec3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Vec3, i8, Vec3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Vec3, uint, Vec3DivRhs, x, y, z)
|
||||
vec_div_scalar_impl!(Vec3, int, Vec3DivRhs, x, y, z)
|
||||
|
||||
vec_add_scalar_impl!(Vec3, f64, Vec3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Vec3, f32, Vec3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Vec3, u64, Vec3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Vec3, u32, Vec3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Vec3, u16, Vec3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Vec3, u8, Vec3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Vec3, i64, Vec3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Vec3, i32, Vec3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Vec3, i16, Vec3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Vec3, i8, Vec3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Vec3, uint, Vec3AddRhs, x, y, z)
|
||||
vec_add_scalar_impl!(Vec3, int, Vec3AddRhs, x, y, z)
|
||||
|
||||
vec_sub_scalar_impl!(Vec3, f64, Vec3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Vec3, f32, Vec3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Vec3, u64, Vec3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Vec3, u32, Vec3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Vec3, u16, Vec3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Vec3, u8, Vec3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Vec3, i64, Vec3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Vec3, i32, Vec3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Vec3, i16, Vec3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Vec3, i8, Vec3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Vec3, uint, Vec3SubRhs, x, y, z)
|
||||
vec_sub_scalar_impl!(Vec3, int, Vec3SubRhs, x, y, z)
|
||||
translation_impl!(Vec3)
|
||||
norm_impl!(Vec3, x, y ,z)
|
||||
approx_eq_impl!(Vec3, x, y, z)
|
||||
@ -347,7 +182,7 @@ rotate_impl!(Vec3)
|
||||
rotate_impl!(Pnt3)
|
||||
transform_impl!(Vec3, Pnt3)
|
||||
vec_as_pnt_impl!(Vec3, Pnt3, x, y, z)
|
||||
num_float_vec_impl!(Vec3, Vec3MulRhs, Vec3DivRhs)
|
||||
num_float_vec_impl!(Vec3)
|
||||
absolute_vec_impl!(Vec3, x, y, z)
|
||||
|
||||
|
||||
@ -364,20 +199,10 @@ pub struct Vec4<N> {
|
||||
pub w: N
|
||||
}
|
||||
|
||||
double_dispatch_binop_decl_trait!(Vec4, Vec4MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec4, Vec4DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec4, Vec4AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec4, Vec4SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Vec4, Vec4Cast)
|
||||
mul_redispatch_impl!(Vec4, Vec4MulRhs)
|
||||
div_redispatch_impl!(Vec4, Vec4DivRhs)
|
||||
add_redispatch_impl!(Vec4, Vec4AddRhs)
|
||||
sub_redispatch_impl!(Vec4, Vec4SubRhs)
|
||||
cast_redispatch_impl!(Vec4, Vec4Cast)
|
||||
new_impl!(Vec4, x, y, z, w)
|
||||
ord_impl!(Vec4, x, y, z, w)
|
||||
vec_axis_impl!(Vec4, x, y, z, w)
|
||||
vec_cast_impl!(Vec4, Vec4Cast, x, y, z, w)
|
||||
vec_cast_impl!(Vec4, x, y, z, w)
|
||||
as_array_impl!(Vec4, 4)
|
||||
index_impl!(Vec4)
|
||||
indexable_impl!(Vec4, 4)
|
||||
@ -385,62 +210,18 @@ at_fast_impl!(Vec4, 4)
|
||||
new_repeat_impl!(Vec4, val, x, y, z, w)
|
||||
dim_impl!(Vec4, 4)
|
||||
container_impl!(Vec4)
|
||||
basis_impl!(Vec4, Vec4MulRhs, 4)
|
||||
add_impl!(Vec4, Vec4AddRhs, x, y, z, w)
|
||||
sub_impl!(Vec4, Vec4SubRhs, x, y, z, w)
|
||||
mul_impl!(Vec4, Vec4MulRhs, x, y, z, w)
|
||||
div_impl!(Vec4, Vec4DivRhs, x, y, z, w)
|
||||
basis_impl!(Vec4, 4)
|
||||
add_impl!(Vec4, x, y, z, w)
|
||||
sub_impl!(Vec4, x, y, z, w)
|
||||
mul_impl!(Vec4, x, y, z, w)
|
||||
div_impl!(Vec4, x, y, z, w)
|
||||
scalar_add_impl!(Vec4, x, y, z, w)
|
||||
scalar_sub_impl!(Vec4, x, y, z, w)
|
||||
scalar_mul_impl!(Vec4, x, y, z, w)
|
||||
scalar_div_impl!(Vec4, x, y, z, w)
|
||||
neg_impl!(Vec4, x, y, z, w)
|
||||
dot_impl!(Vec4, x, y, z, w)
|
||||
scalar_ops_impl!(Vec4, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Vec4, f64, Vec4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Vec4, f32, Vec4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Vec4, u64, Vec4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Vec4, u32, Vec4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Vec4, u16, Vec4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Vec4, u8, Vec4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Vec4, i64, Vec4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Vec4, i32, Vec4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Vec4, i16, Vec4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Vec4, i8, Vec4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Vec4, uint, Vec4MulRhs, x, y, z, w)
|
||||
vec_mul_scalar_impl!(Vec4, int, Vec4MulRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Vec4, f64, Vec4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Vec4, f32, Vec4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Vec4, u64, Vec4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Vec4, u32, Vec4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Vec4, u16, Vec4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Vec4, u8, Vec4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Vec4, i64, Vec4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Vec4, i32, Vec4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Vec4, i16, Vec4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Vec4, i8, Vec4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Vec4, uint, Vec4DivRhs, x, y, z, w)
|
||||
vec_div_scalar_impl!(Vec4, int, Vec4DivRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Vec4, f64, Vec4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Vec4, f32, Vec4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Vec4, u64, Vec4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Vec4, u32, Vec4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Vec4, u16, Vec4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Vec4, u8, Vec4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Vec4, i64, Vec4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Vec4, i32, Vec4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Vec4, i16, Vec4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Vec4, i8, Vec4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Vec4, uint, Vec4AddRhs, x, y, z, w)
|
||||
vec_add_scalar_impl!(Vec4, int, Vec4AddRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Vec4, f64, Vec4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Vec4, f32, Vec4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Vec4, u64, Vec4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Vec4, u32, Vec4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Vec4, u16, Vec4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Vec4, u8, Vec4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Vec4, i64, Vec4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Vec4, i32, Vec4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Vec4, i16, Vec4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Vec4, i8, Vec4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Vec4, uint, Vec4SubRhs, x, y, z, w)
|
||||
vec_sub_scalar_impl!(Vec4, int, Vec4SubRhs, x, y, z, w)
|
||||
translation_impl!(Vec4)
|
||||
norm_impl!(Vec4, x, y, z, w)
|
||||
approx_eq_impl!(Vec4, x, y, z, w)
|
||||
@ -457,7 +238,7 @@ rotate_impl!(Vec4)
|
||||
rotate_impl!(Pnt4)
|
||||
transform_impl!(Vec4, Pnt4)
|
||||
vec_as_pnt_impl!(Vec4, Pnt4, x, y, z, w)
|
||||
num_float_vec_impl!(Vec4, Vec4MulRhs, Vec4DivRhs)
|
||||
num_float_vec_impl!(Vec4)
|
||||
absolute_vec_impl!(Vec4, x, y, z, w)
|
||||
|
||||
/// Vector of dimension 5.
|
||||
@ -475,20 +256,10 @@ pub struct Vec5<N> {
|
||||
pub a: N
|
||||
}
|
||||
|
||||
double_dispatch_binop_decl_trait!(Vec5, Vec5MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec5, Vec5DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec5, Vec5AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec5, Vec5SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Vec5, Vec5Cast)
|
||||
mul_redispatch_impl!(Vec5, Vec5MulRhs)
|
||||
div_redispatch_impl!(Vec5, Vec5DivRhs)
|
||||
add_redispatch_impl!(Vec5, Vec5AddRhs)
|
||||
sub_redispatch_impl!(Vec5, Vec5SubRhs)
|
||||
cast_redispatch_impl!(Vec5, Vec5Cast)
|
||||
new_impl!(Vec5, x, y, z, w, a)
|
||||
ord_impl!(Vec5, x, y, z, w, a)
|
||||
vec_axis_impl!(Vec5, x, y, z, w, a)
|
||||
vec_cast_impl!(Vec5, Vec5Cast, x, y, z, w, a)
|
||||
vec_cast_impl!(Vec5, x, y, z, w, a)
|
||||
as_array_impl!(Vec5, 5)
|
||||
index_impl!(Vec5)
|
||||
indexable_impl!(Vec5, 5)
|
||||
@ -496,62 +267,18 @@ at_fast_impl!(Vec5, 5)
|
||||
new_repeat_impl!(Vec5, val, x, y, z, w, a)
|
||||
dim_impl!(Vec5, 5)
|
||||
container_impl!(Vec5)
|
||||
basis_impl!(Vec5, Vec5MulRhs, 5)
|
||||
add_impl!(Vec5, Vec5AddRhs, x, y, z, w, a)
|
||||
sub_impl!(Vec5, Vec5SubRhs, x, y, z, w, a)
|
||||
mul_impl!(Vec5, Vec5MulRhs, x, y, z, w, a)
|
||||
div_impl!(Vec5, Vec5DivRhs, x, y, z, w, a)
|
||||
basis_impl!(Vec5, 5)
|
||||
add_impl!(Vec5, x, y, z, w, a)
|
||||
sub_impl!(Vec5, x, y, z, w, a)
|
||||
mul_impl!(Vec5, x, y, z, w, a)
|
||||
div_impl!(Vec5, x, y, z, w, a)
|
||||
scalar_add_impl!(Vec5, x, y, z, w, a)
|
||||
scalar_sub_impl!(Vec5, x, y, z, w, a)
|
||||
scalar_mul_impl!(Vec5, x, y, z, w, a)
|
||||
scalar_div_impl!(Vec5, x, y, z, w, a)
|
||||
neg_impl!(Vec5, x, y, z, w, a)
|
||||
dot_impl!(Vec5, x, y, z, w, a)
|
||||
scalar_ops_impl!(Vec5, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Vec5, f64, Vec5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Vec5, f32, Vec5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Vec5, u64, Vec5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Vec5, u32, Vec5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Vec5, u16, Vec5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Vec5, u8, Vec5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Vec5, i64, Vec5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Vec5, i32, Vec5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Vec5, i16, Vec5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Vec5, i8, Vec5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Vec5, uint, Vec5MulRhs, x, y, z, w, a)
|
||||
vec_mul_scalar_impl!(Vec5, int, Vec5MulRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Vec5, f64, Vec5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Vec5, f32, Vec5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Vec5, u64, Vec5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Vec5, u32, Vec5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Vec5, u16, Vec5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Vec5, u8, Vec5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Vec5, i64, Vec5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Vec5, i32, Vec5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Vec5, i16, Vec5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Vec5, i8, Vec5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Vec5, uint, Vec5DivRhs, x, y, z, w, a)
|
||||
vec_div_scalar_impl!(Vec5, int, Vec5DivRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Vec5, f64, Vec5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Vec5, f32, Vec5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Vec5, u64, Vec5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Vec5, u32, Vec5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Vec5, u16, Vec5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Vec5, u8, Vec5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Vec5, i64, Vec5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Vec5, i32, Vec5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Vec5, i16, Vec5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Vec5, i8, Vec5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Vec5, uint, Vec5AddRhs, x, y, z, w, a)
|
||||
vec_add_scalar_impl!(Vec5, int, Vec5AddRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Vec5, f64, Vec5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Vec5, f32, Vec5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Vec5, u64, Vec5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Vec5, u32, Vec5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Vec5, u16, Vec5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Vec5, u8, Vec5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Vec5, i64, Vec5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Vec5, i32, Vec5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Vec5, i16, Vec5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Vec5, i8, Vec5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Vec5, uint, Vec5SubRhs, x, y, z, w, a)
|
||||
vec_sub_scalar_impl!(Vec5, int, Vec5SubRhs, x, y, z, w, a)
|
||||
translation_impl!(Vec5)
|
||||
norm_impl!(Vec5, x, y, z, w, a)
|
||||
approx_eq_impl!(Vec5, x, y, z, w, a)
|
||||
@ -568,7 +295,7 @@ rotate_impl!(Vec5)
|
||||
rotate_impl!(Pnt5)
|
||||
transform_impl!(Vec5, Pnt5)
|
||||
vec_as_pnt_impl!(Vec5, Pnt5, x, y, z, w, a)
|
||||
num_float_vec_impl!(Vec5, Vec5MulRhs, Vec5DivRhs)
|
||||
num_float_vec_impl!(Vec5)
|
||||
absolute_vec_impl!(Vec5, x, y, z, w, a)
|
||||
|
||||
/// Vector of dimension 6.
|
||||
@ -588,20 +315,10 @@ pub struct Vec6<N> {
|
||||
pub b: N
|
||||
}
|
||||
|
||||
double_dispatch_binop_decl_trait!(Vec6, Vec6MulRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec6, Vec6DivRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec6, Vec6AddRhs)
|
||||
double_dispatch_binop_decl_trait!(Vec6, Vec6SubRhs)
|
||||
double_dispatch_cast_decl_trait!(Vec6, Vec6Cast)
|
||||
mul_redispatch_impl!(Vec6, Vec6MulRhs)
|
||||
div_redispatch_impl!(Vec6, Vec6DivRhs)
|
||||
add_redispatch_impl!(Vec6, Vec6AddRhs)
|
||||
sub_redispatch_impl!(Vec6, Vec6SubRhs)
|
||||
cast_redispatch_impl!(Vec6, Vec6Cast)
|
||||
new_impl!(Vec6, x, y, z, w, a, b)
|
||||
ord_impl!(Vec6, x, y, z, w, a, b)
|
||||
vec_axis_impl!(Vec6, x, y, z, w, a, b)
|
||||
vec_cast_impl!(Vec6, Vec6Cast, x, y, z, w, a, b)
|
||||
vec_cast_impl!(Vec6, x, y, z, w, a, b)
|
||||
as_array_impl!(Vec6, 6)
|
||||
index_impl!(Vec6)
|
||||
indexable_impl!(Vec6, 6)
|
||||
@ -609,62 +326,18 @@ at_fast_impl!(Vec6, 6)
|
||||
new_repeat_impl!(Vec6, val, x, y, z, w, a, b)
|
||||
dim_impl!(Vec6, 6)
|
||||
container_impl!(Vec6)
|
||||
basis_impl!(Vec6, Vec6MulRhs, 6)
|
||||
add_impl!(Vec6, Vec6AddRhs, x, y, z, w, a, b)
|
||||
sub_impl!(Vec6, Vec6SubRhs, x, y, z, w, a, b)
|
||||
mul_impl!(Vec6, Vec6MulRhs, x, y, z, w, a, b)
|
||||
div_impl!(Vec6, Vec6DivRhs, x, y, z, w, a, b)
|
||||
basis_impl!(Vec6, 6)
|
||||
add_impl!(Vec6, x, y, z, w, a, b)
|
||||
sub_impl!(Vec6, x, y, z, w, a, b)
|
||||
mul_impl!(Vec6, x, y, z, w, a, b)
|
||||
div_impl!(Vec6, x, y, z, w, a, b)
|
||||
scalar_add_impl!(Vec6, x, y, z, w, a, b)
|
||||
scalar_sub_impl!(Vec6, x, y, z, w, a, b)
|
||||
scalar_mul_impl!(Vec6, x, y, z, w, a, b)
|
||||
scalar_div_impl!(Vec6, x, y, z, w, a, b)
|
||||
neg_impl!(Vec6, x, y, z, w, a, b)
|
||||
dot_impl!(Vec6, x, y, z, w, a, b)
|
||||
scalar_ops_impl!(Vec6, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Vec6, f64, Vec6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Vec6, f32, Vec6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Vec6, u64, Vec6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Vec6, u32, Vec6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Vec6, u16, Vec6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Vec6, u8, Vec6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Vec6, i64, Vec6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Vec6, i32, Vec6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Vec6, i16, Vec6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Vec6, i8, Vec6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Vec6, uint, Vec6MulRhs, x, y, z, w, a, b)
|
||||
vec_mul_scalar_impl!(Vec6, int, Vec6MulRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Vec6, f64, Vec6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Vec6, f32, Vec6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Vec6, u64, Vec6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Vec6, u32, Vec6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Vec6, u16, Vec6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Vec6, u8, Vec6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Vec6, i64, Vec6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Vec6, i32, Vec6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Vec6, i16, Vec6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Vec6, i8, Vec6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Vec6, uint, Vec6DivRhs, x, y, z, w, a, b)
|
||||
vec_div_scalar_impl!(Vec6, int, Vec6DivRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Vec6, f64, Vec6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Vec6, f32, Vec6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Vec6, u64, Vec6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Vec6, u32, Vec6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Vec6, u16, Vec6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Vec6, u8, Vec6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Vec6, i64, Vec6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Vec6, i32, Vec6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Vec6, i16, Vec6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Vec6, i8, Vec6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Vec6, uint, Vec6AddRhs, x, y, z, w, a, b)
|
||||
vec_add_scalar_impl!(Vec6, int, Vec6AddRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Vec6, f64, Vec6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Vec6, f32, Vec6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Vec6, u64, Vec6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Vec6, u32, Vec6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Vec6, u16, Vec6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Vec6, u8, Vec6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Vec6, i64, Vec6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Vec6, i32, Vec6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Vec6, i16, Vec6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Vec6, i8, Vec6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Vec6, uint, Vec6SubRhs, x, y, z, w, a, b)
|
||||
vec_sub_scalar_impl!(Vec6, int, Vec6SubRhs, x, y, z, w, a, b)
|
||||
translation_impl!(Vec6)
|
||||
norm_impl!(Vec6, x, y, z, w, a, b)
|
||||
approx_eq_impl!(Vec6, x, y, z, w, a, b)
|
||||
@ -679,5 +352,5 @@ rotate_impl!(Vec6)
|
||||
rotate_impl!(Pnt6)
|
||||
transform_impl!(Vec6, Pnt6)
|
||||
vec_as_pnt_impl!(Vec6, Pnt6, x, y, z, w, a, b)
|
||||
num_float_vec_impl!(Vec6, Vec6MulRhs, Vec6DivRhs)
|
||||
num_float_vec_impl!(Vec6)
|
||||
absolute_vec_impl!(Vec6, x, y, z, w, a, b)
|
||||
|
@ -180,10 +180,10 @@ macro_rules! vec_axis_impl(
|
||||
)
|
||||
|
||||
macro_rules! vec_cast_impl(
|
||||
($t: ident, $tcast: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<Nin: Clone, Nout: Clone + Cast<Nin>> $tcast<Nout> for $t<Nin> {
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<Nin: Clone, Nout: Clone + Cast<Nin>> Cast<$t<Nin>> for $t<Nout> {
|
||||
#[inline]
|
||||
fn to(v: $t<Nin>) -> $t<Nout> {
|
||||
fn from(v: $t<Nin>) -> $t<Nout> {
|
||||
$t::new(Cast::from(v.$comp0.clone()) $(, Cast::from(v.$compN.clone()))*)
|
||||
}
|
||||
}
|
||||
@ -314,8 +314,8 @@ macro_rules! container_impl(
|
||||
)
|
||||
|
||||
macro_rules! basis_impl(
|
||||
($t: ident, $trhs: ident, $dim: expr) => (
|
||||
impl<N: Clone + BaseFloat + ApproxEq<N> + $trhs<N, $t<N>>> Basis for $t<N> {
|
||||
($t: ident, $dim: expr) => (
|
||||
impl<N: Clone + BaseFloat + ApproxEq<N>> Basis for $t<N> {
|
||||
#[inline]
|
||||
fn canonical_basis(f: |$t<N>| -> bool) {
|
||||
for i in range(0u, $dim) {
|
||||
@ -390,44 +390,89 @@ macro_rules! axpy_impl(
|
||||
)
|
||||
|
||||
macro_rules! add_impl(
|
||||
($t: ident, $trhs: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Add<N, N>> $trhs<N, $t<N>> for $t<N> {
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Add<N, N>> Add<$t<N>, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$t<N>) -> $t<N> {
|
||||
$t::new(left.$comp0 + right.$comp0 $(, left.$compN + right.$compN)*)
|
||||
fn add(&self, right: &$t<N>) -> $t<N> {
|
||||
$t::new(self.$comp0 + right.$comp0 $(, self.$compN + right.$compN)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! scalar_add_impl(
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
// $t against scalar
|
||||
impl<N: Add<N, N>> Add<N, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn add(&self, right: &N) -> $t<N> {
|
||||
$t::new(self.$comp0 + *right $(, self.$compN + *right)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! sub_impl(
|
||||
($t: ident, $trhs: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Sub<N, N>> $trhs<N, $t<N>> for $t<N> {
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Sub<N, N>> Sub<$t<N>, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$t<N>) -> $t<N> {
|
||||
$t::new(left.$comp0 - right.$comp0 $(, left.$compN - right.$compN)*)
|
||||
fn sub(&self, right: &$t<N>) -> $t<N> {
|
||||
$t::new(self.$comp0 - right.$comp0 $(, self.$compN - right.$compN)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! scalar_sub_impl(
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Sub<N, N>> Sub<N, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn sub(&self, right: &N) -> $t<N> {
|
||||
$t::new(self.$comp0 - *right $(, self.$compN - *right)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! mul_impl(
|
||||
($t: ident, $trhs: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Mul<N, N>> $trhs<N, $t<N>> for $t<N> {
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Mul<N, N>> Mul<$t<N>, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$t<N>) -> $t<N> {
|
||||
$t::new(left.$comp0 * right.$comp0 $(, left.$compN * right.$compN)*)
|
||||
fn mul(&self, right: &$t<N>) -> $t<N> {
|
||||
$t::new(self.$comp0 * right.$comp0 $(, self.$compN * right.$compN)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! scalar_mul_impl(
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Mul<N, N>> Mul<N, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn mul(&self, right: &N) -> $t<N> {
|
||||
$t::new(self.$comp0 * *right $(, self.$compN * *right)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! div_impl(
|
||||
($t: ident, $trhs: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Div<N, N>> $trhs<N, $t<N>> for $t<N> {
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Div<N, N>> Div<$t<N>, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$t<N>, right: &$t<N>) -> $t<N> {
|
||||
$t::new(left.$comp0 / right.$comp0 $(, left.$compN / right.$compN)*)
|
||||
fn div(&self, right: &$t<N>) -> $t<N> {
|
||||
$t::new(self.$comp0 / right.$comp0 $(, self.$compN / right.$compN)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! scalar_div_impl(
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Div<N, N>> Div<N, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn div(&self, right: &N) -> $t<N> {
|
||||
$t::new(self.$comp0 / *right $(, self.$compN / *right)*)
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -801,13 +846,13 @@ macro_rules! vec_as_pnt_impl(
|
||||
)
|
||||
|
||||
macro_rules! num_float_vec_impl(
|
||||
($t: ident $(,$trhs: ident)*) => (
|
||||
($t: ident) => (
|
||||
impl<N> NumVec<N> for $t<N>
|
||||
where N: BaseNum + Zero $(+ $trhs<N, $t<N>>)* {
|
||||
where N: BaseNum {
|
||||
}
|
||||
|
||||
impl<N> FloatVec<N> for $t<N>
|
||||
where N: BaseNum + Zero + One + ApproxEq<N> + BaseFloat $(+ $trhs<N, $t<N>>)* {
|
||||
where N: BaseFloat + ApproxEq<N> {
|
||||
}
|
||||
)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user