diff options
Diffstat (limited to 'src/math/line_segment.rs')
| -rw-r--r-- | src/math/line_segment.rs | 8 |
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)] |
