+impl<T> From<Point2D<T>> for (T, T) {
+ fn from(item: Point2D<T>) -> Self {
+ (item.x, item.y)
+ }
+}
+
+impl From<Degrees> for Point2D<f64> {
+ fn from(item: Degrees) -> Self {
+ let r = item.0.to_radians();
+ Point2D {
+ x: r.cos(),
+ y: r.sin(),
+ }
+ }
+}
+
+impl From<Radians> for Point2D<f64> {
+ fn from(item: Radians) -> Self {
+ Point2D {
+ x: item.0.cos(),
+ y: item.0.sin(),
+ }
+ }
+}
+
+#[derive(Debug, Default, PartialEq, Clone, Copy)]
+pub struct Degrees(pub f64);
+#[derive(Debug, Default, PartialEq, Clone, Copy)]
+pub struct Radians(pub f64);
+
+impl Degrees {
+ #[allow(dead_code)]
+ fn to_radians(&self) -> Radians {
+ Radians(self.0.to_radians())
+ }
+}
+
+impl Radians {
+ #[allow(dead_code)]
+ fn to_degrees(&self) -> Degrees {
+ Degrees(self.0.to_degrees())
+ }
+}
+