use i_shape::IShape;
use line::Line3;
use triprism::TriPrism;
#[test]
fn test_intersect_line() {
{
let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.);
let b = Line3::init(&[0.25, 0.25, 0.], &[1., 1., 0.]);
match a.get_intersect(&b) {
(true, Some(_loc)) => {}
_ => panic!("unexpected result for triprism line intersection"),
}
}
{
let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.);
let b = Line3::init(&[0.5, -50., 0.], &[0.5, 50., 0.]);
match a.get_intersect(&b) {
(true, Some(_loc)) => {}
_ => panic!("unexpected result for triprism line intersection"),
}
}
{
let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.);
let b = Line3::init(&[0.25, 0.25, 0.5], &[0.26, 0.26, 0.5]);
match a.get_intersect(&b) {
(true, Some(_loc)) => {}
_ => panic!("unexpected result for triprism line intersection"),
}
}
{
let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.);
let b = Line3::init(&[0.25, 0.25, 0.], &[1., 1., 0.]);
match b.get_intersect(&a) {
(true, Some(_loc)) => {}
_ => panic!("unexpected result for triprism line intersection"),
}
}
{
let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.);
let b = Line3::init(&[0.5, -50., 0.], &[0.5, 50., 0.]);
match b.get_intersect(&a) {
(true, Some(_loc)) => {}
_ => panic!("unexpected result for triprism line intersection"),
}
}
{
let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.);
let b = Line3::init(&[0.25, 0.25, 0.5], &[0.26, 0.26, 0.5]);
match b.get_intersect(&a) {
(true, Some(_loc)) => {}
_ => panic!("unexpected result for triprism line intersection"),
}
}
{
let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.);
let b = Line3::init(&[0.25, 0.25, 1.5], &[1., 1., 1.5]);
match a.get_intersect(&b) {
(true, Some(_loc)) => {
panic!("unexpected result for triprism line intersection");
}
_ => {}
}
}
{
let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.);
let b = Line3::init(&[0., -5., 0.5], &[50., 45., 0.5]);
match a.get_intersect(&b) {
(true, Some(_loc)) => {
panic!("unexpected result for triprism line intersection");
}
_ => {}
}
}
}