1use std::ops::Deref;
2
3use crate::{
4 math::{edge::Edge, point::Point, vector::Vector},
5 meta::Transform,
6};
7
8pub mod alias;
9pub mod circle;
10pub mod concave;
11pub mod convex;
12pub mod line;
13pub mod polygon;
14pub mod rect;
15pub mod square;
16pub mod triangle;
17pub mod utils;
18
19pub trait GeometryTransformer {
20 fn sync_transform(&mut self, transform: &Transform);
21}
22
23pub trait EdgeIterable {
24 fn edge_iter(&self) -> Box<dyn Iterator<Item = Edge<'_>> + '_>;
25}
26
27pub trait CenterPoint {
28 fn center_point(&self) -> Point;
29}
30
31impl<T, Z> CenterPoint for T
32where
33 T: Deref<Target = Z>,
34 Z: CenterPoint,
35{
36 fn center_point(&self) -> Point {
37 self.deref().center_point()
38 }
39}
40
41pub trait NearestPoint {
42 fn support_find_nearest_point(&self) -> bool {
43 true
44 }
45
46 fn nearest_point(&self, reference_point: &Point, direction: &Vector) -> Point;
47}
48
49pub trait MeasureContactPoint {
50 fn measure(&self, contact_points: Vec<Point>) -> Vec<Point> {
51 contact_points
52 }
53}
54
55pub use circle::Circle;
56pub use concave::ConcavePolygon;
57pub use convex::ConvexPolygon;
58pub use line::Line;
59pub use polygon::ConstRegularPolygon;
60pub use polygon::RegularPolygon;
61pub use rect::Rect;
62pub use square::Square;
63pub use triangle::Triangle;