summaryrefslogtreecommitdiff
path: root/src/geom
diff options
context:
space:
mode:
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;