pub struct ArcGeometry {
pub center: Point2D,
pub radius: f64,
pub start_angle: f64,
pub end_angle: f64,
}Expand description
Arc geometry for pie charts.
Fields§
§center: Point2DCenter point
radius: f64Radius
start_angle: f64Start angle (radians)
end_angle: f64End angle (radians)
Implementations§
Source§impl ArcGeometry
impl ArcGeometry
Sourcepub const fn new(
center: Point2D,
radius: f64,
start_angle: f64,
end_angle: f64,
) -> ArcGeometry
pub const fn new( center: Point2D, radius: f64, start_angle: f64, end_angle: f64, ) -> ArcGeometry
Create a new arc.
Sourcepub fn circle(center: Point2D, radius: f64) -> ArcGeometry
pub fn circle(center: Point2D, radius: f64) -> ArcGeometry
Create a full circle.
Sourcepub fn point_at_angle(&self, angle: f64) -> Point2D
pub fn point_at_angle(&self, angle: f64) -> Point2D
Point on arc at given angle.
Sourcepub fn start_point(&self) -> Point2D
pub fn start_point(&self) -> Point2D
Start point of arc.
Sourcepub fn arc_length(&self) -> f64
pub fn arc_length(&self) -> f64
Arc length.
Sourcepub fn to_polyline(&self, segments: usize) -> Vec<Point2D>
pub fn to_polyline(&self, segments: usize) -> Vec<Point2D>
Convert arc to polyline for rendering.
Sourcepub fn to_pie_slice(&self, segments: usize) -> Vec<Point2D>
pub fn to_pie_slice(&self, segments: usize) -> Vec<Point2D>
Convert arc to pie slice (includes center point).
Sourcepub fn contains_angle(&self, angle: f64) -> bool
pub fn contains_angle(&self, angle: f64) -> bool
Check if angle is within arc sweep.
Trait Implementations§
Source§impl Clone for ArcGeometry
impl Clone for ArcGeometry
Source§fn clone(&self) -> ArcGeometry
fn clone(&self) -> ArcGeometry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ArcGeometry
Source§impl Debug for ArcGeometry
impl Debug for ArcGeometry
Source§impl PartialEq for ArcGeometry
impl PartialEq for ArcGeometry
Source§fn eq(&self, other: &ArcGeometry) -> bool
fn eq(&self, other: &ArcGeometry) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ArcGeometry
Auto Trait Implementations§
impl Freeze for ArcGeometry
impl RefUnwindSafe for ArcGeometry
impl Send for ArcGeometry
impl Sync for ArcGeometry
impl Unpin for ArcGeometry
impl UnsafeUnpin for ArcGeometry
impl UnwindSafe for ArcGeometry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more