Skip to main content

Arc

Struct Arc 

Source
pub struct Arc {
    pub center: Point,
    pub radius: f64,
    pub start: f64,
    pub sweep: f64,
}
Expand description

A circular arc: center + radius·(cos θ, sin θ) for θ = start + sweep·t, t ∈ [0, 1].

sweep > 0 is counter-clockwise. |sweep| ≤ 2π.

Fields§

§center: Point

Center.

§radius: f64

Radius (> 0).

§start: f64

Start angle in radians.

§sweep: f64

Signed sweep in radians.

Implementations§

Source§

impl Arc

Source

pub fn new( center: Point, radius: f64, start: f64, sweep: f64, ) -> GeoResult<Self>

Create a validated arc.

Source

pub fn from_three_points(a: Point, m: Point, b: Point) -> GeoResult<Self>

Arc through three points a → m → b.

Source

pub fn from_bulge(p0: Point, p1: Point, bulge: f64) -> GeoResult<Self>

Arc between p0 and p1 with DXF-style bulge (tan(sweep/4), positive = CCW).

Source

pub fn bulge(self) -> f64

Bulge value of this arc (tan(sweep/4)).

Source

pub fn end_angle(self) -> f64

End angle (start + sweep).

Source

pub fn point_at(self, t: f64) -> Point

Point at parameter t.

Source

pub fn start_point(self) -> Point

Start point.

Source

pub fn end_point(self) -> Point

End point.

Source

pub fn mid_point(self) -> Point

Midpoint along the arc.

Source

pub fn tangent_at(self, t: f64) -> Vector

Unit tangent at t in the direction of travel.

Source

pub fn length(self) -> f64

Arc length.

Source

pub fn param_of_angle(self, a: f64, eps: f64) -> Option<f64>

Parameter for absolute angle a if it lies on the arc (with eps radians slack).

Source

pub fn closest(self, p: Point) -> (f64, Point)

Closest point on the arc and its parameter.

Source

pub fn distance_to_point(self, p: Point) -> f64

Distance from p to the arc.

Source

pub fn bbox(self) -> Aabb

Exact bounding box.

Source

pub fn reversed(self) -> Self

Reversed arc (same points, opposite direction).

Source

pub fn subarc(self, t0: f64, t1: f64) -> Self

Sub-arc between parameters t0 and t1.

Source

pub fn transform(self, t: Affine) -> GeoResult<Self>

Apply a similarity transform.

Source

pub fn flatten_into(self, tol: f64, out: &mut Vec<Point>)

Append a polyline approximation (excluding the start point) to out.

Trait Implementations§

Source§

impl Clone for Arc

Source§

fn clone(&self) -> Arc

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Arc

Source§

impl Debug for Arc

Source§

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

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

impl<'de> Deserialize<'de> for Arc

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Arc

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Arc

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

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§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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,

Source§

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>,

Source§

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>,

Source§

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.