Struct lyon_geom::Arc

source ·
pub struct Arc<S> {
    pub center: Point<S>,
    pub radii: Vector<S>,
    pub start_angle: Angle<S>,
    pub sweep_angle: Angle<S>,
    pub x_rotation: Angle<S>,
}
Expand description

An elliptic arc curve segment.

Fields§

§center: Point<S>§radii: Vector<S>§start_angle: Angle<S>§sweep_angle: Angle<S>§x_rotation: Angle<S>

Implementations§

source§

impl<S: Scalar> Arc<S>

source

pub fn circle(center: Point<S>, radius: S) -> Self

Create simple circle.

source

pub fn from_svg_arc(arc: &SvgArc<S>) -> Arc<S>

Convert from the SVG arc notation.

source

pub fn to_svg_arc(&self) -> SvgArc<S>

Convert to the SVG arc notation.

source

pub fn for_each_quadratic_bezier<F>(&self, cb: &mut F)

Approximate the arc with a sequence of quadratic bézier curves.

source

pub fn for_each_quadratic_bezier_with_t<F>(&self, cb: &mut F)

Approximate the arc with a sequence of quadratic bézier curves.

source

pub fn for_each_cubic_bezier<F>(&self, cb: &mut F)
where F: FnMut(&CubicBezierSegment<S>),

Approximate the arc with a sequence of cubic bézier curves.

source

pub fn sample(&self, t: S) -> Point<S>

Sample the curve at t (expecting t between 0 and 1).

source

pub fn x(&self, t: S) -> S

source

pub fn y(&self, t: S) -> S

source

pub fn sample_tangent(&self, t: S) -> Vector<S>

Sample the curve’s tangent at t (expecting t between 0 and 1).

source

pub fn get_angle(&self, t: S) -> Angle<S>

Sample the curve’s angle at t (expecting t between 0 and 1).

source

pub fn end_angle(&self) -> Angle<S>

source

pub fn from(&self) -> Point<S>

source

pub fn to(&self) -> Point<S>

source

pub fn split_range(&self, t_range: Range<S>) -> Self

Return the sub-curve inside a given range of t.

This is equivalent splitting at the range’s end points.

source

pub fn split(&self, t: S) -> (Arc<S>, Arc<S>)

Split this curve into two sub-curves.

source

pub fn before_split(&self, t: S) -> Arc<S>

Return the curve before the split point.

source

pub fn after_split(&self, t: S) -> Arc<S>

Return the curve after the split point.

source

pub fn flip(&self) -> Self

Swap the direction of the segment.

source

pub fn for_each_flattened<F>(&self, tolerance: S, callback: &mut F)
where F: FnMut(&LineSegment<S>),

Approximates the curve with sequence of line segments.

The tolerance parameter defines the maximum distance between the curve and its approximation.

source

pub fn for_each_flattened_with_t<F>(&self, tolerance: S, callback: &mut F)
where F: FnMut(&LineSegment<S>, Range<S>),

Approximates the curve with sequence of line segments.

The tolerance parameter defines the maximum distance between the curve and its approximation.

The end of the t parameter range at the final segment is guaranteed to be equal to 1.0.

source

pub fn flattened(&self, tolerance: S) -> Flattened<S>

Returns the flattened representation of the curve as an iterator, starting after the current point.

source

pub fn fast_bounding_box(&self) -> Box2D<S>

Returns a conservative rectangle that contains the curve.

source

pub fn bounding_box(&self) -> Box2D<S>

Returns a conservative rectangle that contains the curve.

source

pub fn for_each_local_x_extremum_t<F>(&self, cb: &mut F)
where F: FnMut(S),

source

pub fn for_each_local_y_extremum_t<F>(&self, cb: &mut F)
where F: FnMut(S),

source

pub fn bounding_range_x(&self) -> (S, S)

source

pub fn bounding_range_y(&self) -> (S, S)

source

pub fn fast_bounding_range_x(&self) -> (S, S)

source

pub fn fast_bounding_range_y(&self) -> (S, S)

source

pub fn approximate_length(&self, tolerance: S) -> S

Trait Implementations§

source§

impl<S: Clone> Clone for Arc<S>

source§

fn clone(&self) -> Arc<S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S: Debug> Debug for Arc<S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<S: Scalar> From<SvgArc<S>> for Arc<S>

source§

fn from(svg: SvgArc<S>) -> Self

Converts to this type from the input type.
source§

impl<S: PartialEq> PartialEq for Arc<S>

source§

fn eq(&self, other: &Arc<S>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<S: Scalar> Segment for Arc<S>

§

type Scalar = S

source§

fn from(&self) -> Point<S>

Start of the curve.
source§

fn to(&self) -> Point<S>

End of the curve.
source§

fn sample(&self, t: S) -> Point<S>

Sample the curve at t (expecting t between 0 and 1).
source§

fn x(&self, t: S) -> S

Sample x at t (expecting t between 0 and 1).
source§

fn y(&self, t: S) -> S

Sample y at t (expecting t between 0 and 1).
source§

fn derivative(&self, t: S) -> Vector<S>

Sample the derivative at t (expecting t between 0 and 1).
source§

fn split(&self, t: S) -> (Self, Self)

Split this curve into two sub-curves.
source§

fn before_split(&self, t: S) -> Self

Return the curve before the split point.
source§

fn after_split(&self, t: S) -> Self

Return the curve after the split point.
source§

fn split_range(&self, t_range: Range<S>) -> Self

Return the curve inside a given range of t. Read more
source§

fn flip(&self) -> Self

Swap the direction of the segment.
source§

fn approximate_length(&self, tolerance: S) -> S

Compute the length of the segment using a flattened approximation.
source§

fn for_each_flattened_with_t( &self, tolerance: Self::Scalar, callback: &mut dyn FnMut(&LineSegment<S>, Range<S>) )

Approximates the curve with sequence of line segments. Read more
source§

fn dx(&self, t: Self::Scalar) -> Self::Scalar

Sample x derivative at t (expecting t between 0 and 1).
source§

fn dy(&self, t: Self::Scalar) -> Self::Scalar

Sample y derivative at t (expecting t between 0 and 1).
source§

impl<S: Copy> Copy for Arc<S>

source§

impl<S> StructuralPartialEq for Arc<S>

Auto Trait Implementations§

§

impl<S> RefUnwindSafe for Arc<S>
where S: RefUnwindSafe,

§

impl<S> Send for Arc<S>
where S: Send,

§

impl<S> Sync for Arc<S>
where S: Sync,

§

impl<S> Unpin for Arc<S>
where S: Unpin,

§

impl<S> UnwindSafe for Arc<S>
where S: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.