diff options
| author | Arne Dußin | 2020-11-23 23:38:52 +0100 |
|---|---|---|
| committer | Arne Dußin | 2020-11-23 23:38:52 +0100 |
| commit | e62275d90d3ebf379e8ab268cb77d8eaf6d1cf07 (patch) | |
| tree | 5f8aee175d048e40b8b496157816177e0597e0f9 /src/math/mod.rs | |
| parent | bff1955c38480f2dffd0a10c16ef46dc11320752 (diff) | |
| parent | 3b0c99351da92410bbfaba233e40376b767cb64e (diff) | |
| download | graf_karto-e62275d90d3ebf379e8ab268cb77d8eaf6d1cf07.tar.gz graf_karto-e62275d90d3ebf379e8ab268cb77d8eaf6d1cf07.zip | |
Merge branch 'triangulation' into polygon-rooms
Diffstat (limited to 'src/math/mod.rs')
| -rw-r--r-- | src/math/mod.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/math/mod.rs b/src/math/mod.rs index 0b591d7..6f83c98 100644 --- a/src/math/mod.rs +++ b/src/math/mod.rs @@ -1,17 +1,27 @@ pub mod line_segment; pub mod polygon; -pub mod polygon_graph; pub mod rect; +pub mod triangle; pub mod vec2; pub use self::line_segment::*; pub use self::polygon::*; -pub use self::polygon_graph::*; pub use self::rect::*; +pub use self::triangle::*; pub use self::vec2::*; +use nalgebra::Scalar; 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; +} + /// 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. |
