use polymorpher::{
Morph, RoundedPolygon,
geometry::{Point, Vector},
};
const EPSILON: f32 = 1e-4;
#[test]
fn cubics_test() {
let poly1 = RoundedPolygon::from_vertices_count_at(3, 1.0, Point::new(0.5, 0.5), None, &[]);
let cubics11 = Morph::new(poly1.clone(), poly1.clone()).as_cubics(0.0);
assert!(!cubics11.is_empty());
for morph_cubic in cubics11 {
let mut matched = false;
for p1_cubic in &poly1.cubics {
if (morph_cubic.anchor0() - p1_cubic.anchor0())
.abs()
.lower_than(Vector::splat(EPSILON))
.and((morph_cubic.anchor1() - p1_cubic.anchor1()).abs().lower_than(Vector::splat(EPSILON)))
.and((morph_cubic.control0() - p1_cubic.control0()).abs().lower_than(Vector::splat(EPSILON)))
.and((morph_cubic.control1() - p1_cubic.control1()).abs().lower_than(Vector::splat(EPSILON)))
.all()
{
matched = true;
break;
}
}
assert!(matched);
}
}