forked from M-Labs/nalgebra
Remove some unneded visibility modifiers.
This commit is contained in:
parent
24e1862a9e
commit
a69f43bccd
@ -18,7 +18,7 @@ macro_rules! mat_cast_impl(
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<Nin: NumCast + Clone, Nout: NumCast> MatCast<$t<Nout>> for $t<Nin> {
|
||||
#[inline]
|
||||
pub fn from(m: $t<Nin>) -> $t<Nout> {
|
||||
fn from(m: $t<Nin>) -> $t<Nout> {
|
||||
$t::new(NumCast::from(m.$comp0.clone()) $(, NumCast::from(m.$compN.clone()) )*)
|
||||
}
|
||||
}
|
||||
@ -29,7 +29,7 @@ macro_rules! add_impl(
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Add<N, N>> Add<$t<N>, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
pub fn add(&self, other: &$t<N>) -> $t<N> {
|
||||
fn add(&self, other: &$t<N>) -> $t<N> {
|
||||
$t::new(self.$comp0 + other.$comp0 $(, self.$compN + other.$compN )*)
|
||||
}
|
||||
}
|
||||
@ -40,7 +40,7 @@ macro_rules! sub_impl(
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Sub<N, N>> Sub<$t<N>, $t<N>> for $t<N> {
|
||||
#[inline]
|
||||
pub fn sub(&self, other: &$t<N>) -> $t<N> {
|
||||
fn sub(&self, other: &$t<N>) -> $t<N> {
|
||||
$t::new(self.$comp0 - other.$comp0 $(, self.$compN - other.$compN )*)
|
||||
}
|
||||
}
|
||||
@ -51,12 +51,12 @@ macro_rules! scalar_mul_impl(
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Mul<N, N>> ScalarMul<N> for $t<N> {
|
||||
#[inline]
|
||||
pub fn scalar_mul(&self, other: &N) -> $t<N> {
|
||||
fn scalar_mul(&self, other: &N) -> $t<N> {
|
||||
$t::new(self.$comp0 * *other $(, self.$compN * *other )*)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn scalar_mul_inplace(&mut self, other: &N) {
|
||||
fn scalar_mul_inplace(&mut self, other: &N) {
|
||||
self.$comp0 = self.$comp0 * *other;
|
||||
$(self.$compN = self.$compN * *other; )*
|
||||
}
|
||||
@ -68,12 +68,12 @@ macro_rules! scalar_div_impl(
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Div<N, N>> ScalarDiv<N> for $t<N> {
|
||||
#[inline]
|
||||
pub fn scalar_div(&self, other: &N) -> $t<N> {
|
||||
fn scalar_div(&self, other: &N) -> $t<N> {
|
||||
$t::new(self.$comp0 / *other $(, self.$compN / *other )*)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn scalar_div_inplace(&mut self, other: &N) {
|
||||
fn scalar_div_inplace(&mut self, other: &N) {
|
||||
self.$comp0 = self.$comp0 / *other;
|
||||
$(self.$compN = self.$compN / *other; )*
|
||||
}
|
||||
@ -85,12 +85,12 @@ macro_rules! scalar_add_impl(
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Add<N, N>> ScalarAdd<N> for $t<N> {
|
||||
#[inline]
|
||||
pub fn scalar_add(&self, other: &N) -> $t<N> {
|
||||
fn scalar_add(&self, other: &N) -> $t<N> {
|
||||
$t::new(self.$comp0 + *other $(, self.$compN + *other )*)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn scalar_add_inplace(&mut self, other: &N) {
|
||||
fn scalar_add_inplace(&mut self, other: &N) {
|
||||
self.$comp0 = self.$comp0 + *other;
|
||||
$(self.$compN = self.$compN + *other; )*
|
||||
}
|
||||
@ -102,12 +102,12 @@ macro_rules! scalar_sub_impl(
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Sub<N, N>> ScalarSub<N> for $t<N> {
|
||||
#[inline]
|
||||
pub fn scalar_sub(&self, other: &N) -> $t<N> {
|
||||
fn scalar_sub(&self, other: &N) -> $t<N> {
|
||||
$t::new(self.$comp0 - *other $(, self.$compN - *other )*)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn scalar_sub_inplace(&mut self, other: &N) {
|
||||
fn scalar_sub_inplace(&mut self, other: &N) {
|
||||
self.$comp0 = self.$comp0 - *other;
|
||||
$(self.$compN = self.$compN - *other; )*
|
||||
}
|
||||
@ -168,21 +168,21 @@ macro_rules! indexable_impl(
|
||||
($t: ident, $dim: expr) => (
|
||||
impl<N: Clone> Indexable<(uint, uint), N> for $t<N> {
|
||||
#[inline]
|
||||
pub fn at(&self, (i, j): (uint, uint)) -> N {
|
||||
fn at(&self, (i, j): (uint, uint)) -> N {
|
||||
unsafe {
|
||||
cast::transmute::<&$t<N>, &[N, ..$dim * $dim]>(self)[i * $dim + j].clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set(&mut self, (i, j): (uint, uint), val: N) {
|
||||
fn set(&mut self, (i, j): (uint, uint), val: N) {
|
||||
unsafe {
|
||||
cast::transmute::<&mut $t<N>, &mut [N, ..$dim * $dim]>(self)[i * $dim + j] = val
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn swap(&mut self, (i1, j1): (uint, uint), (i2, j2): (uint, uint)) {
|
||||
fn swap(&mut self, (i1, j1): (uint, uint), (i2, j2): (uint, uint)) {
|
||||
unsafe {
|
||||
cast::transmute::<&mut $t<N>, &mut [N, ..$dim * $dim]>(self)
|
||||
.swap(i1 * $dim + j1, i2 * $dim + j2)
|
||||
|
@ -2,10 +2,10 @@
|
||||
/// approximate a sphere using support mapping functions.
|
||||
pub trait UniformSphereSample {
|
||||
/// Iterate throught the samples.
|
||||
pub fn sample(&fn(&'static Self));
|
||||
fn sample(&fn(&'static Self));
|
||||
|
||||
/// Gets the list of all samples.
|
||||
pub fn sample_list() -> ~[&'static Self] {
|
||||
fn sample_list() -> ~[&'static Self] {
|
||||
let mut res = ~[];
|
||||
|
||||
do UniformSphereSample::sample::<Self> |s| {
|
||||
|
@ -26,17 +26,17 @@ impl<N> vec::Vec0<N> {
|
||||
|
||||
impl<N: Clone> Indexable<uint, N> for vec::Vec0<N> {
|
||||
#[inline]
|
||||
pub fn at(&self, _: uint) -> N {
|
||||
fn at(&self, _: uint) -> N {
|
||||
fail!("Cannot index a Vec0.")
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set(&mut self, _: uint, _: N) {
|
||||
fn set(&mut self, _: uint, _: N) {
|
||||
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn swap(&mut self, _: uint, _: uint) {
|
||||
fn swap(&mut self, _: uint, _: uint) {
|
||||
|
||||
}
|
||||
}
|
||||
@ -72,10 +72,10 @@ impl<N> Dim for vec::Vec0<N> {
|
||||
|
||||
impl<N: Clone + DivisionRing + Algebraic + ApproxEq<N>> Basis for vec::Vec0<N> {
|
||||
#[inline(always)]
|
||||
pub fn canonical_basis(_: &fn(vec::Vec0<N>)) { }
|
||||
fn canonical_basis(_: &fn(vec::Vec0<N>)) { }
|
||||
|
||||
#[inline(always)]
|
||||
pub fn orthonormal_subspace_basis(&self, _: &fn(vec::Vec0<N>)) { }
|
||||
fn orthonormal_subspace_basis(&self, _: &fn(vec::Vec0<N>)) { }
|
||||
}
|
||||
|
||||
impl<N: Clone + Add<N,N>> Add<vec::Vec0<N>, vec::Vec0<N>> for vec::Vec0<N> {
|
||||
|
@ -95,7 +95,7 @@ macro_rules! vec_cast_impl(
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<Nin: NumCast + Clone, Nout: NumCast> VecCast<$t<Nout>> for $t<Nin> {
|
||||
#[inline]
|
||||
pub fn from(v: $t<Nin>) -> $t<Nout> {
|
||||
fn from(v: $t<Nin>) -> $t<Nout> {
|
||||
$t::new(NumCast::from(v.$comp0.clone()) $(, NumCast::from(v.$compN.clone()))*)
|
||||
}
|
||||
}
|
||||
@ -106,21 +106,21 @@ macro_rules! indexable_impl(
|
||||
($t: ident, $dim: expr) => (
|
||||
impl<N: Clone> Indexable<uint, N> for $t<N> {
|
||||
#[inline]
|
||||
pub fn at(&self, i: uint) -> N {
|
||||
fn at(&self, i: uint) -> N {
|
||||
unsafe {
|
||||
cast::transmute::<&$t<N>, &[N, ..$dim]>(self)[i].clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set(&mut self, i: uint, val: N) {
|
||||
fn set(&mut self, i: uint, val: N) {
|
||||
unsafe {
|
||||
cast::transmute::<&mut $t<N>, &mut [N, ..$dim]>(self)[i] = val
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn swap(&mut self, i1: uint, i2: uint) {
|
||||
fn swap(&mut self, i1: uint, i2: uint) {
|
||||
unsafe {
|
||||
cast::transmute::<&mut $t<N>, &mut [N, ..$dim]>(self).swap(i1, i2)
|
||||
}
|
||||
@ -185,7 +185,7 @@ macro_rules! basis_impl(
|
||||
($t: ident, $dim: expr) => (
|
||||
impl<N: Clone + DivisionRing + Algebraic + ApproxEq<N>> Basis for $t<N> {
|
||||
#[inline]
|
||||
pub fn canonical_basis(f: &fn($t<N>)) {
|
||||
fn canonical_basis(f: &fn($t<N>)) {
|
||||
for i in range(0u, $dim) {
|
||||
let mut basis_element : $t<N> = Zero::zero();
|
||||
|
||||
@ -196,7 +196,7 @@ macro_rules! basis_impl(
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn orthonormal_subspace_basis(&self, f: &fn($t<N>)) {
|
||||
fn orthonormal_subspace_basis(&self, f: &fn($t<N>)) {
|
||||
// compute the basis of the orthogonal subspace using Gram-Schmidt
|
||||
// orthogonalization algorithm
|
||||
let mut basis: ~[$t<N>] = ~[];
|
||||
|
@ -144,16 +144,16 @@ static SAMPLES_3_F64: [Vec3<f64>, ..42] = [
|
||||
|
||||
impl UniformSphereSample for Vec2<f64> {
|
||||
#[inline(always)]
|
||||
pub fn sample(f: &fn(&'static Vec2<f64>)) {
|
||||
for sample in SAMPLES_2_F64.iter() {
|
||||
f(sample)
|
||||
}
|
||||
}
|
||||
fn sample(f: &fn(&'static Vec2<f64>)) {
|
||||
for sample in SAMPLES_2_F64.iter() {
|
||||
f(sample)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl UniformSphereSample for Vec3<f64> {
|
||||
#[inline(always)]
|
||||
pub fn sample(f: &fn(&'static Vec3<f64>)) {
|
||||
fn sample(f: &fn(&'static Vec3<f64>)) {
|
||||
for sample in SAMPLES_3_F64.iter() {
|
||||
f(sample)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user