Struct Arc
pub struct Arc {
pub center: Point,
pub radii: Vec2,
pub start_angle: f64,
pub sweep_angle: f64,
pub x_rotation: f64,
}Expand description
A single elliptical arc segment.
Fields§
§center: PointThe arc’s centre point.
radii: Vec2The arc’s radii, where the vector’s x-component is the radius in the
positive x direction after applying x_rotation.
start_angle: f64The start angle in radians.
sweep_angle: f64The angle between the start and end of the arc, in radians.
x_rotation: f64How much the arc is rotated, in radians.
Implementations§
§impl Arc
impl Arc
pub fn new(
center: impl Into<Point>,
radii: impl Into<Vec2>,
start_angle: f64,
sweep_angle: f64,
x_rotation: f64,
) -> Arc
pub fn new( center: impl Into<Point>, radii: impl Into<Vec2>, start_angle: f64, sweep_angle: f64, x_rotation: f64, ) -> Arc
Create a new Arc.
pub fn reversed(&self) -> Arc
pub fn reversed(&self) -> Arc
Returns a copy of this Arc in the opposite direction.
The new Arc will sweep towards the original Arcs
start angle.
pub fn append_iter(&self, tolerance: f64) -> ArcAppendIter
pub fn append_iter(&self, tolerance: f64) -> ArcAppendIter
Create an iterator generating Bezier path elements.
The generated elements can be appended to an existing bezier path.
Trait Implementations§
§impl ParamCurve for Arc
impl ParamCurve for Arc
§fn subsegment(&self, range: Range<f64>) -> Arc
fn subsegment(&self, range: Range<f64>) -> Arc
Get a subsegment of the curve for the given parameter range.
§impl Shape for Arc
impl Shape for Arc
§fn perimeter(&self, accuracy: f64) -> f64
fn perimeter(&self, accuracy: f64) -> f64
The perimeter of the arc.
For now we just approximate by using the bezier curve representation.
§fn winding(&self, pt: Point) -> i32
fn winding(&self, pt: Point) -> i32
Note: shape isn’t closed, so a point’s winding number is not well defined.
§type PathElementsIter<'iter> = Chain<Once<PathEl>, ArcAppendIter>
type PathElementsIter<'iter> = Chain<Once<PathEl>, ArcAppendIter>
The iterator returned by the
path_elements method.§fn path_elements(&self, tolerance: f64) -> <Arc as Shape>::PathElementsIter<'_>
fn path_elements(&self, tolerance: f64) -> <Arc as Shape>::PathElementsIter<'_>
§fn bounding_box(&self) -> Rect
fn bounding_box(&self) -> Rect
The smallest rectangle that encloses the shape.
§fn into_path(self, tolerance: f64) -> BezPathwhere
Self: Sized,
fn into_path(self, tolerance: f64) -> BezPathwhere
Self: Sized,
Convert into a Bézier path. Read more
§fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>> ⓘ
fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>> ⓘ
§fn as_rounded_rect(&self) -> Option<RoundedRect>
fn as_rounded_rect(&self) -> Option<RoundedRect>
If the shape is a rounded rectangle, make it available.
§fn as_path_slice(&self) -> Option<&[PathEl]>
fn as_path_slice(&self) -> Option<&[PathEl]>
If the shape is stored as a slice of path elements, make
that available. Read more
impl Copy for Arc
impl StructuralPartialEq for Arc
Auto Trait Implementations§
impl Freeze for Arc
impl RefUnwindSafe for Arc
impl Send for Arc
impl Sync for Arc
impl Unpin for Arc
impl UnsafeUnpin for Arc
impl UnwindSafe for Arc
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more