use crate::fix::path::{FixPath, FixPathExtension};
use crate::fix::paths::FixPathsExtension;
use alloc::vec::Vec;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FixShape {
pub paths: Vec<FixPath>,
}
impl FixShape {
#[inline(always)]
pub fn points_count(&self) -> usize {
self.paths.points_count()
}
#[inline(always)]
pub fn is_convex_polygon(&self) -> bool {
self.paths.len() == 1 && self.contour().is_convex()
}
#[inline(always)]
pub fn contour(&self) -> &FixPath {
&self.paths[0]
}
#[inline(always)]
pub fn holes(&self) -> &[FixPath] {
&self.paths[1..]
}
#[inline(always)]
pub fn new(paths: Vec<FixPath>) -> Self {
Self { paths }
}
}