forked from M-Labs/nalgebra
Add sphere sampling implementation for Vec3<f64>.
This commit is contained in:
parent
3a64e05c62
commit
f92b28f53f
@ -100,6 +100,52 @@ static SAMPLES_2_F64: [Vec2<f64>, ..21] = [
|
|||||||
Vec2 { x: 0.95557281, y: -0.29475517 },
|
Vec2 { x: 0.95557281, y: -0.29475517 },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Those vectors come from bullet 3d
|
||||||
|
static SAMPLES_3_F64: [Vec3<f64>, ..42] = [
|
||||||
|
Vec3 { x: 0.000000 , y: -0.000000, z: -1.000000 },
|
||||||
|
Vec3 { x: 0.723608 , y: -0.525725, z: -0.447219 },
|
||||||
|
Vec3 { x: -0.276388, y: -0.850649, z: -0.447219 },
|
||||||
|
Vec3 { x: -0.894426, y: -0.000000, z: -0.447216 },
|
||||||
|
Vec3 { x: -0.276388, y: 0.850649 , z: -0.447220 },
|
||||||
|
Vec3 { x: 0.723608 , y: 0.525725 , z: -0.447219 },
|
||||||
|
Vec3 { x: 0.276388 , y: -0.850649, z: 0.447220 },
|
||||||
|
Vec3 { x: -0.723608, y: -0.525725, z: 0.447219 },
|
||||||
|
Vec3 { x: -0.723608, y: 0.525725 , z: 0.447219 },
|
||||||
|
Vec3 { x: 0.276388 , y: 0.850649 , z: 0.447219 },
|
||||||
|
Vec3 { x: 0.894426 , y: 0.000000 , z: 0.447216 },
|
||||||
|
Vec3 { x: -0.000000, y: 0.000000 , z: 1.000000 },
|
||||||
|
Vec3 { x: 0.425323 , y: -0.309011, z: -0.850654 },
|
||||||
|
Vec3 { x: -0.162456, y: -0.499995, z: -0.850654 },
|
||||||
|
Vec3 { x: 0.262869 , y: -0.809012, z: -0.525738 },
|
||||||
|
Vec3 { x: 0.425323 , y: 0.309011 , z: -0.850654 },
|
||||||
|
Vec3 { x: 0.850648 , y: -0.000000, z: -0.525736 },
|
||||||
|
Vec3 { x: -0.525730, y: -0.000000, z: -0.850652 },
|
||||||
|
Vec3 { x: -0.688190, y: -0.499997, z: -0.525736 },
|
||||||
|
Vec3 { x: -0.162456, y: 0.499995 , z: -0.850654 },
|
||||||
|
Vec3 { x: -0.688190, y: 0.499997 , z: -0.525736 },
|
||||||
|
Vec3 { x: 0.262869 , y: 0.809012 , z: -0.525738 },
|
||||||
|
Vec3 { x: 0.951058 , y: 0.309013 , z: 0.000000 },
|
||||||
|
Vec3 { x: 0.951058 , y: -0.309013, z: 0.000000 },
|
||||||
|
Vec3 { x: 0.587786 , y: -0.809017, z: 0.000000 },
|
||||||
|
Vec3 { x: 0.000000 , y: -1.000000, z: 0.000000 },
|
||||||
|
Vec3 { x: -0.587786, y: -0.809017, z: 0.000000 },
|
||||||
|
Vec3 { x: -0.951058, y: -0.309013, z: -0.000000 },
|
||||||
|
Vec3 { x: -0.951058, y: 0.309013 , z: -0.000000 },
|
||||||
|
Vec3 { x: -0.587786, y: 0.809017 , z: -0.000000 },
|
||||||
|
Vec3 { x: -0.000000, y: 1.000000 , z: -0.000000 },
|
||||||
|
Vec3 { x: 0.587786 , y: 0.809017 , z: -0.000000 },
|
||||||
|
Vec3 { x: 0.688190 , y: -0.499997, z: 0.525736 },
|
||||||
|
Vec3 { x: -0.262869, y: -0.809012, z: 0.525738 },
|
||||||
|
Vec3 { x: -0.850648, y: 0.000000 , z: 0.525736 },
|
||||||
|
Vec3 { x: -0.262869, y: 0.809012 , z: 0.525738 },
|
||||||
|
Vec3 { x: 0.688190 , y: 0.499997 , z: 0.525736 },
|
||||||
|
Vec3 { x: 0.525730 , y: 0.000000 , z: 0.850652 },
|
||||||
|
Vec3 { x: 0.162456 , y: -0.499995, z: 0.850654 },
|
||||||
|
Vec3 { x: -0.425323, y: -0.309011, z: 0.850654 },
|
||||||
|
Vec3 { x: -0.425323, y: 0.309011 , z: 0.850654 },
|
||||||
|
Vec3 { x: 0.162456 , y: 0.499995 , z: 0.850654 }
|
||||||
|
];
|
||||||
|
|
||||||
impl UniformSphereSample for Vec2<f64>
|
impl UniformSphereSample for Vec2<f64>
|
||||||
{
|
{
|
||||||
pub fn sample(f: &fn(&'static Vec2<f64>))
|
pub fn sample(f: &fn(&'static Vec2<f64>))
|
||||||
@ -111,8 +157,9 @@ impl UniformSphereSample for Vec2<f64>
|
|||||||
|
|
||||||
impl UniformSphereSample for Vec3<f64>
|
impl UniformSphereSample for Vec3<f64>
|
||||||
{
|
{
|
||||||
pub fn sample(_: &fn(&'static Vec3<f64>))
|
pub fn sample(f: &fn(&'static Vec3<f64>))
|
||||||
{
|
{
|
||||||
fail!("UniformSphereSample for Vec3<f64> is not yet implemented.")
|
for SAMPLES_3_F64.iter().advance |sample|
|
||||||
|
{ f(sample) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user