From 70b39deaecba09499a9cb4c08fa7a3995c38768a Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 28 Nov 2023 17:21:45 +0100 Subject: [PATCH] Add convenience methods for `Winding` --- crates/fj-math/src/triangle.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/fj-math/src/triangle.rs b/crates/fj-math/src/triangle.rs index 8349a7dbd..0dcd417e3 100644 --- a/crates/fj-math/src/triangle.rs +++ b/crates/fj-math/src/triangle.rs @@ -137,6 +137,18 @@ pub enum Winding { Cw, } +impl Winding { + /// Indicate whether the winding is counter-clockwise + pub fn is_ccw(&self) -> bool { + matches!(self, Self::Ccw) + } + + /// Indicate whether the winding is clockwise + pub fn is_cw(&self) -> bool { + matches!(self, Self::Cw) + } +} + #[cfg(test)] mod tests { use crate::{Point, Vector};