|
|
|
@ -245,29 +245,25 @@ where T: Add<Output = T> + Sub<Output = T> + Neg<Output = T> |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// https://rechneronline.de/pi/tetrahedron.php
|
|
|
|
// construct via cube, see polyhedra.pdf
|
|
|
|
pub fn tetrahedron(a :T) -> Polyeder<T> {
|
|
|
|
let f0 :T = 0.into();
|
|
|
|
let f3 :T = 3.into();
|
|
|
|
let f4 :T = 4.into();
|
|
|
|
let f6 :T = 6.into();
|
|
|
|
let f12 :T = 12.into();
|
|
|
|
|
|
|
|
let yi :T = a / f12 * T::sqrt(f6).unwrap();
|
|
|
|
let yc :T = a / f4 * T::sqrt(f6).unwrap();
|
|
|
|
let zi :T = T::sqrt(f3).unwrap() / f6 * a;
|
|
|
|
let zc :T = T::sqrt(f3).unwrap() / f3 * a;
|
|
|
|
let ah :T = a / 2.into();
|
|
|
|
|
|
|
|
let ps = vec!( Point::new( f0, yc, f0)
|
|
|
|
, Point::new(-ah, -yi, -zi)
|
|
|
|
, Point::new( ah, -yi, -zi)
|
|
|
|
, Point::new( f0, -yi, zc) );
|
|
|
|
|
|
|
|
let fs = vec!( Face::new(vec!(1, 2, 3), &ps)
|
|
|
|
, Face::new(vec!(1, 0, 2), &ps)
|
|
|
|
, Face::new(vec!(3, 0, 1), &ps)
|
|
|
|
, Face::new(vec!(2, 0, 3), &ps) );
|
|
|
|
let f2 :T = 2.into();
|
|
|
|
let ch = a / (f2 * T::sqrt(f2).unwrap());
|
|
|
|
|
|
|
|
let ps = vec!( Point::new(-ch, -ch, ch) // A
|
|
|
|
, Point::new(-ch, ch, -ch) // C
|
|
|
|
, Point::new( ch, -ch, -ch) // E
|
|
|
|
, Point::new( ch, ch, ch) ); // G
|
|
|
|
|
|
|
|
// bottom: 1, 2, 3
|
|
|
|
let fs = vec!( Face::new(vec!(2, 1, 0), &ps) // bottom
|
|
|
|
, Face::new(vec!(3, 2, 0), &ps)
|
|
|
|
, Face::new(vec!(0, 1, 3), &ps)
|
|
|
|
, Face::new(vec!(1, 2, 3), &ps) );
|
|
|
|
//let fs = vec!( Face::new(vec!(0, 1, 2), &ps) // bottom
|
|
|
|
// , Face::new(vec!(0, 2, 3), &ps)
|
|
|
|
// , Face::new(vec!(3, 1, 0), &ps)
|
|
|
|
// , Face::new(vec!(3, 2, 1), &ps) );
|
|
|
|
|
|
|
|
Polyeder{ points: ps, faces: fs }
|
|
|
|
}
|
|
|
|
|