From 4d617bcd67f9e42218da190dc9a0bf2f10d4b78d Mon Sep 17 00:00:00 2001 From: Martin Haug Date: Wed, 16 Mar 2022 12:36:50 +0100 Subject: `LineNode` --- src/geom/angle.rs | 10 ++++++++++ src/geom/point.rs | 6 ++++++ 2 files changed, 16 insertions(+) (limited to 'src/geom') diff --git a/src/geom/angle.rs b/src/geom/angle.rs index ef3276e8..4e08a518 100644 --- a/src/geom/angle.rs +++ b/src/geom/angle.rs @@ -40,6 +40,16 @@ impl Angle { (self.0).0 } + /// Get the sine of this angle. + pub fn sin(self) -> f64 { + self.to_rad().sin() + } + + /// Get the cosine of this angle. + pub fn cos(self) -> f64 { + self.to_rad().cos() + } + /// Create an angle from a value in a unit. pub fn with_unit(val: f64, unit: AngularUnit) -> Self { Self(Scalar(val * unit.raw_scale())) diff --git a/src/geom/point.rs b/src/geom/point.rs index 6d77507b..7ab0d375 100644 --- a/src/geom/point.rs +++ b/src/geom/point.rs @@ -49,6 +49,12 @@ impl Point { } } +impl From> for Point { + fn from(spec: Spec) -> Self { + Self::new(spec.x, spec.y) + } +} + impl Get for Point { type Component = Length; -- cgit v1.2.3