summaryrefslogtreecommitdiffstats
path: root/graphics/src/geometry/path/arc.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-03-03 04:57:55 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-03-03 04:57:55 +0100
commit6cc48b5c62bac287b8f9f1c79c1fb7486c51b18f (patch)
tree7a9d57f52e3bee9f4d910c89178dc3e2917957a1 /graphics/src/geometry/path/arc.rs
parentd13d19ba3569560edd67f20b48f37548d10ceee9 (diff)
downloadiced-6cc48b5c62bac287b8f9f1c79c1fb7486c51b18f.tar.gz
iced-6cc48b5c62bac287b8f9f1c79c1fb7486c51b18f.tar.bz2
iced-6cc48b5c62bac287b8f9f1c79c1fb7486c51b18f.zip
Move `Canvas` and `QRCode` to `iced` crate
Rename `canvas` modules to `geometry` in graphics subcrates
Diffstat (limited to 'graphics/src/geometry/path/arc.rs')
-rw-r--r--graphics/src/geometry/path/arc.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/graphics/src/geometry/path/arc.rs b/graphics/src/geometry/path/arc.rs
new file mode 100644
index 00000000..e0747d3e
--- /dev/null
+++ b/graphics/src/geometry/path/arc.rs
@@ -0,0 +1,42 @@
+//! Build and draw curves.
+use crate::{Point, Vector};
+
+/// A segment of a differentiable curve.
+#[derive(Debug, Clone, Copy)]
+pub struct Arc {
+ /// The center of the arc.
+ pub center: Point,
+ /// The radius of the arc.
+ pub radius: f32,
+ /// The start of the segment's angle, clockwise rotation.
+ pub start_angle: f32,
+ /// The end of the segment's angle, clockwise rotation.
+ pub end_angle: f32,
+}
+
+/// An elliptical [`Arc`].
+#[derive(Debug, Clone, Copy)]
+pub struct Elliptical {
+ /// The center of the arc.
+ pub center: Point,
+ /// The radii of the arc's ellipse, defining its axes.
+ pub radii: Vector,
+ /// The rotation of the arc's ellipse.
+ pub rotation: f32,
+ /// The start of the segment's angle, clockwise rotation.
+ pub start_angle: f32,
+ /// The end of the segment's angle, clockwise rotation.
+ pub end_angle: f32,
+}
+
+impl From<Arc> for Elliptical {
+ fn from(arc: Arc) -> Elliptical {
+ Elliptical {
+ center: arc.center,
+ radii: Vector::new(arc.radius, arc.radius),
+ rotation: 0.0,
+ start_angle: arc.start_angle,
+ end_angle: arc.end_angle,
+ }
+ }
+}