aboutsummaryrefslogtreecommitdiff
path: root/src/math/line_segment.rs
diff options
context:
space:
mode:
authorArne Dußin2020-11-17 20:59:50 +0100
committerArne Dußin2020-11-17 20:59:50 +0100
commitcc253346c52425bea2ca9919de87e7cfa5ecea97 (patch)
tree320005ee77728851b5934caedd50c8ebf7939706 /src/math/line_segment.rs
parent63f292010e51ad8622cccc4d4b6da887e4eaec47 (diff)
downloadgraf_karto-cc253346c52425bea2ca9919de87e7cfa5ecea97.tar.gz
graf_karto-cc253346c52425bea2ca9919de87e7cfa5ecea97.zip
Add polygon graph
Diffstat (limited to 'src/math/line_segment.rs')
-rw-r--r--src/math/line_segment.rs8
1 files changed, 8 insertions, 0 deletions
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<T: Scalar + Copy> LineSegment<T> {
}
}
}
+
+ /// 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<T>) -> bool {
+ (self.start == other.start && self.end == other.end)
+ || (self.end == other.start && self.start == other.end)
+ }
}
#[derive(PartialEq, Eq)]