summaryrefslogtreecommitdiff
path: root/src/geom
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2022-03-16 12:36:50 +0100
committerMartin Haug <mhaug@live.de>2022-03-16 12:36:50 +0100
commit4d617bcd67f9e42218da190dc9a0bf2f10d4b78d (patch)
treefea275e9321004c15ed7d1def9f3749641f648ed /src/geom
parent288a926feae1e73dff5a6b103aa920d6f7eb0f35 (diff)
`LineNode`
Diffstat (limited to 'src/geom')
-rw-r--r--src/geom/angle.rs10
-rw-r--r--src/geom/point.rs6
2 files changed, 16 insertions, 0 deletions
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<Spec<Length>> for Point {
+ fn from(spec: Spec<Length>) -> Self {
+ Self::new(spec.x, spec.y)
+ }
+}
+
impl Get<SpecAxis> for Point {
type Component = Length;