use ordered_float::NotNan;
use jagua_rs::fsize;
use jagua_rs::geometry::geo_traits::Shape;
use jagua_rs::geometry::primitives::simple_polygon::SimplePolygon;
const X_MULTIPLIER: fsize = 10.0;
#[derive(PartialEq, PartialOrd, Copy, Clone, Debug, Eq, Ord)]
pub struct LBFPlacingCost(NotNan<fsize>);
impl LBFPlacingCost {
pub fn new(x_max: fsize, y_max: fsize) -> Self {
let cost = x_max * X_MULTIPLIER + y_max;
LBFPlacingCost(NotNan::new(cost).expect("cost is NaN"))
}
pub fn from_shape(shape: &SimplePolygon) -> Self {
LBFPlacingCost::new(shape.bbox().x_max, shape.bbox().y_max)
}
}