Skip to main content

polys/
lib.rs

1pub mod rect;
2pub use crate::rect::Rect;
3pub mod circle;
4pub use crate::circle::Circle;
5pub mod tri;
6pub use crate::tri::Tri;
7pub mod reg;
8pub use crate::reg::Reg;
9
10/// Polygon trait for structs representing 2-dimensional shapes.
11pub trait Polygon {
12    fn area(&self) -> Option<f64>;
13    fn peri(&self) -> Option<f64>;
14    fn angles(&self) -> Option<Vec<f64>>;
15}
16
17/// Enum of all the polygon types
18pub enum Poly {
19    Rect(Rect),
20    Circle(Circle),
21    Tri(Tri),
22    Reg(Reg),
23}