From cc253346c52425bea2ca9919de87e7cfa5ecea97 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Tue, 17 Nov 2020 20:59:50 +0100 Subject: Add polygon graph --- src/math/line_segment.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/math/line_segment.rs') diff --git a/src/math/line_segment.rs b/src/math/line_segment.rs index 7dacf54..1c2c01c 100644 --- a/src/math/line_segment.rs +++ b/src/math/line_segment.rs @@ -126,6 +126,14 @@ impl LineSegment { } } } + + /// Checks if this line segment and the other line segment are the same, ignoring the direction + /// in which the lines are going, in other words, which of the vectors the line starts at and which + /// vector the line ends at is irrelevant. + pub fn eq_ignore_dir(&self, other: &LineSegment) -> bool { + (self.start == other.start && self.end == other.end) + || (self.end == other.start && self.start == other.end) + } } #[derive(PartialEq, Eq)] -- cgit v1.2.3-70-g09d2