diff options
| author | Arne Dußin | 2020-12-15 00:46:54 +0100 |
|---|---|---|
| committer | Arne Dußin | 2020-12-15 22:51:46 +0100 |
| commit | 9799d3c6a8f0c242668203a1c70d7b6cfed3e855 (patch) | |
| tree | 9116acbc886f680f82309a42b4e6147e65c1433b /src/math/mod.rs | |
| parent | 3bc690803fb59493ea8180fd630d65b3e26642d0 (diff) | |
| download | graf_karto-9799d3c6a8f0c242668203a1c70d7b6cfed3e855.tar.gz graf_karto-9799d3c6a8f0c242668203a1c70d7b6cfed3e855.zip | |
Refactor to make interaction between tools easier
Diffstat (limited to 'src/math/mod.rs')
| -rw-r--r-- | src/math/mod.rs | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/math/mod.rs b/src/math/mod.rs index 279affc..829a3c5 100644 --- a/src/math/mod.rs +++ b/src/math/mod.rs @@ -1,34 +1,20 @@ pub mod line_segment; pub mod polygon; pub mod rect; +pub mod surface; pub mod triangle; pub mod vec2; pub use self::line_segment::*; pub use self::polygon::*; pub use self::rect::*; +pub use self::surface::*; pub use self::triangle::*; pub use self::vec2::*; -use nalgebra::Scalar; use num_traits::Float; use std::cmp::Ordering; -/// Trait that describes an area in the vector space on the field of T -pub trait Surface<T: Scalar + Copy> { - /// Checks if a point lies on this surface. - fn contains_point(&self, point: &Vec2<T>) -> bool; - - /// Checks if a line segment is entirely contained by this surface. - fn contains_line_segment(&self, line_segment: &LineSegment<T>) -> bool; - - /// Checks if a rectangle is entirely contained inside this surface. - fn contains_rect(&self, rect: &Rect<T>) -> bool; - - /// Checks if a polygon is contained wholly by this surface. - fn contains_polygon(&self, polygon: &Polygon<T>) -> bool; -} - /// Round a floating point number to the nearest step given by the step argument. For instance, if /// the step is 0.5, then all numbers from 0.0 to 0.24999... will be 0., while all numbers from /// 0.25 to 0.74999... will be 0.5 and so on. |
