iced_graphics/geometry/path/arc.rs
1//! Build and draw curves.
2use iced_core::{Point, Radians, Vector};
3
4/// A segment of a differentiable curve.
5#[derive(Debug, Clone, Copy)]
6pub struct Arc {
7 /// The center of the arc.
8 pub center: Point,
9 /// The radius of the arc.
10 pub radius: f32,
11 /// The start of the segment's angle, clockwise rotation from positive x-axis.
12 pub start_angle: Radians,
13 /// The end of the segment's angle, clockwise rotation from positive x-axis.
14 pub end_angle: Radians,
15}
16
17/// An elliptical [`Arc`].
18#[derive(Debug, Clone, Copy)]
19pub struct Elliptical {
20 /// The center of the arc.
21 pub center: Point,
22 /// The radii of the arc's ellipse. The horizontal and vertical half-dimensions of the ellipse will match the x and y values of the radii vector.
23 pub radii: Vector,
24 /// The clockwise rotation of the arc's ellipse.
25 pub rotation: Radians,
26 /// The start of the segment's angle, clockwise rotation from positive x-axis.
27 pub start_angle: Radians,
28 /// The end of the segment's angle, clockwise rotation from positive x-axis.
29 pub end_angle: Radians,
30}
31
32impl From<Arc> for Elliptical {
33 fn from(arc: Arc) -> Elliptical {
34 Elliptical {
35 center: arc.center,
36 radii: Vector::new(arc.radius, arc.radius),
37 rotation: Radians(0.0),
38 start_angle: arc.start_angle,
39 end_angle: arc.end_angle,
40 }
41 }
42}